View as Markdown

API reference: @salmonui/inputs/color-picker

ColorFieldPropsinterface

import type { ColorFieldProps } from '@salmonui/inputs/color-picker';
interface ColorFieldProps extends FieldCommonProps, NativeInput {
    readonly value?: ColorInput | null | undefined;
    readonly defaultValue?: ColorInput | null | undefined;
    readonly onValueChange?: ((value: string | null, details: ColorFieldChangeDetails) => void) | undefined;
    readonly valueFormat?: ColorFormat | undefined;
    readonly clearable?: boolean | undefined;
    readonly showSwatch?: boolean | undefined;
    readonly endAdornment?: ReactNode;
    readonly localeText?: (FieldValidationText & {
        readonly clear?: string;
        readonly colorName?: (color: Color) => string;
    }) | undefined;
    readonly className?: string | undefined;
    readonly style?: CSSProperties | undefined;
    readonly classNames?: {
        readonly group?: string;
        readonly input?: string;
        readonly label?: string;
        readonly description?: string;
        readonly error?: string;
    } | undefined;
    readonly ref?: Ref<HTMLInputElement> | undefined;
}
ColorFieldProps members (19, 7 inherited)
NameSignatureDescription
valueoptionalreadonly value?: ColorInput | null | undefined;
defaultValueoptionalreadonly defaultValue?: ColorInput | null | undefined;
onValueChangeoptionalreadonly onValueChange?: ((value: string | null, details: ColorFieldChangeDetails) => void) | undefined;

Called with the entry in valueFormat after it parses (blur or Enter), or null when emptied.

valueFormatoptionalreadonly valueFormat?: ColorFormat | undefined;

Format of the shown and reported value. Default 'hexa'.

clearableoptionalreadonly clearable?: boolean | undefined;
showSwatchoptionalreadonly showSwatch?: boolean | undefined;

A ColorSwatch of the value as the start adornment. Default true.

endAdornmentoptionalreadonly endAdornment?: ReactNode;
localeTextoptionalreadonly localeText?: (FieldValidationText & { readonly clear?: string; readonly colorName?: (color: Color) => string; }) | undefined;
classNameoptionalreadonly className?: string | undefined;
styleoptionalreadonly style?: CSSProperties | undefined;
classNamesoptionalreadonly classNames?: { readonly group?: string; readonly input?: string; readonly label?: string; readonly description?: string; readonly error?: string; } | undefined;
refoptionalreadonly ref?: Ref<HTMLInputElement> | undefined;

The native <input>.

labeloptionalinheritedlabel?: ReactNode;
descriptionoptionalinheriteddescription?: ReactNode;
errorMessageoptionalinheritederrorMessage?: ((ctx: { readonly errors: readonly string[]; }) => ReactNode) | ReactNode;

Error text (or a function of the errors) shown while the field is invalid.

invalidoptionalinheritedinvalid?: boolean;

Forces the error state.

validationoptionalinheritedvalidation?: FieldValidation;

Rules in the Data Grid vocabulary.

validateOnoptionalinheritedvalidateOn?: ValidateOn;

When errors appear; default the Form's, else 'blur'.

sizeoptionalinheritedsize?: FieldSize;

Metric set. Default 'md'.