MantineSwitch#
@palmyralabs/rt-forms-mantine · form/MantineSwitch.tsx
Overview#
Toggle switch. Unlike MantineCheckBox, accepts a two-value options pair to store anything non-boolean (e.g. 'Y' / 'N', 'ACTIVE' / 'INACTIVE').
Props — ISwitchDefinition & SwitchProps#
Common field props plus Mantine SwitchProps and:
| Prop | Type | Purpose |
|---|---|---|
options |
{ onValue, offValue }? |
Values written to form data for on/off states |
Ref — ISwitchField#
interface ISwitchField {
focus(): void;
getValue(): any;
setValue(v: any): void;
toggle(): void;
isValid(): boolean;
}Example#
<MantineSwitch
attribute="status"
label="Active"
options={{ onValue: 'ACTIVE', offValue: 'INACTIVE' }}
/>