This page ships a Markdown twin for AI tools.

Design tokens

Every size, space, radius, shadow, layer and type role a Texuli component paints is a --tx-* custom property. Set them on a scope and the components follow, with no CSS of your own.

System tokens
159 in 11 families: 123 declared once in @texuli/tokens/base.css, 36 data-viz tokens emitted per theme
Component tokens
365 for 57 components, never declared
Defaults
45 components take a default variant or size
Decision
ADR-020; additive: nothing existing is renamed

The scope model

  • A token scope is any element matching :where(:root, [data-tx-theme], [data-tx-scope]): the document root, an element with a theme, or an element marked data-tx-scope. base.css declares every system default on each scope, inside @layer tx.base with zero specificity, so derived values (space steps, radius steps, type roles) resolve against the nearest theme and its density.
  • One fallback level. A system token is read plain (var(--tx-space-4)). A component token carries exactly one fallback, its registry default: var(--tx-button-radius, var(--tx-shape-radius-lg)).
  • Component tokens are undeclared until a theme, design system or host sets one on its scope, so they cost no bytes on a page that does not use them.
  • Set tokens on a scope, never globally, so two design systems can share a page.
[data-tx-scope="acme"] {
  --tx-button-radius: 9999px;
  --tx-card-padding-inline: 1.5rem;
  --tx-dialog-z-index: 80;
}

How design systems and agents drive them

ChannelReachesSet with
Component tokensSizes, spaces, radii, borders, shadows, layers and type of each componentCustom properties on a scope (--tx-button-radius)
System tokensEvery component at once: the space scale, control sizes, radii, elevation, type rolesCustom properties on a scope (--tx-space-unit, --tx-shape-radius-lg)
HooksA closed look per component (pill buttons, glass cards)data-tx-*-style attributes on any ancestor
DefaultsThe default variant and size propssetDesignDefaults from texuli/defaults

Agents work from the same closed vocabulary. getComponentTokensJsonSchema() from @texuli/tokens/components is a JSON Schema of every component and key, so a token set an agent writes can be validated before it reaches a page, and validateDesignDefaults drops and reports any default outside the vocabulary. The Texuli MCP serves the themes those tokens sit on. A design-system document that sets all of this from one JSON file is planned.

Hooks

AttributeValuesSets
data-tx-button-stylesquare, default, pill--tx-button-radius
data-tx-card-stylesolid, bordered, glass--tx-card-elevation and --tx-card-background
data-tx-input-stylecompact, default, comfortable--tx-input-height and --tx-input-padding-inline
data-tx-focus-ring-stylering, outline, glow, inset--tx-focus-ring-offset on the focused element

setDesignDefaults

CSS cannot choose a default variant or size, so texuli/defaults carries them in a Svelte context. A component uses its design default only when its own prop is undefined; nested providers merge, the inner one winning per component and prop. Pass a function to keep the defaults reactive.

<script lang="ts">
  import { setDesignDefaults } from 'texuli/defaults';

  setDesignDefaults({ button: { variant: 'outline', size: 'sm' }, card: { variant: 'flat' } });
</script>
The defaults vocabulary
Componentvariantsize
accordiondefault, bordered—
avatar—xs, sm, md, lg
badgedefault, secondary, outline, success, warning, destructive, info, neutral—
breadcrumb—sm, md, lg
buttondefault, secondary, outline, ghost, destructive, linksm, md, lg, icon
cardelevated, flat—
chipdefault, secondary, outline, success, warning, destructive, info, neutral—
choice—sm, md
codeinline, block—
comboboxoutline, softsm, md, lg
commandoutline, softsm, md, lg
copy-button—sm, md
date—sm, md
dialog—sm, md, lg, xl
empty—sm, md
file-uploaddefault, compact—
icon—xs, sm, md, lg
icon-buttondefault, secondary, outline, ghost, destructive, linksm, md, lg, icon
label—sm, md
menudefault, softsm, md, lg
navigation—sm, md, lg
number-field—sm, md, lg
paginationoutline, softsm, md, lg
pin-input—sm, md, lg
popoverelevated, flatsm, md, lg
progress—sm, md, lg
radio-groupdefault, cardsm, md
rating—sm, md, lg
resizableplain, bordered—
resizable-handle—sm, md
scroll-area—sm, md, lg
selectoutline, softsm, md, lg
separatordefault, subtle, strong—
sheet—sm, md, lg, xl
sidebardefault, inset—
skeleton—sm, md, lg
slider—sm, md, lg
spinner—sm, md, lg
statelevated, flat—
tabsline, pills, enclosed—
tagdefault, secondary, outline, success, warning, destructive, info, neutral—
toggledefault, outlinesm, md, lg
toggle-groupdefault, outlinesm, md, lg
toolbardefault, outline, ghostsm, md
treedefault, bordered—

