Design Tokens Reference

A complete reference of all design token categories, their values, and how they map to generated code.

What Are Design Tokens?

Design tokens are the atomic building blocks of a design system. They store visual design decisions — colors, fonts, spacing, etc. — as named, platform-agnostic values. Instead of scattering #2563eb across 47 files, you define it once as--color-primary and reference it everywhere.

YuBild takes this further: you configure tokens visually, and YuBild generates them asCSS variables, Tailwind config values, orlibrary-specific theme objects — all from a single source of truth.

Colors

The most impactful token category. Defines your entire brand palette and how every component looks.

Semantic Color Roles

TokenPurposeUsage Examples
colorPrimaryMain brand colorCTA buttons, active tabs, links, selected states, progress bars
colorSecondarySupporting brand colorSecondary buttons, tags, badges, less prominent actions
colorAccentDecorative emphasisNotification badges, highlights, decorative elements, feature callouts
colorDestructiveDanger / errorDelete buttons, error alerts, validation errors, destructive confirmations
colorBackgroundMain surfacePage background, card surfaces, dialog backgrounds
colorForegroundPrimary textBody text, headings, icon fill on light backgrounds
colorMutedSubtle surfaceSidebar backgrounds, table header rows, disabled surfaces, code block backgrounds
colorBorderDefault borderInput borders, card outlines, dividers, table cell borders
colorRingFocus ringKeyboard focus outlines on buttons, inputs, links (accessibility)

Auto-Generated Color Scales

When you set a base color (e.g., primary = #2563eb), YuBild generates11 shade variants from 50 (lightest) to 950 (darkest):

Generated scale example
/* Primary = #2563eb */
--primary-50:  #eff6ff;   /* Very light blue, backgrounds */
--primary-100: #dbeafe;   /* Light tint, hover states */
--primary-200: #bfdbfe;   /* Lighter shade */
--primary-300: #93c5fd;   /* Medium light */
--primary-400: #60a5fa;   /* Medium */
--primary-500: #3b82f6;   /* Base shade (close to input) */
--primary-600: #2563eb;   /* ← Your base color */
--primary-700: #1d4ed8;   /* Darker, active states */
--primary-800: #1e40af;   /* Dark, text on light */
--primary-900: #1e3a8a;   /* Very dark */
--primary-950: #172554;   /* Darkest, high contrast */

Each shade also gets an accessible contrast color calculated based on luminance. Light shades (50-400) get dark contrast text, dark shades (500-950) get white text. This ensures WCAG AA compliance when using any shade as a background.

Note

The scale generation algorithm uses perceptual color interpolation (HSL blending) to produce visually even steps. It's not just linear lightness changes — the hue and saturation are subtly adjusted at each step for natural-looking palettes.

Typography

Typography tokens control every aspect of text rendering across your design system.

Font Families

TokenApplied ToTypical Choices
fontHeadingh1, h2, h3, h4, h5, h6Cal Sans, Plus Jakarta Sans, Clash Display, Manrope
fontBodyp, span, labels, UI text, buttonsInter, Geist, DM Sans, Nunito Sans, Source Sans 3
fontMonocode, pre, kbd, terminalJetBrains Mono, Fira Code, Source Code Pro, IBM Plex Mono

Font Size Scale

The default type scale follows a modular ratio:

TokenSizeUsage
xs0.75rem (12px)Captions, fine print, badges
sm0.875rem (14px)Secondary text, labels, table cells
base1rem (16px)Body text, paragraphs, buttons
lg1.125rem (18px)Lead paragraphs, card titles
xl1.25rem (20px)Section titles, h5
2xl1.5rem (24px)H4 headings
3xl1.875rem (30px)H3 headings
4xl2.25rem (36px)H2 headings
5xl3rem (48px)H1 headings, hero titles
6xl3.75rem (60px)Display text, landing page heroes

Spacing

Spacing tokens define the rhythm of your layout. YuBild uses a base-unit system where all spacing values are multiples of a base unit:

PresetBase Unitspacing-4spacing-8Best For
Compact3px12px24pxDashboards, data tables, dense UIs
Normal4px16px32pxMost applications (default)
Relaxed5px20px40pxContent sites, blogs, documentation
Spacious6px24px48pxMarketing, editorial, luxury

Shadows

Shadow tokens define elevation levels. Each intensity preset generates 6 shadow values:

LevelUsageApplies To
smMinimal elevationButtons, small elements
DEFAULTStandard elevationCards, panels
mdMedium elevationDropdowns, popovers
lgHigh elevationModal headers, sticky nav
xlVery high elevationModals, dialogs
2xlMaximum elevationFloating action buttons, overlays

Tip

The "None" shadow preset sets all values to none — perfect for modern flat designs. "Subtle" uses soft, barely visible shadows. "Medium" is the standard Material-like elevation. "Strong" creates pronounced, dramatic shadows.

Border Radius

Controls the corner rounding of all components. The base value propagates to derived sizes:

/* Example: border-radius = "lg" (8px) */
--radius-base: 8px;
--radius-sm:   4px;    /* base / 2, min 2px */
--radius-lg:   16px;   /* base * 2 */
--radius-full: 9999px; /* always full circle */

Borders

Configures default border width. The border color comes from your colorBorder token. Width options: thin (1px), normal (1.5px), thick (2px), heavy (3px).

Effects

TokenRangeWhat It Controls
blurIntensitynone (0px) → strong (20px)Backdrop blur on overlays, modals, frosted glass effects
opacityDisabled0–100%How transparent disabled buttons, inputs, and controls appear
opacityHover0–100%Hover overlay opacity on interactive elements
opacityBackdrop0–100%Modal/dialog backdrop overlay darkness

Motion

Animation tokens control the feel of all transitions and animations:

  • Speed: instant (0ms), fast (100ms), normal (200ms), relaxed (300ms), slow (500ms)
  • Easing: ease, ease-in, ease-out, ease-in-out, linear, spring

These apply globally to hover effects, menu animations, accordion transitions, dialog entrances, tooltip appearances, and any other interactive state change.

Note

The "spring" easing option generates a cubic-bezier curve that mimics spring physics:cubic-bezier(0.175, 0.885, 0.32, 1.275). It gives a subtle bounce effect that feels organic.

Focus & Accessibility

Focus tokens ensure keyboard users can see where they are in the interface:

  • Ring Width — Outline thickness: 1px (subtle), 2px (standard), 3px (prominent), 4px (high visibility)
  • Ring Offset — Gap between element edge and ring: 0px (flush), 1px, 2px, 3px, 4px

The ring color comes from your colorRing token. Together, these three values produce the focus outline: outline: [width] solid [color]; outline-offset: [offset];

Warning

Setting focus ring width to 0 makes keyboard navigation invisible. This is a WCAG accessibility violation. Always keep at least 1px for focus ring width. 2px is recommended for most applications.

Z-Index

Z-index tokens prevent the common problem of arbitrary z-index: 9999 values scattered across your codebase. YuBild defines named layers:

LayerFlatNormalElevated
base110100
dropdown550500
sticky101001000
overlay152002000
modal205005000
popover257007000
toast308008000
tooltip50999999999

Flat uses minimal values for simple apps. Normal is the standard for most applications. Elevated provides wide gaps between layers for complex UIs with nested overlays (e.g., a tooltip inside a modal on top of a sidebar).