Search

Search documentation

Checkbox

A control that allows the user to toggle between checked and not checked.

Installation

›pnpm dlx shadcn@latest add @evolphin/checkbox

Usage

import { Checkbox } from "@/components/ui/checkbox"
<Checkbox />

Type Definitions

interface CheckboxProps {
  /** The controlled checked state of the checkbox */
  checked?: boolean | "indeterminate";
CheckboxProps.checked?: boolean | "indeterminate" | undefined

The controlled checked state of the checkbox

/** The default checked state when uncontrolled */ ?: boolean | "indeterminate"; /** Event handler called when the checked state changes */ ?: (: boolean | "indeterminate") => void; /** Whether the checkbox is disabled */ ?: boolean; }

Examples

Default

Disabled

API Reference

Checkbox

PropTypeDefaultDescription
checkedboolean | "indeterminate"-The controlled checked state of the checkbox.
defaultCheckedboolean | "indeterminate"-The default checked state when uncontrolled.
onCheckedChange(checked: boolean | "indeterminate") => void-Event handler called when the checked state changes.
disabledbooleanfalseWhether the checkbox is disabled.
requiredbooleanfalseWhether the checkbox is required.
namestring-The name of the checkbox.
valuestring"on"The value of the checkbox.

On this page