Switch Field
A switch laid out as a field row with label, description, and hint or error text.
Show codeHide code
Installation
import { SwitchField } from "@makeplane/propel/components/switch-field";Usage
import { SwitchField } from "@makeplane/propel/components/switch-field";
export default function BasicDemo() {
return (
<SwitchField
name="restartOnFailure"
label="Restart on failure"
switchSize="md"
size="lg"
description="Automatically restart the service after a crash."
hint="You can change this later."
defaultChecked
/>
);
}Examples
Sizes
switchSize (sm, md, lg) sizes the switch track; size (lg, xl, 2xl) sizes the label and helper text independently — set them together for the common case.
Show codeHide code
Disabled
Show codeHide code
Error
Passing error marks the field invalid, replaces the hint with the error text, and — while the switch is off — outlines the track with a danger ring, the same treatment Checkbox uses.
Show codeHide code
Controlled
Show codeHide code
API Reference
SwitchField
Ready-to-use switch field with label, description, and helper/error text.