Official Design System
The @tokenami/ds package is Tokenami’s official design system, providing a production-ready foundation for your projects.Features
The official design system includes:- Global reset based on Preflight from Tailwind
- Radix UI colours with automatic dark mode
- Fluid spacing and font sizes for responsive design
- Right-to-left support built in (
padding-leftbecomespadding-inline-startetc.) - Short aliases for common properties (e.g.
--pfor padding)
Installation
Install the package using your package manager:Setup
Include the design system config in your.tokenami/tokenami.config.js file:
Theme Selector
Use adata-theme attribute to apply the appropriate light or dark theme:
light theme applied to the :root selector.
Grid System
Spacing is based on a 4px grid usingrem units (calculated from a 16px base font size).
Using numeric values for grid properties like padding and margin will apply multiples of this grid:
Fluid Spacing
Create responsive designs without micromanaging breakpoints using fluid spacing tokens. The Utopia guide is a great resource for understanding these concepts. Use the--fluid-<property-type>-clamp_<breakpoint-range> toggle token:
Adjusting Breakpoint Ranges
Customize the breakpoints for fluid spacing:min-max, sm-md, sm-lg, sm-xl, md-lg, md-xl, md-2xl, lg-xl, lg-2xl
Fluid Font Sizes
Fluid font sizes work similarly, accepting fluid tokens:Radix UI Colours
The design system uses Radix UI P3 colours with fallbacks for browsers that don’t support P3 colours.Understanding the Scale
A powerful feature of Radix colours is automatic dark mode by applying the appropriate steps in the scale. Learn more about using the Radix palette.Colour Space
Change the colour space using the--color-space property (defaults to srgb):
srgb, oklch, oklab
Gradients
Use gradient tokens with custom properties:to-t, to-tr, to-r, to-br, to-b, to-bl, to-l, to-tl
Gradients respect the --color-space property.
Opacity, Tint, and Shade
Apply opacity, tint, or shade to colours using mix tokens:--mix-<property-type>_opacity- Mix with transparent--mix-<property-type>_tint- Mix with white--mix-<property-type>_shade- Mix with black
Right-to-Left Support
The design system includes RTL support out of the box. Directional properties automatically use logical properties:padding-left→padding-inline-startpadding-right→padding-inline-endmargin-left→margin-inline-startmargin-right→margin-inline-end
Built-in Animations
The design system includes several useful keyframe animations:Property Aliases
The design system includes convenient shorthand aliases:--pforpadding--pxforpadding-inline(left/right)--pyforpadding-block(top/bottom)--mformargin--mxformargin-inline--myformargin-block
Next Steps
Building Your Own
Create and publish a custom design system
Global Styles
Learn about configuring global styles