Components/Checkbox

Checkbox

form

An accessible, customizable checkbox component with support for indeterminate state, custom labels, and keyboard navigation.

1Installation

Install the package:

$npm install piece-ui

Import the component:

tsx
1import { Checkbox } from "piece-ui";

2Usage

Basic usage

tsx
1import { Checkbox } from "piece-ui";
2
3export default function Example() {
4  return (
5    <div className="flex flex-col gap-2">
6      <Checkbox label="I agree to the terms" />
7      <Checkbox label="Subscribe to newsletter" defaultChecked />
8      <Checkbox label="Disabled option" disabled />
9    </div>
10  );
11}

3Props

PropType
checked
boolean
defaultChecked
boolean
onChange
(checked: boolean) => void
disabled
boolean
label
string