Checkbox
The Checkbox component provides you with checkbox components and groups.
Live Examples
Storybook: components-checkbox--default
Storybook: components-checkbox--variants
Storybook: components-checkbox--form-example
Code Examples
import { Checkbox } from '@nostromo/ui-core'
export default function CheckboxExample() {
return (
<div className="space-y-4">
<div className="flex items-center space-x-2">
<Checkbox id="terms" />
<label htmlFor="terms">Accept terms and conditions</label>
</div>
<div className="flex items-center space-x-2">
<Checkbox id="newsletter" />
<label htmlFor="newsletter">Subscribe to newsletter</label>
</div>
</div>
)
}With Label
import { Checkbox, Label } from '@nostromo/ui-core'
export default function CheckboxWithLabel() {
return (
<div className="space-y-4">
<div className="flex items-center space-x-2">
<Checkbox id="option1" />
<Label htmlFor="option1">Option 1</Label>
</div>
<div className="flex items-center space-x-2">
<Checkbox id="option2" />
<Label htmlFor="option2">Option 2</Label>
</div>
</div>
)
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
checked | boolean | false | Whether checkbox is checked |
disabled | boolean | false | Whether checkbox is disabled |
onCheckedChange | function | - | Change handler |