Cookest
UI Components

Design Tokens

Cookest design system tokens — colors, typography, spacing, radius, shadows, transitions, and z-index

Design Tokens

Design tokens are the single source of truth for all visual decisions in CUCL. They are defined in src/tokens/ as TypeScript constants and exposed as CSS custom properties at runtime via @cookest/ui/styles.css.

Importing tokens

import { colors, spacing, typography, effects } from "@cookest/ui/tokens";

Each token file also exports TypeScript types for full type safety:

import type { ColorToken, SpacingToken, FontFamilyToken } from "@cookest/ui/tokens";

Colors

Brand palette anchored on sage green (#7A9A65). All tokens have light and dark variants.

Primary

TokenLightDarkUsage
primary.DEFAULT#7A9A65#8AB575Buttons, active states, focus rings
primary.light#B4CC9E#6B9A55Hover highlights
primary.dark#4E7A3A#A8D490Pressed states

The full primary scale runs from primary.50 (#F0F5EC) to primary.950 (#1A2B14).

Semantic colors

TokenLightDarkCSS variable
background#F5F5F0#0E1512--ck-bg
card#FAFAF6#172019--ck-bg-card
heading#1C3A2A#E0EDE4--ck-heading
text#3D5040#B0C8B5--ck-text
muted#7A8E74#6A8A70--ck-text-muted
border#E4EBE0#253D2E--ck-border
surface#FFFFFF#1A261E--ck-surface

Status colors

TokenHexCSS variableUsage
status.success#4CAF50--ck-successSuccess badges, alerts
status.warning#FF9800--ck-warningWarning badges, alerts
status.error#F44336--ck-errorError messages, danger buttons
status.info#2196F3--ck-infoInformational badges, alerts

Using CSS variables in components

Components reference CSS custom properties — never hard-coded hex values. This means dark mode works automatically when the .dark class is applied to a parent:

// ✅ Correct — uses token
className="text-[var(--ck-heading)]"

// ❌ Wrong — hard-coded colour
className="text-[#1C3A2A]"

Typography

Two typefaces are used throughout the system:

TokenValueUsage
fontFamily.serif'Playfair Display', Georgia, …Headings, titles, display text
fontFamily.sans'Inter', -apple-system, …Body text, labels, UI copy
fontFamily.mono'JetBrains Mono', 'Fira Code', …Code blocks

Rule: Playfair Display is reserved for Modal titles and high-emphasis headings only. All UI elements use Inter.

Type scale

TokenSizeLine heightUsage
fontSize.xs12px16pxCaptions, helper text
fontSize.sm14px20pxLabels, metadata
fontSize.base16px24pxBody text
fontSize.lg18px28pxSub-headings
fontSize.xl20px28pxCard titles
fontSize.2xl24px32pxSection headings
fontSize.3xl30px36pxPage headings
fontSize.4xl36px40pxHero text
fontSize.5xl48px1Display text

Font weights

TokenValue
fontWeight.light300
fontWeight.normal400
fontWeight.medium500
fontWeight.semibold600
fontWeight.bold700

Spacing

Based on a 4px grid with semantic aliases for component padding and margins.

Base scale

TokenValuepx equivalent
spacing[1]0.25rem4px
spacing[2]0.5rem8px
spacing[3]0.75rem12px
spacing[4]1rem16px
spacing[5]1.25rem20px
spacing[6]1.5rem24px
spacing[8]2rem32px
spacing[10]2.5rem40px
spacing[12]3rem48px

Semantic aliases

AliasValuepxTypical use
componentSpacing.xs0.25rem4pxBadge padding
componentSpacing.sm0.5rem8pxCompact inputs, small gaps
componentSpacing.md0.75rem12pxDefault component padding
componentSpacing.lg1rem16pxSpacious padding
componentSpacing.xl1.5rem24pxCard padding, section gaps
componentSpacing["2xl"]2rem32pxLarge section spacing
componentSpacing["3xl"]3rem48pxPage-level spacing

Effects

Border radius

TokenValueUsage
radius.sm4pxSmall chips, tight elements
radius.md8pxInputs, buttons
radius.lg12pxModal footers, inner containers
radius.xl16pxCards, modals
radius["2xl"]24pxFloating panels
radius.full9999pxBadges, avatars, pills

Shadows

TokenValueUsage
shadow.sm0 1px 2px rgba(0,0,0,0.05)Subtle card lift
shadow.md0 4px 6px -1px rgba(0,0,0,0.1)Dropdowns
shadow.lg0 10px 15px -3px rgba(0,0,0,0.1)Modals
shadow.primary0 4px 16px rgba(122,154,101,0.35)Primary buttons
shadow.primaryHover0 8px 28px rgba(122,154,101,0.5)Primary button hover

Transitions

TokenValueUsage
transition.fast150ms easeHover colour changes
transition.normal250ms easeComponent show/hide
transition.slow350ms easePage-level transitions
transition.bounce500ms cubic-bezier(0.34, 1.56, 0.64, 1)Playful micro-interactions

Z-index scale

TokenValueUsage
zIndex.dropdown10Select dropdown panels
zIndex.sticky20Sticky headers
zIndex.overlay30Modal backdrops
zIndex.modal40Modal dialogs
zIndex.popover50Popovers
zIndex.tooltip60Tooltips

CSS custom properties reference

All semantic tokens map to CSS variables applied in :root (light) and .dark:

:root {
  --ck-primary: #7a9a65;
  --ck-primary-light: #b4cc9e;
  --ck-primary-dark: #4e7a3a;
  --ck-bg: #f5f5f0;
  --ck-bg-card: #fafaf6;
  --ck-heading: #1c3a2a;
  --ck-text: #3d5040;
  --ck-text-muted: #7a8e74;
  --ck-border: #e4ebe0;
  --ck-surface: #ffffff;
  --ck-success: #4caf50;
  --ck-warning: #ff9800;
  --ck-error: #f44336;
  --ck-info: #2196f3;
}

Always reference var(--ck-*) custom properties inside component class names rather than importing token constants. Token constants are for TypeScript logic; CSS variables are for styling.

On this page