2 unstable releases
Uses new Rust 2024
| 0.5.0 | Mar 11, 2026 |
|---|---|
| 0.3.1 | Dec 15, 2025 |
| 0.3.0 |
|
#432 in GUI
1MB
26K
SLoC
egui-shadcn
Shadcn-inspired component kit for egui
[!WARNING] API STABILITY NOTICE:
egui-shadcnAPI is currently unstable and may change between versions, including breaking changes. Always pin exact crate versions and review release notes before upgrading.
Overview
egui-shadcn provides a set of form components for egui styled after shadcn/ui. It mirrors shadcn variants and sizes while exposing theme tokens for consistent visuals and per-control customization.
Installation
Add to your Cargo.toml:
[dependencies]
egui-shadcn = "0.3.1"
egui = "0.33"
Or from git:
[dependencies]
egui-shadcn = { git = "https://github.com/FerrisMind/shadcn-rs", package = "egui-shadcn" }
Or from crates.io:
cargo add egui-shadcn
Quick Start
use egui_shadcn::{button, ControlSize, ControlVariant, Theme};
fn ui_example(ui: &mut egui::Ui, theme: &Theme) {
button(
ui,
theme,
"Click me",
ControlVariant::Primary,
ControlSize::Md,
true,
);
}
Components
-
Form Controls:
button,text_input,select,checkbox,radio_group,switch,toggle,textarea,slider -
Layout:
card,separator,tabs,scroll_area,collapsible -
Overlays:
dialog,popover,tooltip -
Typography:
label,text,heading,link,code,kbd,blockquote,typography(shadcn variants) -
All components support variants, sizes, and theme customization.
-
Checkbox: Radix Themes API (
size 1..=3, variantssurface|classic|soft,color,high_contrast). -
Dialog: Radix Themes Content API (
size 1..=4, alignstart|center, width/min/max/height,as_child). -
Label: Radix Label API (
as_child,html_for) plus variants/description/required. -
Popover: Radix Popover API (Root state, Popper positioning
side/align/offsets/collision, Portalcontainer,force_mount, DismissableLayer callbacks). -
Tooltip: Radix Tooltip API (Provider delays, Root state, Content positioning/collision, Portal container, dismiss callbacks).
-
Select: Radix Select API (Root state, form props, positioning
position/side/align/offsets/collision, dismiss callbacks, per-itemtext_value). -
Radio Group: Radix Radio Group API (
as_child, controlled/uncontrolled,orientation,dir,loop_focus, per-item flags) plus card/grid variants. -
Tabs: Radix Tabs Root/List/Trigger/Content API (
as_child, controlled/uncontrolled,orientation,dir,activation_mode, listloop, contentforce_mount) plus egui extensions (variants, wrap/justify, scrollable, full_width, accent/high_contrast, compact/animate). -
Switch: Radix Switch Root/Thumb API (
as_child, controlled/uncontrolled,name/value,required) plus egui extensions (size/style/high_contrast/animate/accent/custom radius/thumb color). -
Slider: Radix Themes API (
size 1..=3, variantssurface|classic|soft,color,high_contrast,radius) plus egui extensions (orientation,min_steps_between_thumbs,show_value_tooltip,animate). -
Textarea: Radix Themes API (
size 1..=3, variantssurface|classic|soft,color,radius,resizenone|vertical|horizontal|both) plus egui extensions (rows, character counter, max length, read-only). -
Scroll Area: Radix Scroll Area API (
typedefaulthover,scroll_hide_delaydefault600ms,as_child,dir,force_mountper axis) plus egui extensions (size/radius/accent/high_contrast/colors_override/max_size/bar_visibility). -
Typography: Radix Themes-like API for
Text,Heading,Link,Code,Kbd,Blockquoteplus shadcn-alignedtypographyvariants (H1/H2/H3/H4/P/Lead/Large/Small/Muted/InlineCode/Blockquote).
Theming
Visual states come from Theme::control and Theme::input, backed by ColorPalette:
use egui_shadcn::Theme;
let theme = Theme::default();
// Customize via theme tokens
ColorPalette defaults match shadcn theming variables (OKLCH, Neutral). For other documented base palettes, use ShadcnBaseColor with ColorPalette::shadcn_light(...) / ColorPalette::shadcn_dark(...).
Examples
Run examples to see components in action:
cargo run --example button # Button variants and sizes
cargo run --example collapsible # Collapsible (Radix-like)
cargo run --example input # Text input with config
cargo run --example select # Select dropdown
cargo run --example checkbox # Checkbox with tri-state
cargo run --example switch # Switch component
cargo run --example toggle # Toggle button
cargo run --example slider # Slider component
cargo run --example popover # Popover component
cargo run --example typography # Typography system demo
See examples/ directory for all available examples.
Documentation
See individual component examples in examples/ directory for detailed usage.
Migration notes
TextareaProps/TextareaBuildernow useresize: TextareaResizeinstead ofresizable: bool. Replace direct field access with.resize(TextareaResize::...)(or.resizable(true|false)).
License
MIT
Dependencies
~10MB
~182K SLoC