tokens playground
Scoped semantic design tokens for dark and light themes at compact and comfortable densities.
Preview
--ac-sys-action-accentExample controls
State matrix
| Variant | Default |
|---|---|
| Sample | --ac-sys-action-accent |
Published example
API reference'use client'
import { useState } from 'react'
import { cssVar, type Theme } from '@ancrel/tokens'
import '@ancrel/tokens/css'
const panel = {
backgroundColor: cssVar('sys.surface.panel'),
color: cssVar('sys.ink.primary'),
padding: cssVar('sys.space.inset'),
fontFamily: cssVar('sys.type.family.sans'),
}
export default function App() {
const [theme, setTheme] = useState<Theme>('dark')
return (
<section aria-label="Workspace" data-theme="light" data-density="comfortable" style={panel}>
<h2>Workspace</h2>
<section aria-label="Local preview" data-theme={theme} data-density="compact" style={panel}>
<h3>Local preview</h3>
<p>Preview theme: {theme}</p>
<button type="button" onClick={() => setTheme(theme === 'dark' ? 'light' : 'dark')}>
Switch preview theme
</button>
</section>
</section>
)
}