Skip to content
Browse documentation
whisk/ui

Design tokens

Define and use atomic visual decisions such as colors, spacing, fonts, radii, shadows, and breakpoints.

What is a token?

A design token is a named visual decision. It gives a value a stable home so components can consume the decision without knowing the raw CSS value.

tsx
const theme = defineTheme({
  tokens: {
    colors: { brand: { value: "#7c5cff" } },
    spacing: { page: { value: "1.5rem" } },
  },
});

Token families

Whisk/UI themes can describe colors, spacing, sizing, fonts, font sizes, weights, line heights, radii, borders, shadows, z-index, breakpoints, and motion.

PropTypeDefaultDescription
colorsColorTokensemantic and primitive colorsForegrounds, surfaces, borders, accents, and statuses.
spacing / sizesSpacingTokenshared scaleLayout rhythm and predictable dimensions.
fonts / fontSizes / fontWeightsTypographyTokentheme typographyThe type system used by Text and Heading.
radii / shadows / zIndexSurfaceTokentheme scaleBoundaries, elevation, and layer order.

Token references

When a composite value needs a token, reference the complete token path instead of copying the raw value into a component or recipe.

tsx
const card = {
  border: "sm",
  borderColor: "borderSubtle",
  padding: 6,
  rounded: "lg",
};

Use tokens

Token-based UI

<Box background="surface1" padding={6} rounded="lg">
  <Text color="text">Token-based UI</Text>
</Box>