Skip to content

BbColorPicker

Assign a colour from an application-owned trigger and keep persistence in application state.

import { BbColorPicker } from 'bitboss-ui';

On this page

Use it for

Use BbColorPicker to assign a colour from a trigger you own, such as a label dot or calendar category.

Use something else when

BbColorPicker opens a BbColorPalette in a popover (a bottom sheet on a phone).

Coming from v2BbColorPalette → BbColorPicker

The v2 BbColorPalette, with its #activator slot, is BbColorPicker now: rename the tag (types BbColorPickerProps, BbColorPickerEvents, BbColorPickerSlots). Its classes follow: .bb-color-palette__popover became .bb-color-picker, with .bb-color-picker__panel and .bb-color-picker__sheet. BbColorPalette is now the panel without a popover, and npx bitboss-ui check reports activator or #activator on it.

Passthrough

Hover or tap a part to outline it. The toggles turn on loading, errors and warnings where the component has them; only parts get a row.

Assign and save label colours

Spread the activator slot's props onto the clickable element and give each instance a specific label.

Issue labelsAll changes saved
  • accessibility12 open issues
  • design system5 open issues
  • documentation31 open issues

The model starts as string | null, but the picker emits only concrete colours. v-model moves on every drag frame, so repaint from it; save on value-commit, which fires once per finished drag or pick. Provide your own action to clear back to null. The picker never joins a BbForm, so save the value yourself.

For a dot in a table cell, v-bb-color="{ modelValue, 'onUpdate:modelValue': save, label }" wires the same picker with no wrapper component; the plugin registers the directive (see Installation). For an element you already hold a ref to, pass it to activator.

Presets, transparency and the eyedropper

Offer your brand colours as swatches, turn on alpha when the value can carry opacity, and add eye-dropper to sample a colour from the screen.

Summer collection

Each custom swatch array is a column. Enable alpha wherever eight-digit values can arrive. The eyedropper button exists only where the browser has the native API, and a sampled colour is always opaque; keep the gradient or swatches as the universal path.

Coming from v2picker → eye-dropper

picker became eye-dropper; the old attribute has no effect, a development build warns about the rename, and npx bitboss-ui check --fix rewrites it. The activator slot value was renamed from color to value.

Trigger and open state

Read open from the activator slot to style the trigger, as the caret does here. To open the palette from code, bind v-model:open: every close the user makes is written back to it.

  • Marketing siteUpdated 3 days ago
  • Legacy billingArchived in March
  • Workspace themeManaged by an admin

readonly keeps the trigger focusable without opening the palette. disabled stops it opening, and the activator props carry disabled and aria-disabled onto your button, so you only style the inert state, from the slot's disabled. Screen readers name the trigger by label followed by the text inside it, so a hex code you show stays in the name. Escape closes the palette before any dialog around it.

Placement and mobile behaviour

Anchor the popover to a larger row when the click target is only a small colour dot.

Brand accent#4f46e5

placement is a preference and flips on overflow unless disable-flip is set. On mobile, adaptive opens a draggable bottom sheet that ignores the positioning props. Dragging the colour square or a slider never drags the sheet.

Coming from v2flip → disable-flip

:flip="false" became disable-flip with inverted polarity. show-arrow and arrow-padding were removed.