Skip to content

Components

Color Picker

Picks a color and submits it with the surrounding form.

Usage

Basic

HTML
<bs:bsui-color-picker defaultValue="#7c3aed" />

Labelled field

A swatch, a hex field and the help text explaining where the colour lands.

Used for buttons, links and focus rings.
HTML
<bs:bsui-field>
  <bs:bsui-field-label text="Accent color" />
  <bs:bsui-color-picker name="accent" defaultValue="#0ea5e9" />
  <bs:bsui-field-description text="Used for buttons, links and focus rings." />
</bs:bsui-field>

Brand palette

Several pickers in a row, each posting its own value.

HTML
<bs:bsui-stack direction="row" gap="4" align="start">
  <bs:bsui-field>
    <bs:bsui-field-label text="Primary" />
    <bs:bsui-color-picker name="primary" defaultValue="#111827" />
  </bs:bsui-field>
  <bs:bsui-field>
    <bs:bsui-field-label text="Accent" />
    <bs:bsui-color-picker name="accent" defaultValue="#f59e0b" />
  </bs:bsui-field>
</bs:bsui-stack>

Disabled

The native swatch and the hex field are both locked.

HTML
<bs:bsui-color-picker defaultValue="#64748b" disabled="true" />

Attributes

AttributeTypeDefault
name text —
defaultValue text #000000
disabled toggle false
nameAlt text —
onChange text —
value text —