DocsGitHub
Getting Started
  • Overview
  • Design Tokens
Components
  • Accordion
  • Alert
  • Announcement
  • Avatar
  • Badge
  • BigCalendar
  • Breadcrumb
  • Button
  • ButtonGroup
  • Calendar
  • Card
  • Checkbox
  • Chip
  • CloseButton
  • Combobox
  • CommandPalette
  • ContextMenu
  • Currency
  • DatePicker
  • DescriptionList
  • Drawer
  • DropdownMenu
  • EmptyState
  • Field
  • FileUpload
  • FormGrid
  • Hotkey
  • Icon
  • Input
  • Metric
  • Modal
  • MultiSelect
  • NumberInput
  • Pagination
  • Popover
  • ProgressBar
  • Radio
  • Rating
  • SegmentedControl
  • Select
  • SelectionCard
  • Sidebar
  • Skeleton
  • Slider
  • Spinner
  • Stepper
  • Switch
  • Table
  • Tabs
  • Textarea
  • Timeline
  • TimePicker
  • Toast
  • Tooltip
  • TransferList
  • TreeView
  • Wizard
Charts
  • Overview
  • Area Chart
  • Bar Chart
  • Donut Chart
  • Line Chart
  • Pie Chart
  • Stacked Bar Chart

Design Tokens

Three-layer token architecture: Primitives → Semantics → CSS Variables. All color values are currently in HEX and will be migrated to the OKLCH color space for perceptual uniformity.

OKLCH color gamut visualization showing the perceptually uniform color space used by the design system

Overview

The token system uses a three-layer architecture. Primitivesdefine raw color palettes—22 hue ramps with 9 stops each (100–900), plus alpha and absolute channels. Semantic tokens map primitives to UI roles grouped as surface, content, and border. Components reference semantic tokens, never raw primitives. Light and dark modes use mirrored primitive palettes (100 ↔ 900) so semantic mappings stay identical.

Why OKLCH

OKLCH (Oklab Lightness–Chroma–Hue) is a perceptually uniform color space. Two colors with the same lightness value look equally bright to the human eye, eliminating the uneven contrast jumps common in HSL ramps. Each shade step carries predictable contrast, accessible pairings are easier to verify, and new theme hues can be generated by rotating the hue channel while preserving the same lightness–chroma curve.

All primitives below are currently defined in HEX and will be progressively converted to OKLCH. A HEX fallback will be provided for browsers that don't support oklch():

css
.element {
  /* Fallback for older browsers */
  background: #006AFF;
  /* OKLCH for modern browsers */
  background: oklch(0.55 0.24 264);
}

ThemeProvider

Wrap your application with ThemeProvider to enable theming. It injects all color tokens and static tokens as CSS custom properties.

tsx
import { ThemeProvider } from "madagent";
import "madagent/styles";

function App() {
  return (
    <ThemeProvider theme="blue" mode="light">
      {/* All components have access to theme tokens */}
    </ThemeProvider>
  );
}
PropTypeDefaultDescription
theme
ThemeName
"blue"The color theme to apply. One of: "blue", "red", "orange", "yellow", "green", "teal", "cyan", "sky", "deepblue", "indigo", "violet", "magenta", "fuchia", "blush", "navy", "sienna", "gold", "pink", "charm".
mode
"light""dark"
"light"The color mode.
children*
ReactNode
-Your application content.

The provider renders a div with data-md-theme and data-md-mode attributes, which you can use for mode-specific CSS overrides.

useTheme Hook

Access the current theme and switch themes at runtime:

tsx
import { useTheme, themes } from "madagent";

function ThemeToggle() {
  const { theme, setTheme } = useTheme();
  const isDark = theme.mode === "dark";

  return (
    <button onClick={() =>
      setTheme(isDark ? themes.blue("light") : themes.blue("dark"))
    }>
      Switch to {isDark ? "light" : "dark"} mode
    </button>
  );
}

Primitives

Raw color palettes with 9 stops each (100–900). In light mode, 100 is the lightest and 900 the darkest. In dark mode, the ramp is inverted. Values are currently HEX and will be converted to OKLCH.

Neutral

lightdarktokencss variable

Red

lightdarktokencss variable

Orange

lightdarktokencss variable

Yellow

lightdarktokencss variable

Green

lightdarktokencss variable

Teal

lightdarktokencss variable

Cyan

lightdarktokencss variable

Sky

lightdarktokencss variable

Blue

lightdarktokencss variable

Deep Blue

lightdarktokencss variable

Indigo

lightdarktokencss variable

Violet

lightdarktokencss variable

Magenta

lightdarktokencss variable

Fuchia

lightdarktokencss variable

Blush

lightdarktokencss variable

Navy

lightdarktokencss variable

Sienna

lightdarktokencss variable

Gold

lightdarktokencss variable

Pink

lightdarktokencss variable

Charm

lightdarktokencss variable

Alpha

lightdarktokencss variable

Absolute

lightdarktokencss variable

Semantic Tokens

Semantic tokens map primitives to UI roles. Components consume these instead of referencing primitives directly. Grouped into three categories: surface (backgrounds), content (text/icons), and border (strokes/dividers).

Surface

Colors for backgrounds and fills. Use var(--md-surface-*) in CSS.

lightdarktokencss variable

Content

Colors for text and icons. Use var(--md-content-*) in CSS.

lightdarktokencss variable

Border

Colors for strokes and dividers. Use var(--md-border-*) in CSS.

lightdarktokencss variable

Spacing

Spacing tokens are not theme-dependent. Available as --md-spacing-* CSS custom properties.

TokenCSS VariableValue

Typography

Font Families

TokenCSS VariableValue

Font Sizes

TokenCSS VariableValue

Font Weights

TokenCSS VariableValue

Line Heights

TokenCSS VariableValue

Borders & Radii

Border Widths

TokenCSS VariableValue

Border Radii

TokenCSS VariableValue

Shadows

TokenCSS VariableValue