compacto-ui

Search documentation

Jump to a page or a component.

OptionPalette

The --app-* theme picker — every palette as a card, grouped by hue, each previewing itself.

Preview

Midnight
Ocean
Chocolate
Amethyst
Nature
Rose
Amber
Slate
Sunset
Coffee
Cyberpunk
Retro

Installation

No install — ask an AI agent to copy this component from registry.json.

import { OptionPalette } from "@/components/ui/option-palette";

Notes

  • Reports a ColorThemeKey and applies nothing — wire onValueChange to whatever already writes appThemeCssVars() onto the document. On its own it looks like it does nothing.
  • Each card carries its own palette's --app-* values inline, so it previews the theme it selects on a page painted in a different one.
  • Grouped by hue from COLOR_THEME_PAIRS: a dark palette sits next to its light counterpart. Chocolate (light) has no dark side, so its group holds one card.
  • Controlled only — value and onValueChange are both required.
  • Derives ${testId}-<hue> per hue grid and ${testId}-<hue>-<theme key> per card from data-testid.

Props

The props worth knowing. Everything else passes straight through to the underlying element, including className, which is merged last so it always wins.

PropTypeDefaultDescription
valueColorThemeKey—The selected palette.
onValueChange(value: ColorThemeKey) => void—Called with a key when its card is clicked.
darkLabelstring"dark"Copy under a dark palette's name.
lightLabelstring"light"Copy under a light palette's name.