Skip to main content

ThemeBuilder

An in-app brand-theme editor: the full colour system (with live WCAG contrast checks), typography, corner radius, surface + component depth, border weight, density, motion and data-viz series — previewed on real Prism components and exported as a drop-in theme.css / tokens.json.

Signature
Density
Viewport
Theme and light/dark are set in the top bar
Live demo
Open ↗

When to use​

An in-app brand-theme editor: the full colour system (with live WCAG contrast checks), typography, corner radius, surface + component depth, border weight, density, motion and data-viz series — previewed on real Prism components and exported as a drop-in theme.css / tokens.json.

Accessibility​

Fully keyboard operable: Tab to focus, Enter/Space to activate. The visible focus ring uses --focus-ring — never remove it. Provide an accessible label (aria-label) for icon-only controls.

Install and import​

npx shadcn@latest add @prism/theme-builder
import { ThemeBuilder } from '@/components/prism/ThemeBuilder';

In a no-build prototype, read it from the bundle instead: const { ThemeBuilder } = window.PrismDesignSystem_39d121;

Props​

PropTypeRequiredDescription
namestring—Name stamped into the exported CSS.
defaultColorsRecord<string, ThemeBuilderColor>—Seed the colour system (OKLCH per role: primary/secondary/tertiary/link/positive/notice/negative/info).
defaultFonts\{ display?: string; body?: string; mono?: string \}—Seed the font families (--font-display/-body/-mono).
defaultBase"prism" | "enterprise"—Base theme to start from: its primary colour, roundedness and depth, previewed on its surfaces. Default "prism".
onChange(out: \{ profile: ThemeBuilderProfile; css: string \}) => void—Fires on every edit with the full brand profile + the drop-in theme.css.
classNamestring—