View as Markdown

API reference: @salmonui/inputs/signature-pad

SignaturePadPropsinterface

import type { SignaturePadProps } from '@salmonui/inputs/signature-pad';
interface SignaturePadProps extends FieldCommonProps {
    readonly value?: string | null | undefined;
    readonly defaultValue?: string | null | undefined;
    readonly onValueChange?: ((value: string | null, details: SignatureChangeDetails) => void) | undefined;
    readonly strokeColor?: string | undefined;
    readonly minStrokeWidth?: number | undefined;
    readonly maxStrokeWidth?: number | undefined;
    readonly velocity?: number | undefined;
    readonly backgroundColor?: string | undefined;
    readonly backgroundImage?: string | undefined;
    readonly height?: number | string | undefined;
    readonly toolbar?: boolean | undefined;
    readonly fontFamily?: string | undefined;
    readonly name?: string | undefined;
    readonly form?: string | undefined;
    readonly required?: boolean | undefined;
    readonly disabled?: boolean | undefined;
    readonly readOnly?: boolean | undefined;
    readonly localeText?: SignaturePadLocaleText | undefined;
    readonly id?: string | undefined;
    readonly dir?: 'ltr' | 'rtl' | 'auto' | undefined;
    readonly className?: string | undefined;
    readonly style?: CSSProperties | undefined;
    readonly classNames?: {
        readonly label?: string;
        readonly surface?: string;
        readonly canvas?: string;
        readonly toolbar?: string;
        readonly description?: string;
        readonly error?: string;
    } | undefined;
    readonly ref?: Ref<SignaturePadApi> | undefined;
}
SignaturePadProps members (31, 7 inherited)
NameSignatureDescription
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'.

valueoptionalreadonly value?: string | null | undefined;

Controlled signature as a data URL (null empty).

defaultValueoptionalreadonly defaultValue?: string | null | undefined;
onValueChangeoptionalreadonly onValueChange?: ((value: string | null, details: SignatureChangeDetails) => void) | undefined;

After a stroke, undo, redo, clear, load, typed text or reset, with the PNG data URL (null empty).

strokeColoroptionalreadonly strokeColor?: string | undefined;

Default '#000000' (image data, not theme).

minStrokeWidthoptionalreadonly minStrokeWidth?: number | undefined;

Default 0.5.

maxStrokeWidthoptionalreadonly maxStrokeWidth?: number | undefined;

Default 2.5.

velocityoptionalreadonly velocity?: number | undefined;

Velocity filter weight 0..1; higher follows speed changes faster. Default 0.7.

backgroundColoroptionalreadonly backgroundColor?: string | undefined;

Canvas fill. Default none (transparent).

backgroundImageoptionalreadonly backgroundImage?: string | undefined;

Image drawn under the strokes, stretched to the pad. Same-origin or CORS-enabled.

heightoptionalreadonly height?: number | string | undefined;

Pad height (CSS length or px). Default 160.

toolbaroptionalreadonly toolbar?: boolean | undefined;

Shows the Clear button and the "type your name" toggle. Default true.

fontFamilyoptionalreadonly fontFamily?: string | undefined;

Font of typed text. Default 'cursive'.

nameoptionalreadonly name?: string | undefined;

Submits the PNG data URL (empty when there is no signature).

formoptionalreadonly form?: string | undefined;
requiredoptionalreadonly required?: boolean | undefined;
disabledoptionalreadonly disabled?: boolean | undefined;
readOnlyoptionalreadonly readOnly?: boolean | undefined;
localeTextoptionalreadonly localeText?: SignaturePadLocaleText | undefined;
idoptionalreadonly id?: string | undefined;
diroptionalreadonly dir?: 'ltr' | 'rtl' | 'auto' | undefined;
classNameoptionalreadonly className?: string | undefined;
styleoptionalreadonly style?: CSSProperties | undefined;
classNamesoptionalreadonly classNames?: { readonly label?: string; readonly surface?: string; readonly canvas?: string; readonly toolbar?: string; readonly description?: string; readonly error?: string; } | undefined;
refoptionalreadonly ref?: Ref<SignaturePadApi> | undefined;