Calm motion: animations on this site only fade, with no movement
Color swatches
A set of ready colors, to pick one
Lets a person pick one color from a short set, for example a label color or a cover color. For any color, use the color picker, which shows these swatches as its presets.
Basic
Cover color: #a759ff
swatchesis a list of CSS colors, or of{ value, label }. Give each color a label, so a screen reader says "Pink" and not a hex code. The label is also the tooltip.v-modelis the value of the picked color, ornull. The match ignores case, so#E85078picks#e85078.- The picked color has a ring in the text color.
sizeismd(default) orsm. - The swatches are a group of native radio buttons: Tab goes into the group, and the arrow keys move between the colors.
disabledturns all of them off. - Change the name of the group with
labelsor a label pack:label.
Usage
ts
import { BlessColorSwatches, type BlessColorSwatch } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
swatches* | (string | BlessColorSwatch)[] | — | the colors: a CSS color, or `{ value, label }` so a screen reader says a name, not a code |
size | "md" | "sm" | "md" | |
disabled | boolean | — | |
labels | Partial<{ label: string; }> | — | |
modelValue | string | null | null |
Events
| Name | Payload | Description |
|---|---|---|
update:modelValue | [value: string | null] |