Skip to main content

MultinaireSwitch

Toggle switch control for boolean selections.

Basic Usage

import { MultinaireSwitch } from '@multinaire/multinaire-design';

<MultinaireSwitch
value={isEnabled}
onChange={setIsEnabled}
/>

Props

PropTypeDefaultDescription
valuebooleanWhether the switch is on
colorColorKeys'primary'Active track color from the theme palette
onChange(value: boolean) => voidCallback invoked when the switch state changes
marginSpacingPropsOuter margin

Examples

Basic Toggle

const [isEnabled, setIsEnabled] = useState(false);

<MultinaireSwitch
value={isEnabled}
onChange={setIsEnabled}
/>

Notifications Settings

<MultinaireContainer gap={16}>
<MultinaireSwitch
value={pushNotifications}
onChange={setPushNotifications}
/>
<MultinaireSwitch
value={emailNotifications}
onChange={setEmailNotifications}
/>
</MultinaireContainer>

Read-only

<MultinaireSwitch value={isActive} />

With Margin

<MultinaireSwitch
value={isEnabled}
onChange={setIsEnabled}
margin={{ top: 16 }}
/>