Egui shadcn
Use when building or restyling a Rust egui GUI from a shadcn/web design (screenshot, component code, or description). Vendors a tested shadcn-v4 component module into the project and maps the design onto it, layout-first. Backend-agnostic — works with eframe, egui-winit, or any egui integration.From its SKILL.md
npx -y skills add oetiker/egui-shadcn --skill egui-shadcnAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 7 stars7 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
6.2 KB, as published. Nobody here has run it
egui-shadcn
Rebuild shadcn-style designs as polished egui GUIs without endless iteration. The hard part of egui is not styling — it is layout (single-pass, no flexbox). This skill carries a tested component module and a layout-first workflow.
The components are plain egui widgets: they only touch egui::Context/Ui
and depend on nothing beyond egui + egui_extras (StripBuilder). They drop into
any backend — eframe, egui-winit + a custom rasterizer (softbuffer), glow, wgpu.
There is no eframe or wgpu coupling in what you ship.
When to use
A shadcn (or generally web/Tailwind) design needs to become an egui UI: a screenshot to recreate, shadcn component code to port, or a described screen that must look professional.
This skill covers two distinct activities — keep them separate:
- Part A — Using the components to build a screen (the common case).
- Part B — Porting a new component into the library (when a needed widget isn't in the registry yet).
Part A — Using the components
-
Vendor-in the registry. Copy
registry/src/andregistry/assets/from this skill into the target project (as a module or sub-crate). Idempotent — skip files that already exist and match. -
Add the (minimal) deps. Only two are required, and both are intentionally small because they propagate to your whole project:
egui = "0.34"egui_extras = { version = "0.34", default-features = false }(StripBuilder/Size only — no image/svg/http loaders)
Do not add
eframeon the registry's account. Add eframe only if your app already uses it as its backend. The components work with whatever egui integration you already have (eframe, egui-winit + softbuffer, etc.). -
Apply the theme once per frame at the top of your update/draw:
egui_shadcn::Theme::dark().apply(ctx)(orlight). Read tokens viaTheme::current(ctx). -
Decompose the design top-down: app shell → panels (
SidePanel/TopBottomPanel/CentralPanel); each region's layout intent (stack? row? grid? space-between?); components + their cva variants; token deviations (usually none). -
Map using the reference tables:
references/layout-map.md— flexbox/Grid intent → egui helper (read this first; layout is where iteration is lost).references/component-map.md— shadcn component/variant → module widget.references/token-map.md— shadcn token → egui field.
-
Build from the vendored components. Drop to raw egui only when no helper fits — and then prefer adding a helper (see Part B) over inlining.
Verify visually
The web-like feedback loop is: render to a PNG and look at it against the
design, then iterate on the numbers. The reference loop is an egui_kittest
snapshot test (features ["wgpu","snapshot"]); generate with
UPDATE_SNAPSHOTS=1 cargo test.
This harness is optional and dev-only — it is how this crate verifies
itself, and the best loop if you can run it. It pulls egui_kittest + wgpu as
[dev-dependencies], which never reach a shipped binary. If your project has
its own render/screenshot path (e.g. a softbuffer rasterizer), use that to capture
the PNG instead — the point is "look at a real render," not this specific harness.
Part B — Porting a new component into the library
When you port a component or layout helper that isn't in the registry yet, do it to the library's standard so the next project gets it for free.
A complete contribution adds:
- The new file under
src/components/(or a helper insrc/layout.rs), matching the existing custom-paint pattern inbutton.rs. - A
kittestsnapshot test plus its committed PNG. - A synced copy under
skills/egui-shadcn/registry/— the canonicalsrc/and the registry copy must stay byte-identical. - A row in
references/component-map.md. - Build +
clippy --all-targetswarning-clean.
Then offer to open a PR to github.com/oetiker/egui-shadcn (a nudge, not an
automatic pipeline — it needs the user's go-ahead and push/fork access).
Dependency discipline (important)
Everything in [dependencies] propagates to every consumer and every vendoring
project. Keep that surface minimal.
- Default: add no new runtime dependency. A ported component should be
expressible with
egui+egui_extras(StripBuilder) + custom painting, like every existing one. - A new
[dependencies]entry needs a strong, stated reason — a capability that genuinely cannot be painted or computed in-crate, worth the build cost and version-coupling imposed on all consumers. Prefer a tiny focused crate over a large one; prefer an optional, feature-gated dep over an always-on one. Heavy crates (eframe,image/resvgloaders,wgpu) must not become runtime deps — they pull in backends/decoders most consumers don't want. - Tooling stays in
[dev-dependencies](eframefor the example,egui_kittest+wgpufor snapshots). Those never reach consumers. - When in doubt, ask the user before adding a dependency, and document the
reason next to it in
Cargo.toml.
Hard rules (see references/gotchas.md)
- egui is single-pass: a widget sets its own size before placement; there is no
flex-growdistribution across siblings. Useegui_extras::StripBuilder(Size::relative/exact/remainder) via thelayouthelpers. - Don't fight it with
available_width()arithmetic when a helper exists. - Hover/active = opacity modulation of the base color, never a new hue.
- Apply the theme every frame; read tokens via
Theme::current(ctx).
Acceptance bar
The reference egui_shadcn::reference::settings_ui (a settings screen whose tabs
double as a component gallery) is the quality yardstick: match its restraint —
subtle 1px borders, one radius, muted palette, 14px text, consistent focus rings.
Run cargo run --example settings to see it live.