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:

  • :root contains light-mode semantic variables and shared values such as radius, typography, opacity, section spacing, and shadow layer colors
  • .dark contains dark-mode overrides for mode-aware semantic variables
  • @theme maps semantic variables into Tailwind v4 utilities such as bg-background, text-foreground, border-border, and shadow-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.

211
CSS variables
26
Organized groups
:root
Override scope

Color and state

Mode-aware surface, text, icon, border, status, chart, and navigation variables.
11 groups / 60 tokens

Surfaces

Page, card, popover, overlay, and foreground foundations.
7
  • --background
  • --foreground
  • --card
  • --card-foreground
  • --popover
  • --popover-foreground
  • --overlay

Interactive surfaces

Primary, secondary, muted, and accent UI states.
12
  • --primary
  • --primary-hover
  • --primary-foreground
  • --secondary
  • --secondary-hover
  • --secondary-foreground
  • --muted
  • --muted-accent
  • --muted-foreground
  • --accent
  • --accent-hover
  • --accent-foreground

Brand

Brand fills and readable foreground values.
3
  • --brand
  • --brand-hover
  • --brand-foreground

Status: destructive

Destructive action fills and foreground values.
3
  • --destructive
  • --destructive-hover
  • --destructive-foreground

Status: warning

Warning action fills and foreground values.
3
  • --warning
  • --warning-hover
  • --warning-foreground

Status: success

Success action fills and foreground values.
3
  • --success
  • --success-hover
  • --success-foreground

Chart data

Default qualitative color slots for data visualization.
5
  • --chart-1
  • --chart-2
  • --chart-3
  • --chart-4
  • --chart-5

Borders and input

Field outlines, dividers, branded borders, and selection rings.
7
  • --border
  • --border-secondary
  • --border-brand
  • --border-destructive
  • --input
  • --ring
  • --ring-error

Icons

Foreground semantics for default, muted, status, and inverse icons.
8
  • --icon
  • --icon-secondary
  • --icon-tertiary
  • --icon-brand
  • --icon-destructive
  • --icon-warning
  • --icon-success
  • --icon-inverse

Text helpers

Supporting text color for placeholders.
1
  • --placeholder

Sidebar

Dedicated navigation shell, active item, accent, border, and ring values.
8
  • --sidebar
  • --sidebar-foreground
  • --sidebar-primary
  • --sidebar-primary-foreground
  • --sidebar-accent
  • --sidebar-accent-foreground
  • --sidebar-border
  • --sidebar-ring

Interaction chrome

Focus-ring parts and shadow layer colors that shape elevation and keyboard visibility.
2 groups / 19 tokens

Focus ring

Ring colors, width, and offset used by focus-ring composites.
4
  • --focus-ring-color
  • --focus-ring-error-color
  • --ring-width
  • --ring-offset

Shadow layer colors

Per-depth shadow colors consumed by the generated shadow scale.
15
  • --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, radius, border, opacity, sizing, blur, and section rhythm variables.
7 groups / 78 tokens

Container scale

Constrained layout widths and page padding.
14
  • --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

Corner radius scale from sharp edges to full pills.
10
  • --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 thickness values forwarded into Tailwind theme variables.
5
  • --border-width-0
  • --border-width
  • --border-width-2
  • --border-width-4
  • --border-width-8

Opacity

Percentage values for Tailwind color opacity modifiers.
21
  • --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

Content measure utilities for narrow through wide layouts.
14
  • --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

Backdrop and filter blur scale.
7
  • --blur-xs
  • --blur-sm
  • --blur-md
  • --blur-lg
  • --blur-xl
  • --blur-2xl
  • --blur-3xl

Section layout

Vertical section padding and spacing rhythm.
7
  • --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 weight, SVG stroke, and text style variables used by headings and copy.
6 groups / 54 tokens

Font weights

Numeric weight scale for type utilities.
9
  • --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

SVG stroke width scale.
5
  • --stroke-width-0
  • --stroke-width-1
  • --stroke-width-2
  • --stroke-width-3
  • --stroke-width-4

Heading styles

Font family, size, line height, weight, and tracking for headings.
25
  • --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

Base body copy family, size, line height, weight, and tracking.
5
  • --paragraph-font-family
  • --paragraph-font-size
  • --paragraph-line-height
  • --paragraph-font-weight
  • --paragraph-letter-spacing

Description

Lead text family, size, line height, weight, and tracking.
5
  • --description-font-family
  • --description-font-size
  • --description-line-height
  • --description-font-weight
  • --description-letter-spacing

Label

Caption and tag label family, size, line height, weight, and tracking.
5
  • --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 strings
  • base: white and black channels
  • light: the full semantic token map, including shared non-color values
  • dark: dark-mode overrides for mode-aware values
  • generateCSS(): creates the same CSS shape written to dist/tokens.css

Source of truth

Token edits start in packages/tokens:

  • src/primitives.ts stores primitive OKLCH channel values
  • src/semantic.ts stores semantic tokens, dark-mode overrides, typography, radius, spacing, opacity, shadows, and focus-ring inputs
  • src/css.ts resolves primitive references, emits :root and .dark, forwards supported non-color prefixes into @theme, and defines shadow and focus-ring composites
  • scripts/write-css.ts writes dist/tokens.css during the package build

After changing token source, run the package build so the committed CSS artifact matches TypeScript:

pnpm --filter=@ariaui/tokens build
Previous
Accessibility
Next
CLI