Checkbox

A Checkbox component is a UI element that allows users to select or deselect one or more options from a list. It typically appears as a small square that can be checked (ticked) or unchecked. Checkboxes are often used in forms, settings, or filters where multiple selections are needed, and they provide a clear, binary choice for users.
# Demo
# Attributes
NameTypeDefaultDetails
classNamestring' 'You can customise by passing tailwind classes.
labelClassNamestring' 'You can customise by passing tailwind classes.
checkClassNamestring' 'You can customise by passing tailwind classes.
idstringcheckYou can pass id to create unique identifier.
checkedbooleanRequiredYou can pass checked to set default checkbox state.
disabledbooleanfalseYou can pass disabled to set default checkbox state.
childrenstring | ReactNodeRequiredYou can pass checkbox content as children.
onChange(checked: boolean) => voidRequiredYou can get callback when checkbox state changed.
# Usage
import { useState } from 'react'; import { NCheck, NLink } from 'nayan'; const Checkbox = () => { const [checked, setChecked] = useState(true); return ( <NCheck checked={checked} disabled={false} onChange={checked => setChecked(checked)}> Sample label for checkbox. accept <NLink> terms</NLink> </NCheck> ); }; export default Checkbox;