Skip to content

Checkbox

Binary or indeterminate selection control.

Installation

bun add @xerobi/ui
import { Checkbox } from "@xerobi/ui/checkbox"

This component is client-side. In Astro, hydrate it with a client directive.

Examples

Default

import { Checkbox } from "@xerobi/ui/checkbox"

export function CheckboxDefault() {
  return (
    <div className="flex items-center gap-2">
      <Checkbox id="bandwidth" defaultChecked />
      <label htmlFor="bandwidth" className="text-body2">Max bandwidth</label>
    </div>
  )
}

Colors

import { Checkbox } from "@xerobi/ui/checkbox"

export function CheckboxColors() {
  return (
    <div className="flex items-center gap-4">
      <Checkbox defaultChecked aria-label="Primary" />
      <Checkbox defaultChecked color="success" aria-label="Success" />
      <Checkbox defaultChecked color="error" aria-label="Error" />
    </div>
  )
}

API reference

Checkbox

Also accepts every prop of Base UI Checkbox.

PropTypeDescription
color"info" | "success" | "warning" | "secondary" | "inherit" | "primary" | "error"

Styling hooks: [data-slot="checkbox"], [data-slot="checkbox-indicator"].

Search documentation

Search pages, components and blocks.