Skip to content

ColorPickerField

A dual-input color picker that syncs a native <input type="color"> with a hex text field. Accepts and emits hex values without the # prefix.

Basic Usage

Demo

Value: #3b82f6

Required Field

Required

Disabled State

Disabled

Props

Props
PropTypeDefaultDescription
modelValuestring''Hex color value without the # prefix (e.g. '3b82f6'). Use with v-model.
labelstring''Label text displayed above the input.
requiredbooleanfalseMarks the field as required. Adds a red asterisk to the label.
disabledbooleanfalseDisables both the color picker and the text input.
placeholderstring'000000'Placeholder text for the hex input field.
errorstring''Error message displayed below the input in red.

Emits

Emits
EventPayloadDescription
update:modelValuestringEmitted on every color change. Value is a 6-character hex string without #.

Notes

  • Accepts input with or without # — normalizes internally.
  • The text input only allows hex characters (0-9, a-f, A-F) and caps at 6 characters.
  • The color picker swatch and text input are kept in sync bidirectionally.

Built with VitePress