Installation
Theme
Mode

Foundations

Theme Controls

The UI for Orbit's theme runtime — six brand presets and a light/dark toggle. Changes apply to <html> instantly, persist to localStorage, and every component re-themes through the shared CSS tokens.

$npx shadcn@latest add @orbit/theme-controls

Default

This is live — it drives the whole docs site.

Theme
Mode

Presets only

Theme

Runtime API

ThemeControls is a thin UI over the OrbitTheme store (registry/theme). Use the useTheme() hook in components, or the store directly outside React.

PropTypeDefaultDescription
useTheme()hookSubscribes to { preset, mode } and exposes setPreset, setMode, toggleMode, presets.
OrbitTheme.get()() => ThemeStateCurrent { preset, mode }.
OrbitTheme.set()(Partial<ThemeState>) => voidSet either or both; persists and emits an 'orbit-theme' CustomEvent.
OrbitTheme.onChange()(fn) => unsubscribeSubscribe outside React.
<ThemeScript />componentInline script for <head> that applies the saved theme before first paint.

Props

PropTypeDefaultDescription
showModebooleantrueShow the light/dark segmented control.
classNamestringExtends or overrides the card chrome (e.g. borderless inside a top bar).

Keyboard & accessibility

Every control is a real button reachable with Tab. Each preset swatch carries its preset name as an aria-label and reflects selection with aria-pressed (the check glyph is decorative); the light/dark segmented control likewise exposes aria-pressed on each option. Enter and Space activate the focused control, changes apply to <html> instantly and persist, and the hover/selection transitions collapse under prefers-reduced-motion.

Tab through the swatches and the mode control
Theme
Mode