Components
Checkbox

Checkbox

The Checkbox component provides you with checkbox components and groups.

Import

import { Checkbox } from '@nostromo/ui-core'
// or
import { Checkbox } from '@nostromo/ui-core/checkbox'

Usage

import { Checkbox, Label } from '@nostromo/ui-core'
 
export default function Example() {
  const [checked, setChecked] = React.useState(false)
  
  return (
    <div className="flex items-center space-x-2">
      <Checkbox 
        id="terms" 
        checked={checked}
        onCheckedChange={setChecked}
      />
      <Label htmlFor="terms">Accept terms</Label>
    </div>
  )
}

Live Examples

Live Example
☀️
Copy
Storybook →
View Code
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> ...

With Label

Live Example
☀️
Copy
Storybook →
View Code
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">...

Props

PropTypeDefaultRequiredDescription
checkedbooleanfalseNoWhether the checkbox is checked (controlled)
defaultCheckedbooleanfalseNoDefault checked state (uncontrolled)
onCheckedChange(checked: boolean) => voidundefinedNoCallback when checked state changes
disabledbooleanfalseNoWhether the checkbox is disabled
requiredbooleanfalseNoWhether the checkbox is required
errorbooleanfalseNoWhether the checkbox is in an error state
labelstringundefinedNoLabel text (alternative to Label component)
helperTextstringundefinedNoHelper text displayed below checkbox
idstringundefinedNoCheckbox ID (auto-generated if not provided)
namestringundefinedNoName for form submission
valuestringundefinedNoValue for form submission
classNamestringundefinedNoAdditional CSS classes

Standard HTML Input Props

The Checkbox component extends all standard HTML input attributes (except size), including:

  • autoFocus, form, formAction, formEncType, formMethod, formNoValidate, formTarget
  • aria-* attributes for accessibility
  • data-* attributes for custom data