Theming
OKLCH tokens, dark mode and per-project customization.
Veil UI ships a monochrome token set in OKLCH. Tokens are CSS custom properties,
mapped to Tailwind utilities through @theme inline, so a single override
rethemes every component.
Core tokens
| Token | Utility | Purpose |
|---|---|---|
--background | bg-background | Page surface |
--foreground | text-foreground | Primary text |
--card | bg-card | Raised surfaces |
--muted | bg-muted | Subtle fills |
--muted-foreground | text-muted-foreground | Secondary text |
--primary | bg-primary | Primary action |
--secondary | bg-secondary | Secondary action |
--accent | bg-accent | Hover surfaces |
--destructive | bg-destructive | Destructive action |
--border | border-border | Default border |
--input | border-input | Form border |
--ring | ring-ring | Focus ring |
--radius | rounded-md | Base radius |
Light and dark
Tokens are declared on :root and overridden on .dark. Add the class to the
<html> element — with next-themes, a theme script, or your own provider.
:root {
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
}
.dark {
--background: oklch(0.145 0 0);
--foreground: oklch(0.985 0 0);
}Radius
The whole scale derives from one value:
:root {
--radius: 0.375rem; /* 6px */
}--radius-sm, --radius-md, --radius-lg and --radius-xl are computed from
it, so components stay proportional.
Adding an accent
Veil UI is intentionally monochrome, but a brand accent is a two-line change:
:root {
--primary: oklch(0.55 0.22 264);
--primary-foreground: oklch(0.985 0 0);
--ring: oklch(0.55 0.22 264);
}Because components reference semantic tokens, nothing else needs to change.
Charts
--chart-1 through --chart-5 provide a monochrome ramp for data
visualization. Override them with a categorical palette if your product needs
color.
Motion
Veil UI ships a small, dependency-free motion layer in the tokens. It is plain CSS — no animation package, no JavaScript — so it works in React, Vue and plain HTML alike.
Components opt in with two core utilities:
| Utility | Keyframes | Default timing |
|---|---|---|
animate-in | veil-enter | 150ms, cubic-bezier(0.16, 1, 0.3, 1), backwards |
animate-out | veil-exit | 120ms, cubic-bezier(0.4, 0, 1, 1), forwards |
Three kinds of modifier utilities tune the keyframes:
| Group | Classes | Effect |
|---|---|---|
| Fade | fade-in-0, fade-out-0, fade-out-80 | Target opacity |
| Zoom | zoom-in-95, zoom-out-95 | Scale target |
| Slide | slide-in-from-{top,bottom,left,right}-{1,2,4,full} | Translate offset |
| Slide | slide-out-to-{top,bottom,left,right}-{1,2,4,full} | Translate offset |
They are composed with state variants, exactly like Radix examples:
<DialogContent
className="data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95
data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95"
/>Disclosure panels use dedicated height keyframes that read the primitive's measured content height:
<AccordionContent className="overflow-hidden data-[state=open]:animate-accordion-down data-[state=closed]:animate-accordion-up" />animate-collapsible-down / animate-collapsible-up do the same for
collapsibles.
Retiming
Durations come from CSS variables, so a single class retimes the animation without touching transitions:
<SheetContent className="[--veil-animation-duration:300ms] [--veil-exit-duration:200ms]" />duration-* utilities set transition duration and do not retime
animations — use the variables above.
Reduced motion
The base layer collapses every animation and transition to near-zero duration
when prefers-reduced-motion: reduce is set. Enter/exit still runs (so Radix
presence logic remains correct) but is imperceptible; nothing gets stuck
mid-animation.