Skip to content
bitboss-ui3.0.0-beta.79

BbColorPalette

An always-visible colour palette for a theme editor or settings panel, with no trigger and no popover.

import { BbColorPalette } from 'bitboss-ui';

On this page

Use it for

Use BbColorPalette when the palette is the interface: a theme editor, a brand settings panel, or a wizard step.

Use something else when

  • BbColorPicker — the palette opens from a dot, chip or row you own and closes after the pick
  • BbColorPickerInput — the colour is a labelled form field, with hex text people can type

BbColorPalette is the colour square, hue slider, swatches and eyedropper that BbColorPicker opens in its popover, rendered in the page. It has no label, hint or error chrome: name it with aria-label.

Coming from v2#activator → BbColorPicker

In v2, BbColorPalette was the popover with an #activator slot. That component is BbColorPicker now. npx bitboss-ui check reports activator or #activator on BbColorPalette: rename the tag.

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.

A theme editor

Bind a seeded string | null model and repaint the preview from it. Save on value-commit, which fires once per finished drag, key step or swatch pick.

Workspace accent

Saved #4f46e5

Book a demo View pricing

The model is lowercase #RRGGBB. null shows an empty palette, but every pick is a concrete colour, so clearing back to null is your own action.

Presets, transparency and the eyedropper

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

Highlighted passage

#fde04799

Each inner array of swatches is a column, and the whole grid is one Tab stop that the arrow keys move through. With alpha the model is #RRGGBBAA; without it, an eight-digit value loses its opacity. The eyedropper button exists only where the browser has the native API, and a sampled colour is always opaque.

Locked and disabled

readonly keeps the square, sliders and swatches focusable while nothing changes the value. Use it for a colour people may read but not edit.

disabled takes every control out of the tab order, and so does a <fieldset disabled> around the palette.

Styling

The root paints nothing: add the border and padding on pt:root, and shape the swatches on pt:swatch. --mark is the ring on the chosen swatch (default --bb-accent).

pt:swatch:selected styles the swatch that matches the value, and pt:root:disabled the whole palette while it is disabled.