Skip to content

Color Picker

SColorPicker is a visual color picker in a popover panel: a 2D saturation/brightness area, a hue slider (and optionally an alpha slider), preset swatches, and a hex field (SColorField). The trigger shows the current color. It is built on SPopover; the value is a hex string bound with v-model. The panel opens in a portal, so the demos are wrapped in <ClientOnly>.

Basic usage

Alpha and presets

Without the input

The hideInput flag hides the hex field in the panel, leaving only the saturation area, the hue slider, and the swatches.

Disabled

disabled locks the trigger: the panel does not open and the color cannot be changed.

API

Props

NameTypeDefaultDescription
squarebooleanundefinedSquare field corners: removes the rounding (rounded by default).
labelstringundefinedLabel next to the color preview (in the trigger).
with-alphabooleanfalseShows the opacity slider (alpha channel).
swatchesstring[]undefinedPreset swatches for quick selection (an array of hex strings).
hide-inputbooleanfalseHides the hex input in the panel.
disabledbooleanfalseDisables color selection.
aria-labelstringundefinedAccessible name of the trigger (aria-label).
swatches-labelstringundefinedAccessible name of the swatch group (taken from the locale dictionary by default).
flatbooleanundefinedRemoves the shadow. Overridden by the elevation prop when it is set.
elevation0 | 1 | 2 | 3 | 4 | 5undefinedShadow level 0–5 (scale); 0 means no shadow. Overrides flat.
model-valuestring"#3B82F6"Selected color in hex (for example #3B82F6). Two-way binding via v-model.

Events

NameSignatureDescription
update:modelValue(value: string) => voidEmitted when modelValue changes. Used for two-way binding (v-model).