Skip to main content
ninna-ui

Checkbox

Checkbox component for boolean selection with support for indeterminate state, labels, and multiple sizes.

import { Checkbox } from "@ninna-ui/forms"
pnpm add @ninna-ui/forms

Requires @ninna-ui/core (auto-installed) + CSS setup.

View source

Usage

Import and use the Checkbox component in your application.

import { Checkbox } from "@ninna-ui/forms";
export default function Example() {
return (
<Checkbox label="Accept terms and conditions" />
);
}

Basic

Basic checkbox with label.

Variants

Checkbox supports outline, soft, and solid variants.

Sizes

Checkbox comes in 3 sizes: sm, md, and lg.

Colors

Checkbox supports multiple color themes.

Label Position

Position the label on either side of the checkbox.

Custom Icon

Use custom icons for the checked state.

Indeterminate

Checkbox with indeterminate state for partial selection.

States

Checkbox in different states: unchecked, checked, indeterminate, and disabled.

With Description

Checkbox with label and description text.

Receive emails about new products, features, and more.
Get notified about security updates and alerts.

React Hook Form

Checkbox works with React Hook Form using the Controller pattern. Use Field wrapper for error messages.

API Reference

Complete list of props for the Checkbox component.

Props

PropTypeDefaultDescription
size'sm' | 'md' | 'lg''md'Size of the checkbox
color'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'danger''primary'Color theme of the checkbox
variant'outline' | 'soft' | 'solid''outline'Visual variant of the checkbox
checkedboolean-Controlled checked state
defaultCheckedboolean-Default checked state for uncontrolled usage
onCheckedChange(checked: boolean) => void-Callback when checked state changes
labelReactNode-Label text for the checkbox
descriptionReactNode-Description text below the label
labelPosition'start' | 'end''end'Position of the label relative to checkbox
invalidbooleanfalseWhether the checkbox is in an invalid state
iconReactNode-Custom icon for checked state
indeterminateIconReactNode-Custom icon for indeterminate state
disabledbooleanfalseWhether the checkbox is disabled
requiredbooleanfalseWhether the checkbox is required

Accessibility

  • Built on Radix UI Checkbox for full accessibility
  • Proper focus states with visible outlines
  • Supports keyboard navigation (Space to toggle)
  • Labels are properly associated with checkboxes via htmlFor
  • Indeterminate state uses aria-checked="mixed" for screen readers