Docs
Checkbox Input
Checkbox Input

A flexible checkbox component with labels, descriptions, validation, and Zod integration for forms.

By accepting, you agree to our Terms of Service and Privacy Policy

Required for account creation

Overview

The Checkbox Input component provides accessible, form-ready checkboxes with integrated validation and error handling, making it essential for terms acceptance, preference settings, and multi-select scenarios. It supports both controlled and uncontrolled modes with Zod schema validation, ensuring type-safe form handling while maintaining excellent accessibility standards. Perfect for creating consistent, user-friendly selection interfaces across your application.

Installation

pnpm dlx shadcn@latest add https://deltacomponents.dev/r/checkbox-input.json

Usage

"use client"
 
import { CheckboxInput } from "@/registry/inputs/checkbox-input"
 
export function Component() {
  return (
    <CheckboxInput
      label="Accept Terms"
      name="terms"
      description="I agree to the terms and conditions"
      required
    />
  )
}

API Reference

Props

PropTypeDefaultDescription
labelstring-Label for the checkbox field (required)
namestring-Name of the checkbox field for form submission (required)
descriptionstringundefinedDescription text below the checkbox
hintstringundefinedHint text to display below the checkbox
errorstringundefinedError message to display
requiredbooleanfalseWhether the field is required
pendingbooleanfalseWhether the field is in a loading state
defaultCheckedbooleanfalseDefault checked state (uncontrolled)
checkedbooleanundefinedControlled checked state
disabledbooleanfalseWhether the checkbox is disabled
idstringnameID for the checkbox element
containerClassNamestring""CSS classes for the container
checkboxClassNamestring""CSS classes for the checkbox
labelClassNamestring""CSS classes for the label
labelVariant"default" | "muted""default"Label text styling variant
schemaZodType<boolean>undefinedZod schema for validation
onValidate(isValid: boolean, value: boolean, error?: string) => voidundefinedValidation callback
onCheckedChange(checked: boolean) => voidundefinedCallback when checkbox state changes

Examples