More on tokens, hooks and defaults together: the design-system guide.

System families

Each family with its tokens and the default base.css declares. Data-viz is the exception: each theme emits it, and the column names the theme source.

Space (14)

The 0.25rem spacing scale, scaled by --tx-density.

TokenDefaultMeaning
--tx-space-unitcalc(0.25rem * var(--tx-density, 1))The 0.25rem step, scaled by the theme density.
--tx-space-00pxNo space.
--tx-space-1calc(var(--tx-space-unit) * 1)0.25rem at density 1.
--tx-space-2calc(var(--tx-space-unit) * 2)0.5rem at density 1.
--tx-space-3calc(var(--tx-space-unit) * 3)0.75rem at density 1.
--tx-space-4calc(var(--tx-space-unit) * 4)1rem at density 1.
--tx-space-5calc(var(--tx-space-unit) * 5)1.25rem at density 1.
--tx-space-6calc(var(--tx-space-unit) * 6)1.5rem at density 1.
--tx-space-7calc(var(--tx-space-unit) * 7)1.75rem at density 1.
--tx-space-8calc(var(--tx-space-unit) * 8)2rem at density 1.
--tx-space-9calc(var(--tx-space-unit) * 9)2.25rem at density 1.
--tx-space-10calc(var(--tx-space-unit) * 10)2.5rem at density 1.
--tx-space-11calc(var(--tx-space-unit) * 11)2.75rem at density 1.
--tx-space-12calc(var(--tx-space-unit) * 12)3rem at density 1.

Size (10)

Control heights, icon sizes and interactive targets.

TokenDefaultMeaning
--tx-size-control-xs1.75remCompact control height (toolbar small buttons).
--tx-size-control-sm2remSmall control height (button, select, toggle sm).
--tx-size-control-md2.25remDefault control height (button, input, select md).
--tx-size-control-lg2.75remLarge control height (button, select, toggle lg).
--tx-size-icon-xs0.75remExtra small icon (12 px, Icon size xs).
--tx-size-icon-sm1remSmall icon (16 px, Icon size sm, icons inside buttons).
--tx-size-icon-md1.25remDefault icon (20 px, Icon size md, alert and toast icons).
--tx-size-icon-lg1.5remLarge icon (24 px, Icon size lg).
--tx-size-target-min24pxThe smallest interactive target anywhere (WCAG 2.2).
--tx-size-target-touchmax(2.75rem, 44px)The interactive target below 640 px (button sm, md and icon on small screens).

Type roles (35)

Family, size, line height, weight and tracking per role, mapped from the theme type scale.

