API reference: @salmonui/inputs/color-picker
ColorSwatchPickerPropsinterface
import type { ColorSwatchPickerProps } from '@salmonui/inputs/color-picker';interface ColorSwatchPickerProps {
readonly colors?: readonly ColorSwatchItem[] | readonly ColorSwatchGroup[] | undefined;
readonly columns?: number | undefined;
readonly value?: string | null | undefined;
readonly defaultValue?: string | null | undefined;
readonly onValueChange?: ((value: string | null, details: SwatchChangeDetails) => void) | undefined;
readonly clearable?: boolean | undefined;
readonly renderSwatch?: ((ctx: SwatchRenderContext) => ReactNode) | undefined;
readonly name?: string | undefined;
readonly form?: string | undefined;
readonly disabled?: boolean | undefined;
readonly localeText?: {
readonly noColor?: string;
readonly colorName?: (color: Color) => string;
} | undefined;
readonly className?: string | undefined;
readonly style?: CSSProperties | undefined;
readonly id?: string | undefined;
readonly 'aria-label'?: string | undefined;
readonly 'aria-labelledby'?: string | undefined;
readonly ref?: Ref<HTMLDivElement> | undefined;
}
| 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. |