@fluid-ds/tokens
v0.0.3-alpha.0
Published
Design tokens for Fluid, typed source, generates CSS + a programmatic manifest. Drop the CSS files in your <head> or import them in your bundler.
Maintainers
Readme
@fluid-ds/tokens
Design tokens for Fluid, typed
TypeScript source that generates CSS custom properties (one file per
scheme) and a JSON manifest. Drop the CSS into your <head> or import it
in your bundler.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fluid-ds/tokens@latest/dist/base.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fluid-ds/tokens@latest/dist/light.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fluid-ds/tokens@latest/dist/dark.css" />Install
pnpm add @fluid-ds/tokensUse
// Order matters: base before the schemes.
import "@fluid-ds/tokens/base.css";
import "@fluid-ds/tokens/light.css";
import "@fluid-ds/tokens/dark.css";The CSS files declare every --fluid-* custom property at :root. Override
a single token to retheme an entire app:
[data-fluid-brand="custom"] {
--fluid-color-primary: #6366f1;
}Toggle dark mode by setting data-fluid-theme on <html>:
document.documentElement.setAttribute("data-fluid-theme", "dark");What's in the box
dist/base.css: primitives + layout vars (always load first)dist/light.css: semantic vars for the light schemedist/dark.css: semantic vars for the dark schemedist/manifest.json: programmatic catalog used by the theme buildersrc/tokens.ts: TypeScript source (re-exported via./source)
Documentation
- Theming basics: the three-layer model (brand, component, per-element)
- Theme builder: live token editor with brand-CSS export
License
MIT, © Fluid contributors
