Tokens

Via Box

Box is the preferred approach. Pass token names directly as props. Box translates them to atomic CSS classes without any manual .css.ts authoring.

Token names map directly to atomic CSS classes.
<Box
padding="large"
background="neutralLight"
borderRadius="md">
<Text>Token names map directly to atomic CSS classes.</Text>
</Box>

Under the hood

Tokens are plain TypeScript constants consumed by .css.ts files at build time. Vanilla Extract compiles them to static CSS, so the browser receives an ordinary stylesheet and no JavaScript.

Styled by the card class below.
export const card = style({
padding: space.large,
borderRadius: radius.md,
background: vars.backgroundColor.neutralLight,
});

Compiled output

Token values are inlined at build time. Theme colors stay CSS variables, so themes switch at runtime without a rebuild.

.card_1skp7a2o {
padding: 1.25rem;
border-radius: 0.375rem;
background: var(--backgroundColor-neutralLight__1hqmkoh);
}

Type safety

Token names are typed as string literal unions. Passing an invalid value is a TypeScript error caught before the browser sees it.

applyPadding('giant'); // Argument of type '"giant"' is not assignable to type 'Space'
applyPadding('large');

Foreground colors

Semantic text colors from the theme contract, applied with the tone prop on Text. Values follow the active theme.

neutral
Aa
neutralInverted
Aa
secondary
Aa
link
Aa
brand
Aa
critical
Aa
caution
Aa
positive
Aa
info
Aa
promote
Aa
white
Aa
black
Aa

Background colors

Semantic surface colors from the theme contract, applied with the background prop on Box. Interactive tokens include Hover and Active variants.

body
surface
neutral
neutralLight
neutralSoft
brand
brandAccent
critical
criticalLight
criticalLightHover
criticalLightActive
caution
cautionLight
cautionLightHover
cautionLightActive
positive
positiveLight
positiveLightHover
positiveLightActive
info
infoLight
infoLightHover
infoLightActive
promote
promoteLight
promoteLightHover
promoteLightActive
neutralLightHover
neutralLightActive
white
black
transparent
mastodon
bluesky
twitter
discord
linkedin

Border colors

Semantic border colors from the theme contract.

neutral
neutralLight
brand
critical
caution
positive
info
promote
focus

Focus ring

Focus outline thickness from the theme contract, drawn with the focus border color.

focusRingSize

Space

Padding, margin, and gap values in rem, relative to a 16px base.

none
0
0px
micro
0.125rem
2px
xxx-small
0.25rem
4px
xx-small
0.375rem
6px
x-small
0.5rem
8px
small
0.75rem
12px
medium
0.875rem
14px
moderate
1rem
16px
large
1.25rem
20px
x-large
1.5rem
24px
xx-large
2rem
32px
xxx-large
2.5rem
40px
spacious
3rem
48px
x-spacious
3.5rem
56px
xx-spacious
4rem
64px
xxx-spacious
5rem
80px
expansive
6rem
96px

Border radius

Corner rounding. The full token creates pills and circles.

none
0
0px
sm
0.125rem
2px
md
0.375rem
6px
lg
0.5rem
8px
full
9999px

Font size

Raw size scale consumed by typography styles. Use Text or Heading rather than these tokens directly.

xs
0.75rem
12px
Aa
sm
0.875rem
14px
Aa
base
1rem
16px
Aa
lg
1.125rem
18px
Aa
xl
1.25rem
20px
Aa
2xl
1.5rem
24px
Aa
3xl
1.875rem
30px
Aa
4xl
2.25rem
36px
Aa

Font weight

Available through the weight prop on Text.

normal
400
Aa Bb Cc
medium
500
Aa Bb Cc
semibold
600
Aa Bb Cc
bold
700
Aa Bb Cc

Font family

Sans for interface text, mono for code.

sans
The quick brown fox jumps over the lazy dog"Inter", ui-sans-serif, system-ui, sans-serif
mono
The quick brown fox jumps over the lazy dogui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace

Letter spacing

Available through the letterSpacing prop on Text. Widest suits uppercase labels.

slight
-0.020em
HANDGLOVES
widest
0.1em
HANDGLOVES

Content width

Widths for constraining containers. A separate scale from space.

sidebar
220px
xsmall
400px
small
660px
medium
900px
large
1280px

Breakpoints

Minimum widths used by responsive props. Mobile is the unprefixed default.

tablet
768px
desktop
1024px
wide
1280px

Media queries

Query strings derived from the breakpoints, consumed by .css.ts files.

tablet
screen and (min-width: 768px)
desktop
screen and (min-width: 1024px)
wide
screen and (min-width: 1280px)

Border width

Used for borders and for boxShadow borders that avoid layout shift.

standard
1px
large
2px

Touch target

Minimum touch target size per WCAG 2.5.5 and the Apple Human Interface Guidelines.

touchableSize
44px