iOS-style toggle switch for boolean values
1npm install @openwebf/react-cupertino-ui1import { useState } from 'react';
2import { FlutterCupertinoSwitch } from '@openwebf/react-cupertino-ui';
3
4export function SwitchExample() {
5 const [enabled, setEnabled] = useState(false);
6
7 return (
8 <FlutterCupertinoSwitch
9 checked={enabled}
10 onChange={(e) => setEnabled(e.detail)}
11 />
12 );
13}| Name | Type | Default | Description |
|---|---|---|---|
| checked | boolean | false | Whether the switch is on. |
| disabled | boolean | false | Disable interactions. |
| activeColor | string | - | Track color when on (hex). |
| inactiveColor | string | - | Track color when off (hex). |
| onChange | (event: CustomEvent<boolean>) => void | - | Fires on toggles (`event.detail`). |