TokenDefaultMeaning
--tx-type-display-familyvar(--tx-font-heading, var(--tx-font-sans, system-ui, sans-serif))Hero and display text. Font family.
--tx-type-display-sizevar(--tx-font-size-4xl, 2.25rem)Hero and display text. Font size.
--tx-type-display-line1.1Hero and display text. Line height.
--tx-type-display-weightvar(--tx-font-weight-bold, 700)Hero and display text. Font weight.
--tx-type-display-trackingvar(--tx-letter-spacing-heading, 0)Hero and display text. Letter spacing.
--tx-type-title-familyvar(--tx-font-heading, var(--tx-font-sans, system-ui, sans-serif))Page titles and KPI values. Font family.
--tx-type-title-sizevar(--tx-font-size-2xl, 1.5rem)Page titles and KPI values. Font size.
--tx-type-title-line1.2Page titles and KPI values. Line height.
--tx-type-title-weightvar(--tx-font-weight-heading, 600)Page titles and KPI values. Font weight.
--tx-type-title-trackingvar(--tx-letter-spacing-heading, 0)Page titles and KPI values. Letter spacing.
--tx-type-heading-familyvar(--tx-font-heading, var(--tx-font-sans, system-ui, sans-serif))Dialog, sheet and section headings. Font family.
--tx-type-heading-sizevar(--tx-font-size-lg, 1.125rem)Dialog, sheet and section headings. Font size.
--tx-type-heading-line1.3Dialog, sheet and section headings. Line height.
--tx-type-heading-weightvar(--tx-font-weight-heading, 600)Dialog, sheet and section headings. Font weight.
--tx-type-heading-trackingvar(--tx-letter-spacing-heading, 0)Dialog, sheet and section headings. Letter spacing.
--tx-type-body-familyvar(--tx-font-sans, system-ui, sans-serif)Running text. Font family.
--tx-type-body-sizevar(--tx-font-size-base, 1rem)Running text. Font size.
--tx-type-body-line1.5Running text. Line height.
--tx-type-body-weightvar(--tx-font-weight-body, 400)Running text. Font weight.
--tx-type-body-trackingvar(--tx-letter-spacing-body, 0)Running text. Letter spacing.
--tx-type-label-familyvar(--tx-font-sans, system-ui, sans-serif)Control labels and button text. Font family.
--tx-type-label-sizevar(--tx-font-size-sm, 0.875rem)Control labels and button text. Font size.
--tx-type-label-line1.25Control labels and button text. Line height.
--tx-type-label-weightvar(--tx-font-weight-medium, 500)Control labels and button text. Font weight.
--tx-type-label-trackingvar(--tx-letter-spacing-body, 0)Control labels and button text. Letter spacing.
--tx-type-caption-familyvar(--tx-font-sans, system-ui, sans-serif)Descriptions, hints and captions. Font family.
--tx-type-caption-sizevar(--tx-font-size-xs, 0.75rem)Descriptions, hints and captions. Font size.
--tx-type-caption-line1.35Descriptions, hints and captions. Line height.
--tx-type-caption-weightvar(--tx-font-weight-body, 400)Descriptions, hints and captions. Font weight.
--tx-type-caption-trackingvar(--tx-letter-spacing-body, 0)Descriptions, hints and captions. Letter spacing.
--tx-type-code-familyvar(--tx-font-mono, ui-monospace, monospace)Inline and block code. Font family.
--tx-type-code-size0.875emInline and block code. Font size.
--tx-type-code-line1.5Inline and block code. Line height.
--tx-type-code-weightvar(--tx-font-weight-body, 400)Inline and block code. Font weight.
--tx-type-code-tracking0Inline and block code. Letter spacing.

Elevation (8)

A six-step shadow ladder over the theme soft and float shadows, plus glass.

TokenDefaultMeaning
--tx-elevation-0noneFlush with the surface.
--tx-elevation-1var(--tx-shadow-soft, none)Resting surfaces: cards, inputs, stats.
--tx-elevation-2var(--tx-shadow-soft, none)Raised controls: slider thumbs, active tabs.
--tx-elevation-3var(--tx-shadow-float, none)Floating layers: menus, popovers, tooltips.
--tx-elevation-4var(--tx-shadow-float, none)Modal layers: dialogs and sheets.
--tx-elevation-5var(--tx-shadow-float, none)Notifications: toasts.
--tx-surface-glass-alphavar(--tx-glass-opacity, 82%)Glass surface fill opacity.
--tx-surface-glass-blurvar(--tx-glass-blur, 16px)Glass surface backdrop blur.

Shape (9)

The radius scale derived from --tx-radius and the radius scale, and border widths.

