# ColorPickerProps (@salmonui/inputs/color-picker)

> The ColorPickerProps interface of @salmonui/inputs/color-picker.

Canonical: https://salmonui.dev/docs/reference/inputs/color-picker/ColorPickerProps

```ts
import type { ColorPickerProps } from '@salmonui/inputs/color-picker';
```

Entry index: https://salmonui.dev/docs/reference/inputs/color-picker (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/inputs/color-picker.md).

## Reference

Kind: interface

```ts
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;
}
```

Members (42):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `label` | `label?: ReactNode;` | optional, inherited |  |
| `description` | `description?: ReactNode;` | optional, inherited |  |
| `errorMessage` | `errorMessage?: ((ctx: { readonly errors: readonly string[]; }) => ReactNode) \| ReactNode;` | optional, inherited | Error text (or a function of the errors) shown while the field is invalid. |
| `invalid` | `invalid?: boolean;` | optional, inherited | Forces the error state. |
| `validation` | `validation?: FieldValidation;` | optional, inherited | Rules in the Data Grid vocabulary. |
| `validateOn` | `validateOn?: ValidateOn;` | optional, inherited | When errors appear; default the `Form`'s, else `'blur'`. |
| `size` | `size?: FieldSize;` | optional, inherited | Metric set. Default `'md'`. |
| `value` | `readonly value?: string \| null \| undefined;` | optional | The color in `valueFormat`, or null for no color. |
| `defaultValue` | `readonly defaultValue?: string \| null \| undefined;` | optional | Default `'#008000ff'`. |
| `onValueChange` | `readonly onValueChange?: ((value: string \| null, details: ColorPickerChangeDetails) => void) \| undefined;` | optional | Every pick, at most once per animation frame while dragging. |
| `onValueCommit` | `readonly onValueCommit?: ((value: string \| null, details: ColorPickerChangeDetails) => void) \| undefined;` | optional | A committed value: Apply with `commitBehavior: 'confirm'`, else a drag end, key step, field entry or swatch pick. |
| `valueFormat` | `readonly valueFormat?: ColorFormat \| undefined;` | optional | Default `'hexa'`. With `'hex'` the alpha slider is hidden. |
| `mode` | `readonly mode?: ColorPickerMode \| undefined;` | optional |  |
| `defaultMode` | `readonly defaultMode?: ColorPickerMode \| undefined;` | optional | Default `'area'`. |
| `onModeChange` | `readonly onModeChange?: ((mode: ColorPickerMode) => void) \| undefined;` | optional |  |
| `onBeforeModeChange` | `readonly onBeforeModeChange?: ((event: ColorPickerBeforeModeChangeEvent) => void) \| undefined;` | optional | Cancellable. |
| `showModeSwitch` | `readonly showModeSwitch?: boolean \| undefined;` | optional | The button that switches between the area and the palette. Default true. |
| `inline` | `readonly inline?: boolean \| undefined;` | optional | Renders the panel in place, without a trigger or popover. |
| `alpha` | `readonly alpha?: boolean \| undefined;` | optional | The alpha slider and alpha in the hex field. Default true. |
| `clearable` | `readonly clearable?: boolean \| undefined;` | optional | A "no color" swatch (and the field's clear button); value null. |
| `commitBehavior` | `readonly commitBehavior?: 'confirm' \| 'immediate' \| undefined;` | optional | `'confirm'` (default): Apply and Cancel buttons, Cancel or a dismissal discards the picks. `'immediate'`: every pick commits. |
| `recentColors` | `readonly recentColors?: readonly string[] \| undefined;` | optional | Recently committed colors, newest first. Shown and tracked when this or `defaultRecentColors` is set; never stored. |
| `defaultRecentColors` | `readonly defaultRecentColors?: readonly string[] \| undefined;` | optional |  |
| `onRecentColorsChange` | `readonly onRecentColorsChange?: ((colors: readonly string[]) => void) \| undefined;` | optional |  |
| `maxRecentColors` | `readonly maxRecentColors?: number \| undefined;` | optional | Default 10. |
| `colors` | `readonly colors?: readonly ColorSwatchItem[] \| readonly ColorSwatchGroup[] \| undefined;` | optional | Palette of the swatches mode; default the `ColorSwatchPicker` palette. |
| `columns` | `readonly columns?: number \| undefined;` | optional | Palette columns. Default 10. |
| `renderSwatch` | `readonly renderSwatch?: ((ctx: SwatchRenderContext) => ReactNode) \| undefined;` | optional | Replaces each palette swatch. |
| `open` | `readonly open?: boolean \| undefined;` | optional |  |
| `defaultOpen` | `readonly defaultOpen?: boolean \| undefined;` | optional |  |
| `onOpenChange` | `readonly onOpenChange?: ((open: boolean, details: ColorPickerOpenChangeDetails) => void) \| undefined;` | optional |  |
| `onBeforeOpenChange` | `readonly onBeforeOpenChange?: ((event: ColorPickerBeforeOpenChangeEvent) => void) \| undefined;` | optional | Cancellable. |
| `name` | `readonly name?: string \| undefined;` | optional | Name of a hidden input carrying the value (`''` for no color). |
| `form` | `readonly form?: string \| undefined;` | optional |  |
| `disabled` | `readonly disabled?: boolean \| undefined;` | optional |  |
| `required` | `readonly required?: boolean \| undefined;` | optional |  |
| `id` | `readonly id?: string \| undefined;` | optional |  |
| `aria-label` | `readonly 'aria-label'?: string \| undefined;` | optional | Accessible name of the trigger without a `label`. |
| `localeText` | `readonly localeText?: ColorPickerLocaleText \| undefined;` | optional |  |
| `className` | `readonly className?: string \| undefined;` | optional |  |
| `style` | `readonly style?: CSSProperties \| undefined;` | optional |  |
| `ref` | `readonly ref?: Ref<HTMLElement> \| undefined;` | optional | The trigger button (the panel group when `inline`). |
