Token-based design system with standardized CSS custom property names, multiple theme implementations (polished with light/dark mode, sketch), and optional component patterns...
Elementary is a design system comprised of three independent, orthogonal layers:
Layer 1: Token Naming System
--c-primary, --s-4, ...)Layer 2: Theme Implementations
Layer 3: Component Classes
Key Insight: Token NAMES stay constant across themes; only token VALUES change. This allows switching visual fidelity by changing a single CSS import without touching Layer 1 (token names) or Layer 3 (component code).
Token-Based Styling:
Visual Fidelity Control:
Component Consistency:
Keywords: Elementary, design tokens, CSS variables, light/dark mode, themeable, high-fidelity, sketch, component classes (wf-btn, wf-card), design system
Not a Fit For: Utility-first styling (use Tailwind), quick prototypes without design system constraints, fully custom styling without reusable patterns
/* Polished (production-ready with light/dark mode) */
@import './assets/elementary/tokens/polished.css';
@import './assets/elementary/components.css'; /* optional */
See: references/themes.md for complete theme documentation
To use Elementary in your own project, install the assets locally:
# From your project directory
/path/to/elementary/scripts/elementary.mjs install .
This creates assets/elementary/ in your project with the same structure as this skill.
Primary Approach: Use Component Classes
<article className="wf-card">
<h3 className="title">Card Title</h3>
<p className="description">Card content</p>
</article>
Tiny Tweaks: Inline Style Overrides (1-2 properties only):
<article className="wf-card" style={{
backgroundColor: 'var(--c-slate-100)' /* Single override OK */
}}>
<h3 className="title">Card with custom background</h3>
<p className="description">Override theme for quick escape</p>
</article>
Custom Components: Use Tokens in CSS (when no component class exists):
/* Import Elementary tokens first */
@import './assets/elementary/tokens/polished.css';
/* Create your own class when `components.css` doesn't have what you need */
.custom-alert {
padding: var(--s-4);
border-radius: var(--r-card);
background-color: var(--bg-surface);
border-left: 4px solid var(--c-primary);
color: var(--c-text);
& .title {
font: var(--t-heading);
}
}
<article className="custom-alert">
<h3 className="title">Custom Alert</h3>
<p>This component doesn't exist in components.css,
so we created a CSS class using Elementary tokens.
</p>
</article>
Rule: Component classes → Tiny inline tweaks (1-2 properties) → Custom CSS classes with tokens. Never extensive inline styles.
See: references/components.md for all available component classes
Standardized names used across ALL themes:
--c-primary, --c-secondary (colors)--bg-surface, --bg-overlay (backgrounds)--s-4, --s-6 (spacing: 16px, 24px)--r-btn, --r-card (radius)Token Hierarchy:
--s-4, --c-slate-500) - use in theme files--c-primary, --bg-surface) - use in CSS classes for custom componentsWhen to Use Design Tokens:
When NOT to Use Design Tokens:
See: references/token-system.md for complete token taxonomy
Different VALUE assignments to the same token NAMES:
Polished:
Sketch:
Theme Switching: Change import path only - all code remains unchanged.
See: references/themes.md for theme characteristics and usage
Pre-built patterns in assets/components.css:
.wf-btn, .wf-card, .wf-hero (UI components).title, .description, .actions (semantic children)See: references/components.md for all available components
Use Component Classes First:
<div className="wf-card">
<button className="wf-btn primary">
Use Tokens in CSS Classes (for custom components):
.my-custom-alert {
color: var(--c-primary);
background-color: var(--bg-surface);
padding: var(--s-4);
}
Inline Overrides for Tiny Tweaks (1-2 properties max):
<div className="wf-card" style={{ backgroundColor: 'var(--c-accent)' }}>
Change Themes via Import:
/* Switch from polished to sketch */
@import './assets/elementary/tokens/sketch.css';
Mix Tailwind with Elementary:
{/* WRONG */}
<div className="wf-card p-4 flex gap-2">
Invent Component Classes:
{/* WRONG - .wf-dashboard-card doesn't exist */}
<div className="wf-dashboard-card">
Use Primitive Tokens in Component Code:
/* WRONG - use semantics instead */
color: var(--c-slate-700);
Hardcode Values:
/* WRONG - defeats the token system */
padding: 16px;
color: #333333;
Excessive Inline Styles (>2 properties):
{/* WRONG - code smell, create a CSS class instead */}
<div style={{
padding: 'var(--s-6)',
borderRadius: 'var(--r-card)',
backgroundColor: 'var(--bg-surface)',
border: '1px solid var(--c-border)'
}}>
Polished theme uses light-dark() CSS function for automatic theming:
User Control:
// Toggle theme
document.documentElement.style.colorScheme = 'dark'; // or 'light'
System Preference (Automatic):
/* Already set in polished.css */
:root { color-scheme: light dark; }
Note: Sketch theme does not support light/dark mode (intentionally grayscale).
See: references/themes.md for browser compatibility and fallbacks
Elementary works standalone OR composed with other skills:
With reactive-md:
/* From reactive-md document */
@import './assets/elementary/tokens/polished.css';
@import './assets/elementary/components.css';
With React frameworks:
/* Next.js, Remix, Vite - adjust relative path as needed */
@import './assets/elementary/tokens/polished.css';
Token Names (Layer 1):
references/token-system.md - Complete token taxonomyTheme Values (Layer 2):
references/themes.md - All available themesComponent Classes (Layer 3):
references/components.md - All available classesUsage Examples:
references/recipes/ - Common patterns (buttons, cards, dashboards, landing pages, settings pages)Installation Tool:
# Install Elementary assets to current directory
/path/to/elementary/scripts/elementary.mjs install .
Discovery Tool (if available):
// Discover component classes and tokens
list_design_classes({
css_file: "assets/elementary/components.css",
include_tokens: true,
theme: "polished"
})