Checkbox

Controlled or uncontrolled checkbox with optional label.

Installation

npx @obi/ui add checkbox

Preview

Usage

import { Checkbox } from '@/src/components/Checkbox/Checkbox';

<Checkbox label="Accept terms" />
<Checkbox label="Checked" defaultChecked />
<Checkbox label="Disabled" disabled />

Props

NameTypeDefaultDescription
labelstringundefinedText label rendered next to the checkbox.
idstringundefinedHTML id, links label to input.
checkedbooleanundefinedControlled checked state.
disabledbooleanfalseDisables the checkbox.
onChangeChangeEventHandler<HTMLInputElement>undefinedChange event handler.