By clicking this checkbox, you agree to the terms.
Installation
Section titled “Installation”pnpm dlx shadcn@latest add pxl-ui/registry/checkbox
Install the following dependencies:
pnpm add @base-ui/react
Copy and paste the following code into your project.
Update the import paths to match your project setup.
import { Checkbox } from "@/components/ui/pxl/checkbox"<Checkbox />Checked State
Section titled “Checked State”Use defaultChecked for uncontrolled checkboxes, or checked and
onCheckedChange to control the state.
import { useState } from "react"
export function Example() { const [checked, setChecked] = useState(false)
return <Checkbox checked={checked} onCheckedChange={setChecked} />}Invalid State
Section titled “Invalid State”Set aria-invalid on the checkbox and data-invalid on the field wrapper to
show the invalid styles.
Pair the checkbox with Field and FieldLabel for proper layout and labeling.
Description
Section titled “Description”Use FieldContent and FieldDescription for helper text.
Disabled
Section titled “Disabled”Use the disabled prop to prevent interaction and add the data-disabled attribute to the <Field> component for disabled styles.
Use multiple fields to create a checkbox list.
API Reference
Section titled “API Reference”See the Base UI documentation for more information.