Skip to content

Switch

A toggle switch for boolean inputs.

Installation

import { Switch } from '@smc/darwin-ui';

Usage

import { Switch } from '@smc/darwin-ui';
export function Example() {
const [enabled, setEnabled] = useState(false);
return (
<Switch
label="Enable notifications"
checked={enabled}
onCheckedChange={setEnabled}
/>
);
}

API Reference

Props

PropTypeDefaultDescription
labelstring-Switch label
checkedbooleanfalseToggle state
onCheckedChange(checked: boolean) => void-Change handler
disabledbooleanfalseDisable switch