egui-shadcn
[!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:
[]
= "0.3.1"
= "0.33"
Or from git:
[]
= { = "https://github.com/FerrisMind/shadcn-rs", = "egui-shadcn" }
Or from crates.io:
Quick Start
use ;
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 Theme;
let 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:
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