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

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