Components
BaseSwatchPicker
A single choice among colour swatches or icons, shown as tiles.
components/ui/inputs/BaseSwatchPicker.vue
View in the demo
Example
Pick a colour and the icons follow it through tint. The roles editor uses this pair. The selected swatch gets a ✓ and a ring in its own colour, and the label says what is selected. With preview, an icon picker shows the result (the icon in its colour) on the left.
API
Props
Name | Type | Default | Description |
|---|---|---|---|
itemsrequired | BaseSwatchItem[] | — | The swatches, each { value, label, color? , icon? }. |
label | string | — | The group label. |
optional | boolean | false | Adds “(optional)” after the label. Never mark required fields. |
tint | string | "primary" | The colour of the selected icon. |
size | number | 36 | The size of each tile in pixels. Defaults to 36. |
preview | boolean | false | Shows the selected icon in the tint colour on the left, as it will look. |
v-model | string | — | The selected value. |
Events
Name | Payload | Description |
|---|---|---|
@update:modelValue | [value: string | undefined] | — |
Accessibility
It is a radio group with a single tab stop: the arrows, Home and End change the selection (RTL included), and each swatch has its label as accessible name and tooltip. The selection does not rely on colour alone: the ✓ and the name in the label show it too.