API reference: @salmonui/inputs/color-picker
ColorPickerPropsinterface
import type { ColorPickerProps } from '@salmonui/inputs/color-picker';interface ColorPickerProps extends FieldCommonProps {
readonly value?: string | null | undefined;
readonly defaultValue?: string | null | undefined;
readonly onValueChange?: ((value: string | null, details: ColorPickerChangeDetails) => void) | undefined;
readonly onValueCommit?: ((value: string | null, details: ColorPickerChangeDetails) => void) | undefined;
readonly valueFormat?: ColorFormat | undefined;
readonly mode?: ColorPickerMode | undefined;
readonly defaultMode?: ColorPickerMode | undefined;
readonly onModeChange?: ((mode: ColorPickerMode) => void) | undefined;
readonly onBeforeModeChange?: ((event: ColorPickerBeforeModeChangeEvent) => void) | undefined;
readonly showModeSwitch?: boolean | undefined;
readonly inline?: boolean | undefined;
readonly alpha?: boolean | undefined;
readonly clearable?: boolean | undefined;
readonly commitBehavior?: 'confirm' | 'immediate' | undefined;
readonly recentColors?: readonly string[] | undefined;
readonly defaultRecentColors?: readonly string[] | undefined;
readonly onRecentColorsChange?: ((colors: readonly string[]) => void) | undefined;
readonly maxRecentColors?: number | undefined;
readonly colors?: readonly ColorSwatchItem[] | readonly ColorSwatchGroup[] | undefined;
readonly columns?: number | undefined;
readonly renderSwatch?: ((ctx: SwatchRenderContext) => ReactNode) | undefined;
readonly open?: boolean | undefined;
readonly defaultOpen?: boolean | undefined;
readonly onOpenChange?: ((open: boolean, details: ColorPickerOpenChangeDetails) => void) | undefined;
readonly onBeforeOpenChange?: ((event: ColorPickerBeforeOpenChangeEvent) => void) | undefined;
readonly name?: string | undefined;
readonly form?: string | undefined;
readonly disabled?: boolean | undefined;
readonly required?: boolean | undefined;
readonly id?: string | undefined;
readonly 'aria-label'?: string | undefined;
readonly localeText?: ColorPickerLocaleText | undefined;
readonly className?: string | undefined;
readonly style?: CSSProperties | undefined;
readonly ref?: Ref<HTMLElement> | undefined;
}
| Name | Signature | Description |
|---|---|---|
labeloptionalinherited | label?: ReactNode; | |
descriptionoptionalinherited | description?: ReactNode; | |
errorMessageoptionalinherited | errorMessage?: ((ctx: { readonly errors: readonly string[]; }) => ReactNode) | ReactNode; | Error text (or a function of the errors) shown while the field is invalid. |
invalidoptionalinherited | invalid?: boolean; | Forces the error state. |
validationoptionalinherited | validation?: FieldValidation; | Rules in the Data Grid vocabulary. |
validateOnoptionalinherited | validateOn?: ValidateOn; | When errors appear; default the |
sizeoptionalinherited | size?: FieldSize; | Metric set. Default |
valueoptional | readonly value?: string | null | undefined; | The color in |
defaultValueoptional | readonly defaultValue?: string | null | undefined; | Default |
onValueChangeoptional | readonly onValueChange?: ((value: string | null, details: ColorPickerChangeDetails) => void) | undefined; | Every pick, at most once per animation frame while dragging. |
onValueCommitoptional | readonly onValueCommit?: ((value: string | null, details: ColorPickerChangeDetails) => void) | undefined; | A committed value: Apply with |
valueFormatoptional | readonly valueFormat?: ColorFormat | undefined; | Default |
modeoptional | readonly mode?: ColorPickerMode | undefined; | |
defaultModeoptional | readonly defaultMode?: ColorPickerMode | undefined; | Default |
onModeChangeoptional | readonly onModeChange?: ((mode: ColorPickerMode) => void) | undefined; | |
onBeforeModeChangeoptional | readonly onBeforeModeChange?: ((event: ColorPickerBeforeModeChangeEvent) => void) | undefined; | Cancellable. |
showModeSwitchoptional | readonly showModeSwitch?: boolean | undefined; | The button that switches between the area and the palette. Default true. |
inlineoptional | readonly inline?: boolean | undefined; | Renders the panel in place, without a trigger or popover. |
alphaoptional | readonly alpha?: boolean | undefined; | The alpha slider and alpha in the hex field. Default true. |
clearableoptional | readonly clearable?: boolean | undefined; | A "no color" swatch (and the field's clear button); value null. |
commitBehavioroptional | readonly commitBehavior?: 'confirm' | 'immediate' | undefined; |
|
recentColorsoptional | readonly recentColors?: readonly string[] | undefined; | Recently committed colors, newest first. Shown and tracked when this or |
defaultRecentColorsoptional | readonly defaultRecentColors?: readonly string[] | undefined; | |
onRecentColorsChangeoptional | readonly onRecentColorsChange?: ((colors: readonly string[]) => void) | undefined; | |
maxRecentColorsoptional | readonly maxRecentColors?: number | undefined; | Default 10. |
colorsoptional | readonly colors?: readonly ColorSwatchItem[] | readonly ColorSwatchGroup[] | undefined; | Palette of the swatches mode; default the |
columnsoptional | readonly columns?: number | undefined; | Palette columns. Default 10. |
renderSwatchoptional | readonly renderSwatch?: ((ctx: SwatchRenderContext) => ReactNode) | undefined; | Replaces each palette swatch. |
openoptional | readonly open?: boolean | undefined; | |
defaultOpenoptional | readonly defaultOpen?: boolean | undefined; | |
onOpenChangeoptional | readonly onOpenChange?: ((open: boolean, details: ColorPickerOpenChangeDetails) => void) | undefined; | |
onBeforeOpenChangeoptional | readonly onBeforeOpenChange?: ((event: ColorPickerBeforeOpenChangeEvent) => void) | undefined; | Cancellable. |
nameoptional | readonly name?: string | undefined; | Name of a hidden input carrying the value ( |
formoptional | readonly form?: string | undefined; | |
disabledoptional | readonly disabled?: boolean | undefined; | |
requiredoptional | readonly required?: boolean | undefined; | |
idoptional | readonly id?: string | undefined; | |
aria-labeloptional | readonly 'aria-label'?: string | undefined; | Accessible name of the trigger without a |
localeTextoptional | readonly localeText?: ColorPickerLocaleText | undefined; | |
classNameoptional | readonly className?: string | undefined; | |
styleoptional | readonly style?: CSSProperties | undefined; | |
refoptional | readonly ref?: Ref<HTMLElement> | undefined; | The trigger button (the panel group when |