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

NameTypeDefaultDetails
labelstringOptionalLabel for the switch.
isSelectedbooleanfalseWhether the switch is selected.
isDisabledbooleanfalseWhether the switch is disabled.
onSelectedChange(selected: boolean) => voidOptionalCallback when switch state changes.
classNamestring' 'You can customise switch by passing tailwind classes.
containerClassNamestring' 'You can customise container by passing tailwind classes.
labelClassNamestring' 'You can customise label by passing tailwind classes.