Skip to content

BbColorPalette

A colour palette in place — the colour square, hue / alpha sliders, swatches and eyedropper with no trigger and no popover; v-model of a hex.

import { BbColorPalette } from 'bitboss-ui';

On this page

Props

NameDescription
alpha Type: booleanDefaultfalse

Enable the alpha channel. The palette shows an opacity slider and emits #RRGGBBAA hex8 values.

Enable it wherever eight-digit values can occur: without it an incoming #RRGGBBAA loses its opacity. A sampled eyedropper colour always comes back opaque.

See example
disabled Type: booleanDefaultfalse

Takes every control out of the tab order and ignores every input.

Takes every control out of the tab order. A <fieldset disabled> around the palette does the same.

See example
eyeDropper Type: booleanDefaultfalse

Show an eyedropper button to sample any color on screen. Uses the native EyeDropper API — hidden automatically on unsupported browsers.

The button renders only where the browser implements the native EyeDropper API (Chromium-based browsers, not Firefox or Safari) and is absent elsewhere, with nothing in its place. Keep the square and the swatches as the path everyone has.

See example
modelValue Type: string | null

v-model: the current color as a #RRGGBB hex string (or #RRGGBBAA when alpha is enabled), or null when empty.

pt Type: (PtCompoundOf<"", { readonly parts: readonly ["root", "swatch"]; readonly states: readonly ["selected", "disabled"]; readonly wide: readonly ["disabled"]; readonly node: { readonly swatch: readonly ["selected"]; }; }> & { root?: PtValue | undefined; "root:disabled"?: PtValue | undefined; swatch?: PtValue | undefined; "swatch:disabled"?: PtValue | undefined; "swatch:selected"?: PtValue | undefined; })

Passthrough, object form: the same keys as the pt:* attributes without the prefix. See the pt:<part> row.

pt:<part> Type: PtValue

Passthrough, attribute form: one attribute per part, pt:<part>, and per part and state, pt:<part>:<state>. Parts: root, swatch. States: disabled, selected.

See example
readonly Type: booleanDefaultfalse

The controls stay focusable and show the value, but nothing changes it.

The controls stay focusable, so the colour stays readable, and nothing changes it. Prefer it to disabled for a locked value.

See example
swatches Type: boolean | string[][]

Controls swatches display: - true — show the built-in Material-palette swatches - string[][] — show custom swatches (each inner array = a column of shades) - false / omitted — no swatches section

Each inner array is a column of shades, so ramps are designed vertically. A row-wise string[][] type-checks and renders a grid nobody can scan.

See example

v-model

Values kept in sync through v-model.

NameDescription
modelValue Type: string | null

Seed it as ref<string | null>(null) or a hex. null goes in but never comes out: every pick is a concrete colour, so clearing is your own action.

See example

Events

NameDescription
update:modelValue Type: (value: string): void

Emitted when a color is picked. Payload is a concrete #RRGGBB (or #RRGGBBAA when alpha is enabled) — the palette always emits a color, never null.

Drag-frequency, not a commit: it fires on every frame while the square or a slider moves. Repaint from it, and save on value-commit.

See example
value-commit Type: (value: string): void

Emitted once the user finishes changing the colour, after update:modelValue, with the same value: on release after a drag, on each key step, swatch pick or eye-dropper pick. Only when it changed; never for a value you set.

The event to save on: once a drag is released, and once per key step, swatch or eyedropper pick. Only when the colour changed, and never for a value you set from code.

See example

Renamed and removed

Names from v2 and from earlier 3.0 betas that no longer work, and what to write instead.

  • activatorremovedfails silently

    The popover is BbColorPicker now (palm #27a): BbColorPalette is the in-page panel; rename the tag to BbColorPicker.

  • slotactivatorremovedfails silently

    The popover is BbColorPicker now (palm #27a): BbColorPalette is the in-page panel; rename the tag to BbColorPicker.