Skip to content

Checkbox

@hua-labs/ui
v1.1.0

bash
npm install @hua-labs/hua
tsx
import { Checkbox } from "@hua-labs/hua";

:

default
outline
filled
glass

sm
md
lg

variant"default" | "outline" | "filled" | "glass""default"Visual style variant
size"sm" | "md" | "lg""md"Checkbox size
labelstring-Label text displayed next to checkbox
descriptionstring-Additional description below label
errorbooleanfalseError state indicator
successbooleanfalseSuccess state indicator
checkedboolean-Controlled checked state
defaultCheckedboolean-Initial checked state (uncontrolled)
disabledbooleanfalseDisables the checkbox

docs:common.basicUsage
import { Checkbox } from '@hua-labs/hua';

<Checkbox label="I agree to the terms" />
With Description
<Checkbox
  label="Receive newsletter"
  description="Get weekly updates and news"
/>
Controlled
const [checked, setChecked] = useState(false);

<Checkbox
  checked={checked}
  onChange={(e) => setChecked(e.target.checked)}
  label="Enable notifications"
/>

  • aria-checked: Reflects checked state for screen readers
  • aria-invalid: Applied in error state
  • Label Connection: Label is properly connected via htmlFor
  • Keyboard Support: Space key toggles checkbox state