Components

Color Input ​

Color inputs combine a swatch with a text field so users can both pick and inspect a color value.

Basic Usage ​

A color input should make the current color visible while still exposing the editable text value.

Resolved Values ​

Different input shapes are useful to show because users will often paste shorthand values while the control resolves and normalizes them.

Sizes ​

The color input should scale cleanly across the shared size system.

States ​

Show invalid, read-only, and disabled states when the color value participates in form validation. A read-only input keeps its value visible and copyable but blocks edits to both the swatch and hex field.

API ​

Props ​

NameDescription
ariaLabelType string | null
Default null
customErrorCustom validation message; also settable via setCustomValidity().
Type string | null
Default null
defaultValueType string
disabledDisables the control and excludes it from constraint validation.
Type boolean
Default false
fitCellType boolean
Default false
invalidType boolean
Default false
isInvalidAlias for invalid.
nameName submitted with form data.
Type string | null
Default null
readonlyType boolean
Default false
readOnlyAlias for readonly.
requiredMarks the control as required for form submission.
Type boolean
Default false
sizeType PkColorInputSize
Default default
valueType string

Methods ​

NameDescription
checkValidity()Runs constraint validation without showing the browser UI.
reportValidity()Runs constraint validation and shows the browser UI when invalid.
resetValidity()Clears custom errors and re-syncs validity state.
setCustomValidity(message: string)Sets or clears a custom validation message.

Events ​

NameDescription
onChange—
onInput—
onPkChangeSome facades also expose value sugar via onChange.

Custom States ​

NameDescriptionCSS selector
disabledThe control is disabled.:state(disabled)
invalidThe control currently fails constraint validation.:state(invalid)
optionalThe control is not required.:state(optional)
requiredThe control is required.:state(required)
user-invalidInvalid after the user has interacted with the control.:state(user-invalid)
user-validValid after the user has interacted with the control.:state(user-valid)
validThe control currently passes constraint validation.:state(valid)

CSS Parts ​

NameDescriptionCSS selector
inputHex text input::part(input)
swatchSwatch container::part(swatch)
Edit this page
Last updated: Sep 9, 2026, 7:18 PM