Skip to content

BbColorPalette

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

import { BbColorPalette } from 'bitboss-ui';

On this page

Use it for

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

Use something else when

  • BbColorInput — the colour is a form field, with hex text people can type
  • BbPopover — the overlay contains arbitrary content

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 palette emits only concrete colours. Dragging emits on every frame: repaint locally, debounce persistence, and provide your own action to clear back to null. The palette 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 palette 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

The palette owns its open state. Observe open from the activator slot; there is no open prop or v-model:open.

  • 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.

Coming from v2update:open removed

The event is gone, so a leftover @update:open listener never fires. Listen to show and hide, or read open from the activator slot.

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.