ColorPicker
Components

ColorPicker

Choose a hex color from a popover with optional preset swatches.

Props

ColorPickerProps props
PropTypeDefaultDescription
valuestring—Controlled hex color.
defaultValuestring"#7366ff"Initial uncontrolled color.
onChange(hex: string) => void—Change handler.
swatchesstring[]DEFAULT_SWATCHESPreset row under the picker. Pass [] to hide.
showValuebooleantrueShow the hex next to the swatch in the trigger.
disabledboolean—Prevents interaction.
align"start" | "end""start"Popover alignment.

Specimens

Basic

The default picker with DEFAULT_SWATCHES and the hex value shown.

ColorPicker

Custom swatches

Provide your own preset palette via swatches.

ColorPicker: custom swatches

Without swatches

Pass an empty array to hide the swatch row entirely.

ColorPicker: no swatches

Without hex label

Set showValue=false to hide the hex text in the trigger, leaving only the swatch.

ColorPicker: no showValue

Import

ImportTSX
import { ColorPicker, DEFAULT_SWATCHES } from "@solarius/onset";