ColorPickerPreview

Form & Input
stable

Hue and alpha sliders with a colour preview swatch and optional eye-dropper button.

Structure

Anatomy

Visual breakdown of the component's internal structure with BEM class call-outs.

Anatomy of OrigamColorPickerPreviewSchematic of ColorPickerPreview with 4 internal parts. 1 2 3 4 origam-color-picker-preview
Anatomy of <origam-color-picker-preview> — 4 parts: root flex container ①, preview dot ②, hue slider ③, alpha slider ④ (hidden when hideAlpha).
1.origam-color-picker-preview
Root <div> with display: flex; align-items: center. Has --hide-alpha BEM modifier when hideAlpha=true.
2.origam-color-picker-preview__dot
Circular swatch showing the current colour. Uses a checkerboard background for transparency. 30x30px, border-radius: 50%.
3.origam-color-picker-preview__hue
OrigamSliderField ranging 0–360 for hue. Track background is the full hue gradient. Fill track is hidden.
4.origam-color-picker-preview__alpha
OrigamSliderField ranging 0–1 for alpha (step 1/256). Track background is a transparency-to-current-colour gradient. Conditionally rendered via v-if="!hideAlpha".

API

Props

All props accepted by this component, with their type, default value and description.

colorHsv
THSVA | null
Current colour in HSVA format { h, s, v, a }. Drives the hue slider position and the preview swatch fill.
disabled
boolean
false
Disables slider interaction. Passed through to both SliderField children.
hideAlpha
boolean
false
Hides the alpha slider. Applied as a BEM modifier --hide-alpha on the root element.
ariaLabel
string
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
height
number | string
Override height of the preview strip. Accepts a CSS length or a number (px).
maxHeight
number | string
maxWidth
number | string
minHeight
number | string
minWidth
number | string
width
number | string
Override width of the preview strip.

API

Emits

Events emitted by this component.

@update:colorHsv
THSVA
Fired when the user moves the hue or alpha slider, or picks a colour with the eye-dropper. Emits the updated HSVA object.

API

Exposed members

Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.

<T extends object>(props: T, exclude?: string[]) => Partial<T>
Utility to forward a filtered subset of props to a child component.
Ref<string>
Reactive CSS string generated by useStyle.
string
Unique style-sheet ID for this instance.
() => void
Injects the computed style sheet into the document.
() => void
Removes the injected style sheet.
Ref<boolean>
True once the style sheet has been injected into the DOM.

Customisation

CSS variables

CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.

Width of the preview dot swatch.
Height of the preview dot swatch.
Border-radius of the preview dot swatch.
CSS custom property injected at runtime with the current hue as a CSS colour. Used as the end stop of the alpha gradient track.

Inclusion

Accessibility

ARIA roles, keyboard navigation and focus management. Sourced from the real component template.

Keyboard interactions

Keyboard interactions
KeyAction
TabMoves focus between the hue slider, alpha slider, and eye-dropper button.
Arrow Left / RightAdjusts the focused slider (hue or alpha) by one step.

Notes

  • Each SliderField is a native range-like widget with aria-valuemin, aria-valuemax and aria-valuenow. Keyboard navigation is handled by OrigamSliderField.
  • The eye-dropper button is only rendered when window.EyeDropper is available (Chromium 95+). On unsupported browsers the slot is absent.

Interactive

Playground

Edit props live and see the component update in real time. The generated code snippet updates as you change values.

Rendering the live preview…

Usage

Examples

Ready-to-paste code snippets for your templates.

Standalone preview

vue

Without alpha slider

vue

Ecosystem

Family

Components from the same folder that share conventions and often compose together.