Skip to content

Customization

Tokens

Every design value in cherry is a CSS custom property named --cherry-*, declared on :root and again on every [data-cherry-mode] and [data-cherry-brand] scope. Components read only these tokens, and your own CSS should too: color tokens switch between light and dark by themselves, and brands override them.

Using tokens

Read them with var() in any CSS:

css
.my-panel {
  padding: var(--cherry-space-4);
  border: 1px solid var(--cherry-border-default);
  border-radius: var(--cherry-radius-lg);
  background: var(--cherry-bg-elevated);
  color: var(--cherry-fg-default);
  box-shadow: var(--cherry-elevation-sm);
  transition: box-shadow var(--cherry-duration-fast) var(--cherry-easing-standard);
}
.my-panel:focus-visible {
  outline: 2px solid transparent; /* stays visible in Windows High Contrast */
  box-shadow: var(--cherry-ring);
}

Layout props on cherry components take the spacing step number instead of a token: gap={4} is --cherry-space-4.

tsx
import { Stack, Grid } from "@cherry-design-system/react";

<Stack gap={4}>...</Stack>
<Grid cols={{ xs: 1, md: 3 }} gap={{ xs: 4, lg: 8 }}>...</Grid>

Token names are also available in TypeScript, as typed lists and unions, from @cherry-design-system/react/tokens:

ts
import {
  colorTokens, // "bg/canvas", "fg/default", ...
  spaceTokens, // "0", "1", "2", ...
  radiusTokens, // "none", "xs", ...
  elevationTokens, // "xs", "sm", ...
  textStyles, // "display", "h1", ...
  type ColorToken,
  type SpaceToken,
} from "@cherry-design-system/react/tokens";

A color token name such as bg/canvas maps to the custom property --cherry-bg-canvas.

Never branch on the mode to pick a color, and never write .dark overrides for a cherry color. Use the semantic token; it already switches. See Dark mode.

Colors

Color tokens have their own page with swatches for every semantic color in light and dark mode and for the full palette: see Colors.

Spacing

A 4px base scale. Layout props (gap, padding) take the step number: gap={4} is --cherry-space-4.

TokenValue
--cherry-space-00px
--cherry-space-14px
--cherry-space-28px
--cherry-space-312px
--cherry-space-416px
--cherry-space-520px
--cherry-space-624px
--cherry-space-832px
--cherry-space-1040px
--cherry-space-1248px
--cherry-space-1664px
--cherry-space-2080px
--cherry-space-2496px
--cherry-space-px2px

Radius

TokenValue
--cherry-radius-none0px
--cherry-radius-xs4px
--cherry-radius-sm6px
--cherry-radius-md8px
--cherry-radius-lg12px
--cherry-radius-xl16px
--cherry-radius-2xl24px
--cherry-radius-full9999px

Elevation and focus

Elevation tokens are complete box-shadow values built from the shadow colors, so they adapt to dark mode. --cherry-ring is the focus ring for most controls; --cherry-ring-inset draws it inward for controls inside a scrolling or clipping container.

TokenValue
--cherry-elevation-xs0 1px 2px var(--cherry-shadow-xs)
--cherry-elevation-sm0 1px 2px var(--cherry-shadow-ambient), 0 2px 4px var(--cherry-shadow-sm), inset 0 1px 0 var(--cherry-shadow-highlight)
--cherry-elevation-md0 1px 3px var(--cherry-shadow-ambient), 0 6px 12px var(--cherry-shadow-md), inset 0 1px 0 var(--cherry-shadow-highlight)
--cherry-elevation-lg0 2px 4px var(--cherry-shadow-ambient), 0 12px 24px var(--cherry-shadow-lg), inset 0 1px 0 var(--cherry-shadow-highlight)
--cherry-elevation-xl0 4px 8px var(--cherry-shadow-ambient), 0 24px 48px var(--cherry-shadow-xl), inset 0 1px 0 var(--cherry-shadow-highlight)
--cherry-ring0 0 0 3px var(--cherry-focus-ring)
--cherry-ring-danger0 0 0 3px var(--cherry-accent-ring)
--cherry-ring-insetinset 0 0 0 1px var(--cherry-border-focus), inset 0 0 0 4px var(--cherry-focus-ring)

