Tokens
Use @ariaui/tokens for Tailwind CSS variables, semantic color utilities, and local design-system overrides.
Aria UI examples are styled with @ariaui/tokens. The package publishes a generated CSS file for Tailwind CSS v4 and a small TypeScript API for teams that need to inspect or regenerate the token contract.
Use tokens as semantic names in your UI. Prefer bg-background, text-foreground, border-border, bg-primary, and text-primary-foreground over hard-coded colors. Override semantic variables in your app when the product theme changes.
Install the stylesheet
Import Tailwind first, then import the generated tokens file:
@import 'tailwindcss';
@import '@ariaui/tokens/dist/tokens.css';
The stylesheet emits three layers:
:rootcontains light-mode semantic variables and shared values such as radius, typography, opacity, section spacing, and shadow layer colors.darkcontains dark-mode overrides for mode-aware semantic variables@thememaps semantic variables into Tailwind v4 utilities such asbg-background,text-foreground,border-border, andshadow-sm
The docs site imports the same file from the monorepo source so every example uses the package output.
Use semantic utilities
Style component parts with semantic Tailwind classes:
Color tokens are the easiest to use because generateCSS() maps each semantic color to --color-{name} in @theme. That is what enables utilities like bg-card, text-muted-foreground, border-input, and text-icon-tertiary.
Non-color values are available as CSS variables. Use arbitrary values when you need the exact token, such as rounded-[var(--border-radius-md)], max-w-[var(--max-width-3xl)], or py-[var(--section-gap-lg)].
Override existing tokens
Override semantic variables after importing the package stylesheet. Keep the variable names the same so all existing Tailwind utilities continue to work.
Existing utilities now read your values:
<button className="rounded-[var(--border-radius-md)] bg-primary text-primary-foreground hover:bg-primary-hover">
Save changes
</button>
Override semantic tokens such as primary, background, card, border, ring, muted, destructive, success, and warning. Do not override primitive Tailwind color variables like --color-neutral-900 or --color-red-600 as a theming strategy. The tokens package intentionally resolves primitive values into semantic variables so Tailwind's own primitive color scale remains intact.
Customizable token reference
Every token below is emitted as a CSS custom property in :root. Mode-aware values also receive .dark overrides when the token source defines them. Override these variables after importing @ariaui/tokens/dist/tokens.css.
Color and state
Surfaces
--background--foreground--card--card-foreground--popover--popover-foreground--overlay
Interactive surfaces
--primary--primary-hover--primary-foreground--secondary--secondary-hover--secondary-foreground--muted--muted-accent--muted-foreground--accent--accent-hover--accent-foreground
Brand
--brand--brand-hover--brand-foreground
Status: destructive
--destructive--destructive-hover--destructive-foreground
Status: warning
--warning--warning-hover--warning-foreground
Status: success
--success--success-hover--success-foreground
Chart data
--chart-1--chart-2--chart-3--chart-4--chart-5
Borders and input
--border--border-secondary--border-brand--border-destructive--input--ring--ring-error
Icons
--icon--icon-secondary--icon-tertiary--icon-brand--icon-destructive--icon-warning--icon-success--icon-inverse
Text helpers
--placeholder
Sidebar
--sidebar--sidebar-foreground--sidebar-primary--sidebar-primary-foreground--sidebar-accent--sidebar-accent-foreground--sidebar-border--sidebar-ring
Interaction chrome
Focus ring
--focus-ring-color--focus-ring-error-color--ring-width--ring-offset
Shadow layer colors
--shadow-xs-depth-1--shadow-sm-depth-1--shadow-sm-depth-2--shadow-md-depth-1--shadow-md-depth-2--shadow-lg-depth-1--shadow-lg-depth-2--shadow-lg-depth-3--shadow-xl-depth-1--shadow-xl-depth-2--shadow-xl-depth-3--shadow-2xl-depth-1--shadow-2xl-depth-2--shadow-3xl-depth-1--shadow-3xl-depth-2
Layout scale
Container scale
--container-3xs--container-2xs--container-xs--container-sm--container-md--container-lg--container-xl--container-2xl--container-3xl--container-4xl--container-5xl--container-6xl--container-7xl--container-padding-x
Border radius
--border-radius-none--border-radius-xs--border-radius-sm--border-radius-md--border-radius-lg--border-radius-xl--border-radius-2xl--border-radius-3xl--border-radius-4xl--border-radius-full
Border width
--border-width-0--border-width--border-width-2--border-width-4--border-width-8
Opacity
--opacity-0--opacity-5--opacity-10--opacity-15--opacity-20--opacity-25--opacity-30--opacity-35--opacity-40--opacity-45--opacity-50--opacity-55--opacity-60--opacity-65--opacity-70--opacity-75--opacity-80--opacity-85--opacity-90--opacity-95--opacity-100
Max width
--max-width-none--max-width-3xs--max-width-2xs--max-width-xs--max-width-sm--max-width-md--max-width-lg--max-width-xl--max-width-2xl--max-width-3xl--max-width-4xl--max-width-5xl--max-width-6xl--max-width-7xl
Blur
--blur-xs--blur-sm--blur-md--blur-lg--blur-xl--blur-2xl--blur-3xl
Section layout
--section-padding-y--section-gap-xl--section-gap-lg--section-gap-md--section-gap-sm--section-gap-xs--section-gap-2xs
Typography and marks
Font weights
--font-weight-thin--font-weight-extralight--font-weight-light--font-weight-normal--font-weight-medium--font-weight-semibold--font-weight-bold--font-weight-extrabold--font-weight-black
Stroke width
--stroke-width-0--stroke-width-1--stroke-width-2--stroke-width-3--stroke-width-4
Heading styles
--heading-xl-font-family--heading-xl-font-size--heading-xl-line-height--heading-xl-font-weight--heading-xl-letter-spacing--heading-lg-font-family--heading-lg-font-size--heading-lg-line-height--heading-lg-font-weight--heading-lg-letter-spacing--heading-md-font-family--heading-md-font-size--heading-md-line-height--heading-md-font-weight--heading-md-letter-spacing--heading-sm-font-family--heading-sm-font-size--heading-sm-line-height--heading-sm-font-weight--heading-sm-letter-spacing--heading-xs-font-family--heading-xs-font-size--heading-xs-line-height--heading-xs-font-weight--heading-xs-letter-spacing
Paragraph
--paragraph-font-family--paragraph-font-size--paragraph-line-height--paragraph-font-weight--paragraph-letter-spacing
Description
--description-font-family--description-font-size--description-line-height--description-font-weight--description-letter-spacing
Label
--label-font-family--label-font-size--label-line-height--label-font-weight--label-letter-spacing
Add a project token
For project-only tokens, define your own CSS variable and expose it to Tailwind with @theme when you want a utility class.
That creates utilities such as bg-panel-accent and text-panel-accent-foreground. Keep project-only tokens close to the app unless multiple packages need them.
TypeScript API
Use the TypeScript exports when you need to inspect tokens, generate CSS in tooling, or write package-level checks:
The public exports are:
primitives: Tailwind v4 OKLCH color scales stored as bare channel stringsbase:whiteandblackchannelslight: the full semantic token map, including shared non-color valuesdark: dark-mode overrides for mode-aware valuesgenerateCSS(): creates the same CSS shape written todist/tokens.css
Source of truth
Token edits start in packages/tokens:
src/primitives.tsstores primitive OKLCH channel valuessrc/semantic.tsstores semantic tokens, dark-mode overrides, typography, radius, spacing, opacity, shadows, and focus-ring inputssrc/css.tsresolves primitive references, emits:rootand.dark, forwards supported non-color prefixes into@theme, and defines shadow and focus-ring compositesscripts/write-css.tswritesdist/tokens.cssduring the package build
After changing token source, run the package build so the committed CSS artifact matches TypeScript:
pnpm --filter=@ariaui/tokens build