Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Forms Form-associated

ColorPicker <pm-color-picker>

Colour picker: a swatch + hex field with a popup (or inline panel) holding a saturation/brightness area, hue and optional alpha sliders, preset swatches and the EyeDropper where supported.

Full screen

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/color-picker'; </script> <pm-color-picker label="Brand colour" value="#7c5cff" swatches="#7c5cff,#0ea5e9,#10b981,#f59e0b,#ef4444,#ec4899,#64748b,#111827"></pm-color-picker>

Sizes

Set with the size attribute; controls keep touch-sized targets on phones.

size="xs"
size="sm"
size="md"
size="lg"
size="xl"

States

Each state is one attribute.

Disabled
Read-only
Required
Error
With a hint

Overview

Value is "#rrggbb" ("#rrggbbaa" with alpha) and is submitted with forms. Keys on the area: arrows ±1%, Shift ±10%.

Attributes

AttributeTypeDefaultDescription
mobileboolean—Native mobile pattern on phones; not set means as the ancestors say, false opts out.
alphabooleanfalseAllow transparency (adds an alpha slider; value becomes #rrggbbaa when not opaque).
inlinebooleanfalseRender the panel inline instead of in a popup.
swatchesstring | string[]—Preset colours: comma-separated or a JSON array.
placeholderstring—Hint text shown while empty (not a replacement for label).
openbooleanfalseThe popup is open. Setting it opens or closes it.
namestring—Form field name: the value is submitted under it.
valuestring—Current value (submitted with the form).
labelstring—Visible label (required for accessibility; use hide-label to visually hide it).
hintstring—Help text under the field, linked to it for screen readers.
errorstring—Custom error message. Setting it marks the control invalid.
size'xs' | 'sm' | 'md' | 'lg' | 'xl'—Control size.
requiredbooleanfalseThe form cannot be submitted until this has a value.
disabledbooleanfalseNot interactive and not submitted.
readonlybooleanfalseFocusable and submitted, but not editable.
hide-label
prop: hideLabel
booleanfalseHide the label visually; it stays the accessible name.

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Events

EventReact / Svelte propDescription
pm-openonPmOpenThe popup opened.
pm-closeonPmCloseThe popup closed.
pm-inputonPmInputOn every value change while editing.
pm-changeonPmChangeWhen the value is committed.

Methods

show(), hide(), toggle(), close(), checkValidity(), reportValidity(), validate(), focus()