View as Markdown

API reference: @salmonui/inputs/switch

SwitchPropsinterface

import type { SwitchProps } from '@salmonui/inputs/switch';
interface SwitchProps extends ToggleFieldProps {
    readonly thumbIcon?: ReactNode;
}
SwitchProps members (18, 17 inherited)
NameSignatureDescription
thumbIconoptionalreadonly thumbIcon?: ReactNode;

Icon drawn inside the thumb; decorative.

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'.

checkedoptionalinheritedchecked?: boolean;
defaultCheckedoptionalinheriteddefaultChecked?: boolean;
onCheckedChangeoptionalinheritedonCheckedChange?: ((checked: boolean, details: CheckedChangeDetails) => void);
valueoptionalinheritedvalue?: string;

Submitted value when checked (native, default 'on').

childrenoptionalinheritedchildren?: ReactNode;

Label text (rendered in a real <label for>).

labelPlacementoptionalinheritedlabelPlacement?: LabelPlacement;

Label before ('start') or after ('end', default) the control.

localeTextoptionalinheritedlocaleText?: FieldValidationText;
classNameoptionalinheritedclassName?: string;
styleoptionalinheritedstyle?: CSSProperties;
classNamesoptionalinheritedclassNames?: { readonly input?: string; readonly label?: string; readonly description?: string; readonly error?: string; };

Part classes: root is className; input, label, description, error.

refoptionalinheritedref?: Ref<HTMLInputElement>;

The native <input type="checkbox">.