Fulldev UI

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

By clicking this checkbox, you agree to the terms.

Installation

npx shadcn@latest add @fulldev/checkbox

Usage

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

Checkbox renders a native input type="checkbox" and accepts its attributes, so it submits with a form and works without JavaScript.

Checked State

Use the native checked attribute for the initial state. Read or set input.checked and listen to the native change event to react to changes. Set input.indeterminate = true in a script for the indeterminate state.

Invalid State

Set aria-invalid="true" on the checkbox and data-invalid on the field wrapper to show the invalid styles.

Basic

Pair the checkbox with Field and FieldLabel for proper layout and labeling.

Description

Use FieldContent and FieldDescription for helper text.

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

Disabled

Use the disabled attribute to prevent interaction and add data-disabled to the Field for disabled styles.

Group

Use multiple fields to create a checkbox list.

Show these items on the desktop:

Select the items you want to show on the desktop.

Table

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

RTL

بالنقر على هذا المربع، فإنك توافق على الشروط.

API Reference

Source: src/components/ui/checkbox

Checkbox accepts every input attribute except type, such as checked, disabled, required, name, value and aria-invalid.