Design system
The colors, type, space and motion every component is built from.
Color
Every color is a step on a Radix Colors scale. Components ask for a role, never a step, so every role flips with the theme. A role is a family and a slot: accentSolid, accentOnSolid, dangerSubtle.
Surfaces
background
sidebar
raised
well
Text
textPrimary
textSecondary
textMuted
Border
border
borderSubtle
dangerBorder
Fill
Translucent, so they read the same on any surface; fillOpaque hides what's under it.
fillSubtle
fill
fillStrong
fillOpaque
fillOnStrong
Accent
accentSolid
accentOnSolid
Inverted
invertedSolid
invertedOnSolid
invertedFill
Status
dangerText
dangerSubtle
dangerSubtleHover
dangerSolid
successText
successSubtle
successSubtleHover
successSolid
warningText
warningSubtle
warningSubtleHover
warningSolid
infoText
infoSubtle
infoSubtleHover
infoSolid
infoOnSolid
Keep body text neutral on a status tint. The Text color marks the icon or label that carries the meaning.
Typography
Components set size and weight and inherit the font family, which base.css sets on the page from the theme. The theme names Inter for text and Geist Mono for code and figures, in --font-sans and --font-mono; load them, or put yours first. Each size is a step with its own line height of the same name (fontSizes.textSm, lineHeights.textSm), set together; Text, Heading and Caption set them for you.
Font Families
The quick brown fox jumps over the lazy dog
fonts.sansThe quick brown fox jumps over the lazy dog
fonts.monoSizes
Headings rank 1 (largest) to 6; text steps around base, the reading size. Controls use sm.
Heading 1
<Heading size={1}>Heading 2
<Heading size={2}>Heading 3
<Heading size={3}>Heading 4
<Heading size={4}>Heading 5
<Heading size={5}>Heading 6
<Heading size={6}>The quick brown fox jumps over the lazy dog
<Text color="primary" size="lg">The quick brown fox jumps over the lazy dog
<Text color="primary" size="base">The quick brown fox jumps over the lazy dog
<Text color="primary" size="sm">The quick brown fox jumps over the lazy dog
<Caption size="lg">The quick brown fox jumps over the lazy dog
<Caption size="base">The quick brown fox jumps over the lazy dog
<Caption size="sm">The quick brown fox jumps over the lazy dog
<Caption size="xs">Weights
Regular 400
weight="regular"Semimedium 450
weight="semimedium"Medium 500
weight="medium"Semibold 550
weight="semibold"Anything that changes in place (counts, timers, prices, table columns) sets fontVariantNumeric: "tabular-nums", so digits don't shift.
Layout
Space
A 4px grid, with 2px for hairline gaps.
Radius
sm for controls, md for surfaces, full for pills. Nested corners are concentric: md around sm at space.xxs.
Size
Controls take a fixed height, so a button and an input in one row line up.
Shadow
default
lg
xl
Motion
Under media.reducedMotion, fades stay and movement goes: things that travel land at once.
Easing
Each curve over durations.move. Slow it down to see the shape.
cubic-bezier(0.23, 1, 0.32, 1)250ms × 4 = 1000ms
Color changes on hover use the CSS keyword ease. Nothing uses ease-in.
Duration
Interface motion stays under 300ms. A spinner is the exception.
Press
Pressables scale down on :active, on easings.out over durations.press. The smaller the target, the bigger the give.