TokenDefaultMeaning
--tx-shape-radius-none0pxSquare corners.
--tx-shape-radius-xsmax(0px, var(--tx-radius, 0.625rem) - var(--tx-radius-step-6, 6px))The theme radius minus 6 px times the radius scale.
--tx-shape-radius-smmax(0px, var(--tx-radius, 0.625rem) - var(--tx-radius-step-4, 4px))The theme radius minus 4 px times the radius scale.
--tx-shape-radius-mdmax(0px, var(--tx-radius, 0.625rem) - var(--tx-radius-step-2, 2px))The theme radius minus 2 px times the radius scale.
--tx-shape-radius-lgvar(--tx-radius, 0.625rem)The theme radius.
--tx-shape-radius-xlcalc(var(--tx-radius, 0.625rem) + var(--tx-radius-step-4, 4px))The theme radius plus 4 px times the radius scale.
--tx-shape-radius-full9999pxPill and circle corners.
--tx-border-width-thinvar(--tx-border-width, 1px)Hairline borders.
--tx-border-width-thickcalc(var(--tx-border-width, 1px) * 2)Emphasis borders (drop zones, slider thumbs).

Layers (8)

Stacking order for sticky chrome, popovers, overlays, dialogs and toasts.

TokenDefaultMeaning
--tx-z-base0In-flow content.
--tx-z-sticky40Sticky chrome and navigation menus.
--tx-z-popover50Popovers, menus, selects, comboboxes, date panels.
--tx-z-tooltip50Tooltips.
--tx-z-overlay60Sheets, drawers and their scrims.
--tx-z-modal60Dialogs and alert dialogs.
--tx-z-toast60The toast viewport.
--tx-z-top70Skip links and shell chrome above every layer.

Opacity (3)

Disabled, muted and scrim opacities.

TokenDefaultMeaning
--tx-opacity-disabled0.5Disabled controls.
--tx-opacity-muted0.7Decorative icons such as select and menu chevrons.
--tx-opacity-scrim45%Opacity of the dialog and sheet --tx-scrim.

Layout (14)

Content widths, container breakpoints, grid columns and gutters. CSS cannot read custom properties inside @media or @container conditions, so the breakpoints are values for tooling and design-system exports.

TokenDefaultMeaning
--tx-layout-content-max72chReadable prose width (content layouts). Rem, ch and % layout widths do not multiply --tx-density; gutters still read the space scale.
--tx-layout-wide-max80remWide page sections (marketing layouts).
--tx-layout-full-max100%Full-bleed sections.
--tx-layout-breakpoint-sm36remSmall container breakpoint (2 grid columns).
--tx-layout-breakpoint-md56remMedium container breakpoint (3 grid columns).
--tx-layout-breakpoint-lg72remLarge container breakpoint (4 grid columns).
--tx-layout-grid-columns-base1Grid columns at the base breakpoint.
--tx-layout-grid-columns-sm2Grid columns at the sm breakpoint.
--tx-layout-grid-columns-md3Grid columns at the md breakpoint.
--tx-layout-grid-columns-lg4Grid columns at the lg breakpoint.
--tx-layout-grid-gutter-basevar(--tx-space-4)Grid gutter at the base breakpoint.
--tx-layout-grid-gutter-smvar(--tx-space-4)Grid gutter at the sm breakpoint.
--tx-layout-grid-gutter-mdvar(--tx-space-4)Grid gutter at the md breakpoint.
--tx-layout-grid-gutter-lgvar(--tx-space-4)Grid gutter at the lg breakpoint.

Icons (2)

Icon stroke and style.

TokenDefaultMeaning
--tx-icon-stroke2Icon stroke width (the Icon component default).
--tx-icon-styleoutlineIcon style: outline or filled.

Status (20)

One status set over the semantic roles, shared by badges, alerts, toasts and charts.

TokenDefaultMeaning
--tx-status-successvar(--tx-success)The success fill (badges, alerts, charts).
--tx-status-success-foregroundvar(--tx-success-foreground)Text on the success fill.
--tx-status-success-softvar(--tx-success-soft)The soft success fill.
--tx-status-success-soft-foregroundvar(--tx-success-soft-foreground)Text on the soft success fill.
--tx-status-warningvar(--tx-warning)The warning fill (badges, alerts, charts).
--tx-status-warning-foregroundvar(--tx-warning-foreground)Text on the warning fill.
--tx-status-warning-softvar(--tx-warning-soft)The soft warning fill.
--tx-status-warning-soft-foregroundvar(--tx-warning-soft-foreground)Text on the soft warning fill.
--tx-status-dangervar(--tx-destructive)The danger fill (badges, alerts, charts).
--tx-status-danger-foregroundvar(--tx-destructive-foreground)Text on the danger fill.
--tx-status-danger-softvar(--tx-destructive-soft)The soft danger fill.
--tx-status-danger-soft-foregroundvar(--tx-destructive-soft-foreground)Text on the soft danger fill.
--tx-status-infovar(--tx-info)The info fill (badges, alerts, charts).
--tx-status-info-foregroundvar(--tx-info-foreground)Text on the info fill.
--tx-status-info-softvar(--tx-info-soft)The soft info fill.
--tx-status-info-soft-foregroundvar(--tx-info-soft-foreground)Text on the soft info fill.
--tx-status-neutralvar(--tx-secondary)The neutral fill (badges, alerts, charts).
--tx-status-neutral-foregroundvar(--tx-secondary-foreground)Text on the neutral fill.
--tx-status-neutral-softvar(--tx-muted)The soft neutral fill.
--tx-status-neutral-soft-foregroundvar(--tx-muted-foreground)Text on the soft neutral fill.

