For the complete documentation index, see llms.txt. Markdown variants are available by appending .md to any URL or sending an Accept: text/markdown header. An agent skill is available at /.well-known/agent-skills/site-skill.md.
43
Sponsor

Checkbox

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

import { Checkbox } from "@/components/ui/checkbox";

export function CheckboxDemo() {
  return (
    <label style={{ alignItems: "center", display: "flex", gap: 8 }}>
      <Checkbox defaultChecked />

Installation

$ pnpm dlx shadcn@latest add https://shadcn-cssinjs.com/r/checkbox.json

Usage

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

Examples

Basic

import { Checkbox } from "@/components/ui/checkbox";
import {
  Field,
  FieldGroup,
  FieldLabel,
} from "@/components/ui/field";

Description

By clicking this checkbox, you agree to the terms and conditions.

import { Checkbox } from "@/components/ui/checkbox";
import {
  Field,
  FieldContent,
  FieldDescription,
  FieldGroup,

Disabled

import { Checkbox } from "@/components/ui/checkbox";
import {
  Field,
  FieldGroup,
  FieldLabel,
} from "@/components/ui/field";

Group

Show these items on the desktop:

Select the items you want to show on the desktop.

import { Checkbox } from "@/components/ui/checkbox";
import {
  Field,
  FieldDescription,
  FieldGroup,
  FieldLabel,

Table

NameEmailRole
Sarah Chensarah.chen@example.comAdmin
Marcus Rodriguezmarcus.rodriguez@example.comUser
Priya Patelpriya.patel@example.comUser
David Kimdavid.kim@example.comEditor
"use client";

import { useState } from "react";

import { Checkbox } from "@/components/ui/checkbox";
import {

RTL

To enable right-to-left support, see the RTL guide.

"use client";

import { useTranslation } from "@/components/language-selector";
import type { Translations } from "@/components/language-selector";
import { Checkbox } from "@/components/ui/checkbox";

API Reference

See the Base UI documentation for the full API.