Switch
A Switch component allows users to toggle between two states. Built on top of heroui-native Switch.
Demo
Demo Coming Soon
Switch examples will be available soon.
Usage
import { useState } from 'react';import { NSwitch } from '@nayan-ui/react';const Switch = () => {const [enabled, setEnabled] = useState(false);return <NSwitch label="Is Dark Mode" enabled={enabled} onChange={setEnabled} />;};export default Switch;
Attributes
| Name | Type | Default | Details |
|---|---|---|---|
| label | string | Optional | Label for the switch. |
| isSelected | boolean | false | Whether the switch is selected. |
| isDisabled | boolean | false | Whether the switch is disabled. |
| onSelectedChange | (selected: boolean) => void | Optional | Callback when switch state changes. |
| className | string | ' ' | You can customise switch by passing tailwind classes. |
| containerClassName | string | ' ' | You can customise container by passing tailwind classes. |
| labelClassName | string | ' ' | You can customise label by passing tailwind classes. |