API reference: @salmonui/inputs/color-picker
ColorSwatchPickercomponent
import { ColorSwatchPicker } from '@salmonui/inputs/color-picker';function ColorSwatchPicker(props: ColorSwatchPickerProps): ReactNode;
A palette as an APG listbox laid out as a grid: one tab stop (roving tabindex), arrows move by cell and
row (ArrowLeft / ArrowRight mirrored in right-to-left content), Home / End
to the row ends, Ctrl+Home / Ctrl+End to the first and last swatch, Enter
or Space (or a click) selects. Groups are labelled role="group"s.
Props: ColorSwatchPickerProps
| Name | Signature | Description |
|---|---|---|
colorsoptional | readonly colors?: readonly ColorSwatchItem[] | readonly ColorSwatchGroup[] | undefined; | Flat entries or labelled groups. Default: a 10-column palette of grays and 9 hues in 5 shades. |
columnsoptional | readonly columns?: number | undefined; | Swatches per row. Default 10. |
valueoptional | readonly value?: string | null | undefined; | |
defaultValueoptional | readonly defaultValue?: string | null | undefined; | |
onValueChangeoptional | readonly onValueChange?: ((value: string | null, details: SwatchChangeDetails) => void) | undefined; | |
clearableoptional | readonly clearable?: boolean | undefined; | Adds a "no color" swatch first; picking it sets |
renderSwatchoptional | readonly renderSwatch?: ((ctx: SwatchRenderContext) => ReactNode) | undefined; | Replaces the swatch inside each option. |
nameoptional | readonly name?: string | undefined; | Name of a hidden input carrying the value ( |
formoptional | readonly form?: string | undefined; | |
disabledoptional | readonly disabled?: boolean | undefined; | |
localeTextoptional | readonly localeText?: {
readonly noColor?: string;
readonly colorName?: (color: Color) => string;
} | undefined; | |
classNameoptional | readonly className?: string | undefined; | |
styleoptional | readonly style?: CSSProperties | undefined; | |
idoptional | readonly id?: string | undefined; | |
aria-labeloptional | readonly 'aria-label'?: string | undefined; | |
aria-labelledbyoptional | readonly 'aria-labelledby'?: string | undefined; | |
refoptional | readonly ref?: Ref<HTMLDivElement> | undefined; | The listbox element. |