Get started
Design tokens
Design tokens are the CSS variables behind the library's look. Use them in your own styles so custom UI matches the components and follows the active theme. Values shown here are live: switch the site's mode to see them change.
Using tokens
Tokens are CSS custom properties set on :root by the library's stylesheet. Reference them with var(). Color tokens change with the mode and brand, so styles written with them follow every theme automatically.
.promo {
padding: var(--space-6);
color: var(--color-text);
background: var(--color-surface-raised);
border: var(--border-width) solid var(--color-border);
border-radius: var(--radius-xl);
box-shadow: var(--shadow-md);
transition: transform var(--duration-normal) var(--ease-spring);
}
.promo:hover {
transform: translateY(calc(-1 * var(--lift-distance)));
}
Tailwind CSS
Using Tailwind CSS v4? The library ships a preset that turns the tokens into utilities, so your own layouts match the components. Import it after Tailwind, and keep importing the library's stylesheet as usual.
@import "tailwindcss";
@import "@vjdesigns/vjdesigns-ui/tailwind.css";
<section className="bg-surface text-text rounded-xl shadow-md p-6">
<h2 className="font-display text-2xl tracking-tight">Season stats</h2>
<p className="text-text-muted">Updated after every game.</p>
<span className="bg-accent text-on-accent rounded-control px-3">New</span>
</section>
Every utility points at a token (bg-primary is var(--color-primary)), so Tailwind classes follow the mode, brand and accent exactly like the components, with no dark: variants needed. Tailwind's spacing (p-4 is 1rem) and breakpoints already match. For readable text, use the pairs the components use: text-text or text-text-muted on the surfaces, text-on-primary on bg-primary, and text-primary-subtle-text on bg-primary-subtle (likewise for each tone). Don't use accent or chart colors for text.
Some Tailwind names take the library's values: rounded-*, shadow-*, leading-*, the text-* sizes and the font weights (rounded-md is 12px, font-black is 800), and max-w-md and @md: are 48rem. The preset doesn't change the components, and Tailwind's CSS reset doesn't override them.
Color
Surfaces and text
| Token | Value | Preview |
|---|---|---|
--color-bg | | |
--color-surface | | |
--color-surface-raised | | |
--color-surface-sunken | | |
--color-surface-hover | | |
--color-surface-active | | |
--color-overlay | | |
--color-text | | |
--color-text-muted | | |
--color-text-disabled | | |
--color-text-inverse | | |
--color-border | | |
--color-border-strong | | |
--color-border-input | |
Primary (from the brand)
| Token | Value | Preview |
|---|---|---|
--color-primary | | |
--color-primary-hover | | |
--color-primary-active | | |
--color-on-primary | | |
--color-primary-subtle | | |
--color-primary-subtle-hover | | |
--color-primary-subtle-text | | |
--color-primary-border | | |
--color-link-visited | |
Tones
Every tone has the same set of roles, named --color-{tone}, --color-{tone}-hover, -active, --color-on-{tone} (text on the solid fill), -subtle, -subtle-hover, -subtle-text (text on the subtle fill) and -border. Each text pairing meets 4.5:1 contrast.
- Solid
- Hover
- Pressed
- Subtle
- Subtle hover
- Border
- Solid
- Hover
- Pressed
- Subtle
- Subtle hover
- Border
- Solid
- Hover
- Pressed
- Subtle
- Subtle hover
- Border
- Solid
- Hover
- Pressed
- Subtle
- Subtle hover
- Border
- Solid
- Hover
- Pressed
- Subtle
- Subtle hover
- Border
- Solid
- Hover
- Pressed
- Subtle
- Subtle hover
- Border
Focus
| Token | Value |
|---|---|
--focus-ring-color | |
--focus-ring-width | |
--focus-ring-offset | |
Typography
| Token | Value | Preview |
|---|---|---|
--font-display | | Quick brown fox |
--font-body | | Quick brown fox |
--font-mono | | Quick brown fox |
| Token | Value | Preview |
|---|---|---|
--font-size-xs | | Ag |
--font-size-sm | | Ag |
--font-size-md | | Ag |
--font-size-lg | | Ag |
--font-size-xl | | Ag |
--font-size-2xl | | Ag |
--font-size-3xl | | Ag |
--font-size-4xl | | Ag |
--font-size-5xl | | Ag |
--font-size-6xl | | Ag |
| Token | Value | Preview |
|---|---|---|
--font-weight-regular | | Ag |
--font-weight-medium | | Ag |
--font-weight-semibold | | Ag |
--font-weight-bold | | Ag |
--font-weight-black | | Ag |
| Token | Value |
|---|---|
--line-height-tight | |
--line-height-snug | |
--line-height-normal | |
--line-height-relaxed | |
--letter-spacing-tight | |
--letter-spacing-normal | |
--letter-spacing-wide | |
--letter-spacing-caps | |
Spacing
A 4px-based scale. Components that take a gap, p or spacing prop use these step numbers, so gap={4} means var(--space-4).
| Token | Value | Preview |
|---|---|---|
--space-0 | | |
--space-0-5 | | |
--space-1 | | |
--space-1-5 | | |
--space-2 | | |
--space-3 | | |
--space-4 | | |
--space-5 | | |
--space-6 | | |
--space-8 | | |
--space-10 | | |
--space-12 | | |
--space-16 | | |
--space-20 | | |
--space-24 | |
Radius
| Token | Value | Preview |
|---|---|---|
--radius-none | | |
--radius-xs | | |
--radius-sm | | |
--radius-md | | |
--radius-lg | | |
--radius-xl | | |
--radius-2xl | | |
--radius-pill | | |
--control-radius | | |
--field-radius | |
Shadow
| Token | Value | Preview |
|---|---|---|
--shadow-xs | | |
--shadow-sm | | |
--shadow-md | | |
--shadow-lg | | |
--shadow-xl | |
Sizing
| Token | Value |
|---|---|
--control-height-sm | |
--control-height-md | |
--control-height-lg | |
--target-size-min | |
--icon-size-xs | |
--icon-size-sm | |
--icon-size-md | |
--icon-size-lg | |
--icon-size-xl | |
--icon-size-2xl | |
--border-width | |
--border-width-thick | |
Motion
Components animate with these durations and easings. When someone has asked their system to reduce motion, the library shortens or removes animations for you.
| Token | Value |
|---|---|
--duration-instant | |
--duration-fast | |
--duration-normal | |
--duration-slow | |
--ease-standard | |
--ease-out | |
--ease-in | |
--ease-spring | |
--press-scale | |
--enter-scale | |
Layering
| Token | Value |
|---|---|
--z-base | |
--z-sticky | |
--z-overlay | |
--z-modal | |
--z-popover | |
--z-dropdown | |
--z-toast | |
--z-tooltip | |
--z-skip-link | |
Breakpoints
Responsive props (such as columns={{ base: 1, md: 2 }}) are mobile first: each key applies from its width up. CSS variables can't be used in media queries, so these are exported as breakpoints for use in JavaScript.
| Key | Applies from |
|---|---|
sm | 640px |
md | 768px |
lg | 1024px |
xl | 1280px |
2xl | 1536px |