Data-viz (36)

Chart categorical, sequential and diverging colors with grid and axis, emitted per theme.

TokenTheme sourceMeaning
--tx-chart-1theme.charts.categoricalCategorical series color 1.
--tx-chart-1-foregroundon-color(theme.charts.categorical)AA foreground ink on categorical series color 1.
--tx-chart-2theme.charts.categoricalCategorical series color 2.
--tx-chart-2-foregroundon-color(theme.charts.categorical)AA foreground ink on categorical series color 2.
--tx-chart-3theme.charts.categoricalCategorical series color 3.
--tx-chart-3-foregroundon-color(theme.charts.categorical)AA foreground ink on categorical series color 3.
--tx-chart-4theme.charts.categoricalCategorical series color 4.
--tx-chart-4-foregroundon-color(theme.charts.categorical)AA foreground ink on categorical series color 4.
--tx-chart-5theme.charts.categoricalCategorical series color 5.
--tx-chart-5-foregroundon-color(theme.charts.categorical)AA foreground ink on categorical series color 5.
--tx-chart-6theme.charts.categoricalCategorical series color 6.
--tx-chart-6-foregroundon-color(theme.charts.categorical)AA foreground ink on categorical series color 6.
--tx-chart-7theme.charts.categoricalCategorical series color 7.
--tx-chart-7-foregroundon-color(theme.charts.categorical)AA foreground ink on categorical series color 7.
--tx-chart-8theme.charts.categoricalCategorical series color 8.
--tx-chart-8-foregroundon-color(theme.charts.categorical)AA foreground ink on categorical series color 8.
--tx-chart-sequential-1theme.charts.sequentialSequential ramp step 1.
--tx-chart-sequential-2theme.charts.sequentialSequential ramp step 2.
--tx-chart-sequential-3theme.charts.sequentialSequential ramp step 3.
--tx-chart-sequential-4theme.charts.sequentialSequential ramp step 4.
--tx-chart-sequential-5theme.charts.sequentialSequential ramp step 5.
--tx-chart-sequential-6theme.charts.sequentialSequential ramp step 6.
--tx-chart-sequential-7theme.charts.sequentialSequential ramp step 7.
--tx-chart-sequential-8theme.charts.sequentialSequential ramp step 8.
--tx-chart-sequential-9theme.charts.sequentialSequential ramp step 9.
--tx-chart-diverging-1theme.charts.divergingDiverging ramp step 1.
--tx-chart-diverging-2theme.charts.divergingDiverging ramp step 2.
--tx-chart-diverging-3theme.charts.divergingDiverging ramp step 3.
--tx-chart-diverging-4theme.charts.divergingDiverging ramp step 4.
--tx-chart-diverging-5theme.charts.divergingDiverging ramp step 5.
--tx-chart-diverging-6theme.charts.divergingDiverging ramp step 6.
--tx-chart-diverging-7theme.charts.divergingDiverging ramp step 7.
--tx-chart-diverging-8theme.charts.divergingDiverging ramp step 8.
--tx-chart-diverging-9theme.charts.divergingDiverging ramp step 9.
--tx-chart-gridtheme.charts.grid or the border roleChart grid lines.
--tx-chart-axistheme.charts.axis or the muted foreground roleChart axes and ticks.

Next: every component token and its fallback.