armas 0.1.2

UI component library for egui following shadcn/ui design patterns
Documentation

Armas

Crates.io Documentation License

UI component library for egui following shadcn/ui design patterns.

Overview

Armas is a collection of 50+ reusable UI components for egui. It includes a theme system with serializable color palettes and spacing, along with components like buttons, inputs, dialogs, menus, cards, and layouts.

The design is inspired by shadcn/ui's approach to component libraries - focused on composability and consistency rather than heavy abstraction.

Installation

Add this to your Cargo.toml:

[dependencies]
armas = "0.1.0"
egui = "0.33"

Example

use armas::prelude::*;
use egui::Context;

fn ui(ctx: &Context) {
    let theme = ctx.armas_theme();

    egui::CentralPanel::default().show(ctx, |ui| {
        // Button with variants
        Button::new("Click me")
            .variant(ButtonVariant::Default)
            .size(ButtonSize::Default)
            .show(ui);

        // Input field
        let mut text = String::new();
        Input::new(&mut text)
            .placeholder("Enter text...")
            .show(ui);

        // Card layout
        Card::new()
            .title("Example Card")
            .description("This is a card component")
            .show(ui, |ui| {
                ui.label("Card content goes here");
            });
    });
}

Components

Includes the following component categories:

Basic: Button, Input, Select, Toggle, Slider, Progress, Badge, Alert Layout: Card, Separator, Accordion, Tabs, BentoGrid, Sidebar, Table Navigation: Menu, Breadcrumbs, Pagination, TreeView, CommandPalette Overlay: Dialog, Sheet, Drawer, Tooltip

Most components support variants (default, outline, ghost, destructive) and sizes (sm, default, lg) through builder methods.

Theming

The theme system stores color palettes and spacing values in serializable structs. Themes can be loaded from JSON or constructed programmatically:

use armas::theme::{Theme, ThemeColors};

// Load theme from JSON
let theme = Theme::load_from_json("theme.json").unwrap();

// Access theme colors
let primary = theme.primary();
let background = theme.background();

// Use with egui context
ctx.set_armas_theme(theme);

Documentation

Full API documentation is available at docs.rs/armas

Related Crates

License

Licensed under either of:

at your option.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Links