@ibti-tech/tokens
Design tokens for the IBTI design system, shipped as TypeScript objects and as a CSS file (CSS variables + Tailwind CSS v4 @theme).
Install
pnpm add @ibti-tech/tokens
TypeScript
import {
colors,
spacing,
boxShadow,
transition,
breakpoints,
} from '@ibti-tech/tokens'
colors.semantic.action.default // '#F47C46'
spacing.components.medium // '1rem'
boxShadow.focusRing
transition.duration.fast // '.15s'
transition.easing.standard
| Export | Contents |
|---|---|
colors |
primary, error, success, warning palettes + semantic |
semanticThemes, themeLayers |
Raw light/dark values for theme-aware semantic colors and legacy layer-* / content-* HSL channels |
spacing |
components and sections scales |
borderRadius, font, blurRadius, fieldSizes, zIndex, layout |
Misc scales |
boxShadow |
normal/medium/large (legacy), sm/md/lg/xl, focusRing |
transition |
fast/default/slow (legacy), duration.*, easing.* |
breakpoints, screens, validBreakpointNames |
Responsiveness |
Semantic colors
colors.semantic = {
action: { default, hover, active, subtle, contrast },
highlight: { default, subtle, strong },
surface: { default, muted, elevated }, // theme-aware (CSS vars)
content: { primary, secondary, muted, inverse }, // theme-aware (CSS vars)
border: { default, strong, focus },
focus: { ring },
}
surface, content and border.default/strong are var(--ibti-*) references, so they only resolve when @ibti-tech/tokens/css is loaded. action, highlight, focus and border.focus are plain hex values.
Spacing scale and aliases
Canonical keys are smaller | small | medium | large | larger. For migration, xsmall (= smaller) and xlarge (= larger) are also available in both components and sections. They are deprecated and will be removed in a future major.
Responsiveness
breakpoints, screens and validBreakpointNames are exported from src/responsiveness.ts. The old misspelled src/reponsiveness.ts is kept and re-exported for compatibility, but is no longer imported by the index.
CSS
/* plain CSS variables */
@import '@ibti-tech/tokens/css';
/* or */
@import '@ibti-tech/tokens/tokens.css';
With Tailwind CSS v4:
@import 'tailwindcss';
@import '@ibti-tech/tokens/css';
dist/tokens.css contains:
:root— all tokens as CSS variables (--color-primary-normal,--spacing-component-small,--radius-medium,--font-size-large,--shadow-md,--breakpoint-tablet,--transition-duration-fast,--z-index-modals, ...).@theme { ... }— Tailwind v4 static tokens (--color-*,--spacing-*,--radius-*,--font-size-*,--shadow-*,--breakpoint-*,--ease-*).@theme inline { ... }— theme-aware semantic colors (--color-surface-*,--color-content-*,--color-border-*) that point at--ibti-*variables, so utilities such asbg-surface-defaultfollow the active theme.[data-theme='light'](also the:rootdefault) and[data-theme='dark']—--ibti-surface-*,--ibti-content-*,--ibti-border-*, plus the legacy HSL-channel--color-layer-*and--color-content-*variables used by@ibti-tech/ui.
Set data-theme="light" | "dark" on the <html> element to switch themes.
Development
pnpm build # tsup, then generate dist/tokens.css
pnpm generate:css # only regenerate dist/tokens.css
pnpm test
pnpm typecheck
scripts/generate-css.mjs runs without a TypeScript build and reads scripts/token-data.mjs, a plain-JS mirror of the values in src/. When you change a token in src/, update token-data.mjs too; test/token-data.test.mjs fails if they drift.
build runs tsup first because tsup cleans dist/; the CSS generator creates dist/ itself if it is missing.