ColorPickerField

Form & Input
stable

Text field input that opens a ColorPicker in a dropdown menu. The selected colour is displayed as a swatch inside the field prefix.

Preview

Rendering the live preview…

default

Rendering the live preview…

outlined

Rendering the live preview…

disabled

Structure

Anatomy

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

Anatomy of OrigamColorPickerFieldSchematic of the ColorPickerField with 4 numbered internal parts. Brand colour #7c3aed ⌄ 1 2 3 4 Clicking the field or swatch opens an OrigamColorPicker in an OrigamMenu popover
Anatomy of <origam-color-picker-field> — 4 visual parts.
1.origam-color-picker-field
Root element — extends OrigamTextField with a colour swatch prefix.
2.origam-color-picker-field__swatch
Small coloured square inside the input prefix. Shows the current selected colour. Clicking opens the picker.
3.origam-text-field__input
Editable text input showing the colour value (hex string). Clearing triggers openOnClear if enabled.
4.origam-color-picker-field__chevron
Append icon indicating the dropdown can be opened.

API

Props

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

menu
boolean
Controls whether the colour picker popover is open.
menuProps
IMenuProps
Props forwarded to the inner OrigamMenu component.
openOnClear
boolean
Re-opens the picker dropdown when the field value is cleared.
closeText
string
Accessible label for the close action inside the picker popover.
openText
string
Accessible label for the open action inside the picker popover.
closeOnSelect
boolean
Closes the picker popover automatically when a colour is selected.
autofocus
boolean
counter
boolean | number | string
counterValue
number | ((e: any) => number)
placeholder
string
Placeholder text shown when the field is empty.
persistentPlaceholder
boolean
persistentCounter
boolean
role
string
type
TTextFieldType
modelModifiers
string | boolean
mask
TMask
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
color
TColor
Intent or custom colour applied to the active/focused field state.
density
TDensity
'default'
Adjusts the vertical padding density of the field.
centerAffix
boolean
dirty
boolean
disabled
boolean
false
Disables the field and prevents opening the picker.
error
string | boolean
inline
boolean
label
string
Floating label displayed above the field.
prefix
string
suffix
string
persistentClear
boolean
singleLine
boolean
required
boolean
loading
TControlLoadingValue
tag
string
loadingText
string
bgColor
TColor
appendInnerAvatar
string
appendInnerIcon
TIcon
prependInnerAvatar
string
prependInnerIcon
TIcon
clearIcon
TIcon
clearable
boolean
false
Displays a clear icon to reset the selected colour.
prependInnerAriaLabel
string
appendInnerAriaLabel
string
border
boolean | number | string | TDirectionBoth | Array<TDirectionBoth>
false
Applies an explicit border to the field.
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
focused
boolean
text
string
floating
boolean
name
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
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
rounded
boolean | number | string | TRounded | null | undefined
Border-radius token for the field wrapper.
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
fontSize
TFontSize
fontWeight
TFontWeight
lineHeight
TLineHeight
letterSpacing
TLetterSpacing
active
boolean | IStateEffectConfig
activeClass
string
variant
TVariantInput
'outlined'
Visual style variant for the field wrapper.
elevation
TElevation
size
TSize | number
hideDetails
boolean | string
hideSpinButtons
boolean
hint
string
persistentHint
boolean
messages
Array<string> | string
height
number | string
maxHeight
number | string
maxWidth
number | string
minHeight
number | string
minWidth
number | string
width
number | string
direction
TDirection
errorMessages
Array<string> | string
maxErrors
number | string
readonly
boolean
false
Makes the field non-interactive without visually disabling it.
rules
Array<any>
modelValue
any
Current colour value (v-model). CSS colour string, e.g. "#ff0080" or "hsl(320, 100%, 50%)".
validateOn
TValidateOn
validationValue
any
appendAvatar
string
appendIcon
TIcon
prependAvatar
string
prependIcon
TIcon
prependAriaLabel
string
appendAriaLabel
string
transition
boolean | string | TTransitionProps

API

Slots

Content slots exposed by this component.

#colorSelection
#label
Custom label content. Overrides the label prop.
#clear
#prependInner
Content placed inside the field before the input (swatch area).
#appendInner
Content placed inside the field after the input.
#loader
Custom loader shown inside the field when loading is true.
#floatingLabel
#prefix
#suffix
#prepend
Content placed before the field (outside the field wrapper).
#append
Content placed after the field (outside the field wrapper).

API

Emits

Events emitted by this component.

@update:modelValue
TColor
Fired when the selected colour changes. Payload is the new colour string.
@update:menu
boolean
Fired when the picker popover opens or closes.
@click:clear
MouseEvent
Fired when the user clicks the clear icon.

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 OrigamTextField.
Ref<boolean>
True while the field is focused.
Ref<boolean>
Controls the picker popover open state programmatically.
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.

Minimum width of the field.
Width of the colour swatch inside the input.
Height of the colour swatch.
Border radius of the colour swatch.
Colour of the dropdown chevron icon.
Colour of the chevron icon on hover.

Inclusion

Accessibility

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

ARIA roles

combobox

Keyboard interactions

Keyboard interactions
KeyAction
Enter / SpaceOpens the colour picker popover.
EscapeCloses the colour picker popover without applying changes.
TabMoves focus into or out of the picker panel when open.

Notes

  • The field behaves as a combobox: aria-haspopup="dialog" and aria-expanded reflect the popover open state.
  • The colour swatch is decorative (aria-hidden="true"). The accessible value is provided by the text input which holds the hex string.

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
200px
Minimum field width.
dimension
24px
Swatch width.
dimension
24px
Swatch height.
dimension
var(--origam-radius---sm)
Swatch corner radius.
color
var(--origam-color__text---secondary)
Chevron icon colour.

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 usage

vue

Close on select

vue