ColorPicker

Form & Input
stable

Full-featured HSVA colour picker. Includes a gradient canvas, hue/alpha sliders, hex/RGB/HSL/HSV input fields and optional swatches. Composes OrigamColorPickerCanvas, OrigamColorPickerPreview, OrigamColorPickerEdit and OrigamColorPickerSwatches.

Structure

Anatomy

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

Anatomy of OrigamColorPickerSchematic of the ColorPicker with 6 numbered internal parts. HEX / RGB / HSL inputs Swatches (optional) 1 2 3 4 5 6 Each sub-component emits update:colorHsv — changes bubble up to OrigamColorPicker
Anatomy of <origam-color-picker> — 6 composable regions.
1.origam-color-picker
Root element wrapping OrigamPicker. Inherits picker chrome (title, header, actions slots).
2.origam-color-picker-canvas
Gradient canvas (OrigamColorPickerCanvas). Drag to change saturation + value. Hidden when hideCanvas=true.
3.origam-color-picker-preview
Hue and alpha sliders + preview swatch (OrigamColorPickerPreview). Hidden when hideSliders=true.
4.origam-color-picker__controls
Row grouping the preview strip and edit inputs.
5.origam-color-picker-edit
Input fields + mode switcher (OrigamColorPickerEdit). Hidden when hideInputs=true.
6.origam-color-picker-swatches
Predefined swatch grid (OrigamColorPickerSwatches). Visible only when showSwatches=true.

API

Props

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

canvasHeight
string | number
150
Height of the gradient canvas in pixels or a CSS length.
canvasWidth
string | number
Width of the gradient canvas. Defaults to 100% of the picker width.
hideCanvas
boolean
false
Hides the gradient canvas section entirely.
hideSliders
boolean
false
Hides the hue and alpha slider strip.
hideInputs
boolean
false
Hides the text input fields (HEX / RGB / HSL / HSV).
showSwatches
boolean
false
Shows the swatch grid below the inputs.
swatchesMaxHeight
string | number
Maximum height of the swatch grid. Adds a scrollbar when the swatch list overflows.
modelValue
Record<string, unknown> | string | undefined | null
Currently selected colour. Accepts a hex string, RGB/HSL/HSV object, or null. Use v-model for two-way binding.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
border
boolean | number | string | TDirectionBoth | Array<TDirectionBoth>
false
Applies a border to the picker panel.
borderTop
boolean | number | string
borderLeft
boolean | number | string
borderBottom
boolean | number | string
borderRight
boolean | number | string
borderBlock
boolean | number | string
borderInline
boolean | number | string
borderInlineStart
boolean | number | string
borderInlineEnd
boolean | number | string
borderBlockStart
boolean | number | string
borderBlockEnd
boolean | number | string
borderColor
string
borderStyle
string
borderTopColor
TColor
borderRightColor
TColor
borderBottomColor
TColor
borderLeftColor
TColor
borderInlineStartColor
TColor
borderInlineEndColor
TColor
borderBlockStartColor
TColor
borderBlockEndColor
TColor
Border-radius token applied to the picker panel.
roundedTopRight
boolean | number | string
roundedTopLeft
boolean | number | string
roundedBottomLeft
boolean | number | string
roundedBottomRight
boolean | number | string
roundedStartStart
boolean | number | string
roundedStartEnd
boolean | number | string
roundedEndStart
boolean | number | string
roundedEndEnd
boolean | number | string
elevation
TElevation
Box-shadow elevation.
padding
boolean | number | string
paddingTop
boolean | number | string
paddingLeft
boolean | number | string
paddingBottom
boolean | number | string
paddingRight
boolean | number | string
paddingBlock
boolean | number | string
paddingInline
boolean | number | string
paddingInlineStart
boolean | number | string
paddingInlineEnd
boolean | number | string
paddingBlockStart
boolean | number | string
paddingBlockEnd
boolean | number | string
margin
boolean | number | string
marginTop
boolean | number | string
marginLeft
boolean | number | string
marginBottom
boolean | number | string
marginRight
boolean | number | string
marginBlock
boolean | number | string
marginInline
boolean | number | string
marginInlineStart
boolean | number | string
marginInlineEnd
boolean | number | string
marginBlockStart
boolean | number | string
marginBlockEnd
boolean | number | string
landscape
boolean
hideHeader
boolean
side
TDirectionBoth
swipeable
boolean
snapPoints
ReadonlyArray<TSheetSnapPoint>
defaultSnap
TSheetSnapId
open
boolean
disabled
boolean
false
Disables all interaction. Canvas drag, slider drag and text inputs become non-interactive.
persistent
boolean
handleLabel
string
tag
string
color
Accent intent colour (e.g. active slider thumb colour).
bgColor
TColor
height
number | string
maxHeight
number | string
maxWidth
number | string
minHeight
number | string
minWidth
number | string
width
number | string
location
TAnchor
position
TPosition
top
number | string
bottom
number | string
left
number | string
right
number | string
active
boolean | IStateEffectConfig
activeClass
string
hover
boolean | IStateEffectConfig
hoverClass
string
title
string
fontSize
TFontSize
fontWeight
TFontWeight
letterSpacing
TLetterSpacing
colorHsv
Internal HSVA colour representation forwarded to sub-components. Not typically set by consumers — use modelValue instead.
dotSize
string | number
Size of the drag cursor on the canvas.
ariaLabel
string
hideAlpha
boolean
Active colour input mode. Accepted: 'hex' | 'rgb' | 'hsl' | 'hsv' | 'rgba' | 'hsla' | 'hsva'.
Allowed colour input modes shown in the mode switcher.
swatches
Array<Array<TColorType>>
Grid of swatches as a 2-D array of colour values. Each inner array is one row.

API

Slots

Content slots exposed by this component.

#title
Title area at the top of the picker panel (forwarded from OrigamPicker).
#header
Header area below the title (forwarded from OrigamPicker).
#default
Replaces the built-in canvas + controls + swatches layout. Use when you need a fully custom inner structure.
#actions
Action buttons at the bottom of the picker panel (forwarded from OrigamPicker). Ideal for Cancel / Apply buttons.

API

Emits

Events emitted by this component.

@update:modelValue
any
Fired when the selected colour changes. Payload matches the format of modelValue.
@update:mode
TColorModes
Fired when the user switches the active input mode.

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 filtered props to OrigamPicker or sub-components.
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.

Customisation

CSS variables

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

Picker panel background colour.
Picker panel corner radius.
Minimum width of the picker panel.
Canvas corner radius.
Size of the drag cursor circle on the canvas.
Width of the current colour preview swatch.
Height of the current colour preview swatch.
Size of each swatch tile.
Height of the hue slider track.
Height of the alpha slider track.

Inclusion

Accessibility

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

ARIA roles

group

Keyboard interactions

Keyboard interactions
KeyAction
TabMoves focus between canvas, sliders, input fields and mode switcher.
Arrow keys (canvas)Moves the canvas cursor by 1% increments in saturation/value. Allows precise colour selection without a mouse.
Arrow keys (sliders)Adjusts the hue or alpha slider value by 1 step.

Notes

  • The canvas carries an aria-label describing the gradient region. The drag cursor position is announced via aria-valuemin/valuemax/valuenow attributes.
  • Each text input has a visible label matching the mode (HEX, R, G, B, H, S, L…). Screen readers read the label and current value together.

Foundation

Design tokens

Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.

Source
dimension
var(--origam-space---2)
Gap between edit input fields.

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.

Basic colour picker

vue

With swatches

vue

With action buttons

vue

Ecosystem

Family

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