Back to Shark UI

Checkbox

docs/components/checkbox

latest7.1 KB
Original Source

Sections

Components

Utilities

Forms

Hooks

Checkbox

Copy Markdown

Control for multiple selections in a set.

DocsAPI

PreviewCode

Accept terms and conditions

Receive notifications

You'll receive a notification when someone posts a comment

Receive marketing emails

Installation#

CLIManual

pnpmbunnpmyarn

pnpm dlx shadcn@latest add @shark/checkbox

Usage#

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

Controlled#

Use the checked and onCheckedChange props to control the checkbox state programmatically.

PreviewCode

Accept terms and conditions

States#

Invalid#

Use the invalid prop to indicate an invalid state.

PreviewCode

Accept terms and conditions

Disabled#

Use the disabled prop to disable the checkbox.

PreviewCode

Receive newsletter

Examples#

With Description#

PreviewCode

Receive notifications

You'll receive a notification when someone posts a comment on your post

Indeterminate#

PreviewCode

Select all items

Group#

PreviewCode

Show these items on the desktop:

Select the items you want to show on the desktop.

Hard disks

External disks

CDs, DVDs, and iPods

Connected servers

Card Style#

PreviewCode

Enable notifications

You can enable or disable notifications at any time.

API Reference#

Checkbox#

Checkbox control for boolean or multi-select state.

PropTypeDefault
checked`boolean'indeterminate'`
defaultCheckedbooleanfalse
disabledbooleanfalse
checked`boolean'indeterminate'`
onCheckedChange({ checked }: CheckedChangeDetails) => void-
classNamestring-

CheckboxGroup#

Groups related checkboxes with consistent layout.

PropTypeDefault
valuestring[]-
defaultValuestring[][]
onValueChange(details: ValueChangeDetails) => void-
classNamestring-

For a complete list of props, see the Ark UI documentation.

[

Previous page

Chart ](/docs/components/chart)[

Next page

Circular Progress ](/docs/components/circular-progress)

On This Page

InstallationUsageControlledStatesInvalidDisabledExamplesWith DescriptionIndeterminateGroupCard StyleAPI ReferenceCheckboxCheckboxGroup