Skip to content

Design system

Components are functions, variants are enums.

Every element on this page comes from a plain Rust function that takes typed arguments and returns Markup. A variant is a Tone or a ButtonVariant — if you misspell one, the build fails instead of the styling silently disappearing.

Badges

ring-1 ring-insetEach pill is badge(label, Tone::…); the tone maps to a background, a text colour and an inset ring inside the component, so the call site never mentions a colour.

NeutralAccentPositiveWarningDanger
(badge("Positive", Tone::Positive))

Buttons

:focus-visible outlineThree variants share one base class string and differ only in their surface, and all of them get the same keyboard-only focus ring from :focus-visible.

As a link
(button("Primary", ButtonVariant::Primary))

Alerts

grid place-items-centerThe glyph well is a one-line CSS grid centring trick, and the tone enum picks both the glyph and the border/background pair.

Server-rendered

This alert exists because a Rust function returned it — there is no component runtime on the page.

Requires a modern browser

Anchor positioning and scroll-driven animations are progressive; the page stays usable without them.

One rule only

If a feature needs JavaScript, it gets redesigned or dropped.

Cards

shadow + border tokenscard(eyebrow, title, body, footer) takes Option-wrapped slots, so the same function renders a bare card and a card with a footer without a boolean flag in sight.

Typed slots

Optional eyebrow and footer

Passing None simply omits the block — the branch lives inside the component, not in the page.

Composition

Markup children

Bodies are Markup, so a card can hold anything, including other components spliced inline.
Nested

The same card, two containers

@container / container-type: inline-sizeBoth cards below are the identical component; each queries the width of its own container rather than the viewport, so the wide one goes horizontal while the narrow one stacks — at the same viewport size.

Wide container

Aa

Container query

Fraunces & Inter

A display serif for headings against a neutral grotesque for text.

AdaptiveNo JS

Narrow container

Aa

Container query

Fraunces & Inter

A display serif for headings against a neutral grotesque for text.

AdaptiveNo JS

@sm:flex-rowResize the window and watch the left card flip to a row while the right one stays stacked — a media query could not tell them apart.