Motion

Every cherry transition uses these. Under prefers-reduced-motion: reduce the durations drop to 1ms, so transitions you build with them shorten too.

TokenValue
--cherry-duration-instant100ms
--cherry-duration-fast200ms
--cherry-duration-base300ms
--cherry-duration-slow400ms
--cherry-duration-emphasis450ms
--cherry-easing-standardcubic-bezier(0.4, 0, 0.2, 1)
--cherry-easing-outcubic-bezier(0.2, 0.8, 0.2, 1)
--cherry-easing-springcubic-bezier(0.21, 1.02, 0.73, 1)
--cherry-easing-popcubic-bezier(0.34, 1.56, 0.64, 1)

How cherry uses them:

UseDurationEasing
Hover, color, border, focus ring--cherry-duration-fast--cherry-easing-standard
Press feedback--cherry-duration-instant--cherry-easing-standard
Toggles, sliding indicators, thumbs, tab underline--cherry-duration-base--cherry-easing-spring
Overlays in (popover, menu, tooltip, dialog, sheet)--cherry-duration-fast or --cherry-duration-base--cherry-easing-out
Overlays out--cherry-duration-fast--cherry-easing-standard
Large layout moves--cherry-duration-slow--cherry-easing-spring
Icon pops, emphasis--cherry-duration-emphasis--cherry-easing-pop

Layout

Breakpoints, container widths, gutters and page padding. The breakpoint names match the keys of responsive props ({ xs, sm, md, lg, xl, xxl, xxxl }).

TokenValue
--cherry-breakpoint-xs0px
--cherry-breakpoint-sm576px
--cherry-breakpoint-md768px
--cherry-breakpoint-lg992px
--cherry-breakpoint-xl1200px
--cherry-breakpoint-xxl1440px
--cherry-breakpoint-xxxl1920px
--cherry-container-max1280px
--cherry-container-max-xxxl1440px
--cherry-gutter-mobile20px
--cherry-gutter-desktop40px
--cherry-padding-mobile20px
--cherry-padding-desktop40px

CSS does not allow custom properties inside @media conditions, so write the pixel value in your own media queries: @media (min-width: 992px) for lg.

Typography

Each text style is a set of five tokens: --cherry-text-<style>-size, -line-height, -weight, -tracking and -family. The families come from --cherry-font-sans (Geist) and --cherry-font-mono (Geist Mono). cherry does not load the font files; see Installation.

css
.plan-card__price {
  font-family: var(--cherry-text-h3-family);
  font-size: var(--cherry-text-h3-size);
  line-height: var(--cherry-text-h3-line-height);
  font-weight: var(--cherry-text-h3-weight);
  letter-spacing: var(--cherry-text-h3-tracking);
}
StyleSizeLine heightWeightTrackingFamily
display3.5rem1.0714600-0.03emsans
h12.5rem1.1600-0.025emsans
h22rem1.1875600-0.02emsans
h31.5rem1.25600-0.015emsans
h41.25rem1.4600-0.01emsans
h51rem1.5600-0.005emsans
body-lg1.125rem1.5556400-0.005emsans
body-md0.9375rem1.6400-0.003emsans
body-sm0.875rem1.4286400-0.002emsans
body-xs0.75rem1.33334000emsans
label-lg0.9375rem1.3333500-0.003emsans
label-md0.875rem1.4286500-0.002emsans
label-sm0.8125rem1.3846500-0.001emsans
label-xs0.75rem1.33335000emsans
eyebrow0.75rem1.33335000.04emsans
mono-md0.875rem1.42864000emmono
mono-sm0.8125rem1.53854000emmono
mono-xs0.75rem1.33334000emmono
TokenValue
--cherry-font-sansGeist, ui-sans-serif, system-ui, sans-serif
--cherry-font-mono"Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace