Checkbox
A Checkbox component allows users to select or deselect options. Built on top of heroui-native Checkbox with isSelected/onSelectedChange API.
Demo
Demo Coming Soon
Checkbox examples will be available soon.
Usage
import { useState } from 'react';import { NCheck, NLink } from '@nayan-ui/react';const Checkbox = () => {const [notifications, setNotifications] = useState(true);const [terms, setTerms] = useState(false);return (<div className="space-y-3"><NCheck checked={notifications} onChange={setNotifications}>Enable email notifications</NCheck><NCheck checked={terms} onChange={setTerms}>I agree to the <NLink href="#">Terms of Service</NLink></NCheck><NCheck checked={false} disabled onChange={() => {}}>This option is disabled</NCheck></div>);};export default Checkbox;
Attributes
| Name | Type | Default | Details |
|---|---|---|---|
| label | string | Required | Label text for the checkbox. |
| isSelected | boolean | false | Whether the checkbox is selected. |
| isDisabled | boolean | false | Whether the checkbox is disabled. |
| onSelectedChange | (selected: boolean) => void | Optional | Callback when checkbox state changes. |
| containerClassName | string | ' ' | You can customise container by passing tailwind classes. |
| labelClassName | string | ' ' | You can customise label by passing tailwind classes. |