From 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.
How this skill is triggered — by the user, by Claude, or both
Slash command
/egui-shadcn:egui-shadcnThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Rebuild shadcn-style designs as polished egui GUIs without endless iteration.
references/component-map.mdreferences/gotchas.mdreferences/layout-map.mdreferences/token-map.mdregistry/README.mdregistry/assets/Oxanium-Medium.ttfregistry/assets/Oxanium-OFL.txtregistry/assets/Oxanium-Regular.ttfregistry/assets/Oxanium-SemiBold.ttfregistry/assets/Oxanium-Variable.ttfregistry/src/color.rsregistry/src/components/badge.rsregistry/src/components/button.rsregistry/src/components/card.rsregistry/src/components/checkbox.rsregistry/src/components/input.rsregistry/src/components/label.rsregistry/src/components/mod.rsregistry/src/components/select.rsregistry/src/components/separator.rsRebuild 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.
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:
Vendor-in the registry. Copy registry/src/ and registry/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 eframe on 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) (or light). Read tokens via
Theme::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.
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.
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:
src/components/ (or a helper in src/layout.rs), matching
the existing custom-paint pattern in button.rs.kittest snapshot test plus its committed PNG.skills/egui-shadcn/registry/ — the canonical src/ and
the registry copy must stay byte-identical.references/component-map.md.clippy --all-targets warning-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).
Everything in [dependencies] propagates to every consumer and every vendoring
project. Keep that surface minimal.
egui + egui_extras (StripBuilder) + custom painting, like
every existing one.[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/resvg loaders, wgpu) must not become runtime
deps — they pull in backends/decoders most consumers don't want.[dev-dependencies] (eframe for the example,
egui_kittest + wgpu for snapshots). Those never reach consumers.Cargo.toml.references/gotchas.md)flex-grow distribution across siblings. Use egui_extras::StripBuilder
(Size::relative/exact/remainder) via the layout helpers.available_width() arithmetic when a helper exists.Theme::current(ctx).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.
npx claudepluginhub oetiker/egui-shadcn --plugin egui-shadcnGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.