TuMarca

Checkbox

A control that allows the user to toggle between checked and not checked.

stable
Tipo: ui
Versión: 1.0.0
forms checkbox form input toggle

Comparación entre la versión Astro (Saastro) y React (shadcn/ui)

🚀 saastro/ui (Astro)
⚛️ shadcn/ui (React)

Installation

Usage

---
import { Checkbox } from "@/components/ui-saastro/checkbox"
import { Label } from "@/components/ui-saastro/label"
---

<div class="flex items-center space-x-2">
  <Checkbox id="terms" />
  <Label for="terms">Accept terms and conditions</Label>
</div>

Examples

Default

<Checkbox />

With Label

<div class="flex items-center space-x-2">
  <Checkbox id="terms" />
  <Label for="terms">Accept terms</Label>
</div>

Checked by Default

<Checkbox checked />

Disabled

<Checkbox disabled />

Props

PropTypeDefaultDescription
checkedbooleanfalseWhether the checkbox is checked
disabledbooleanfalseWhether the checkbox is disabled
classstring-Additional CSS classes

Accessibility

  • Uses native <input type="checkbox"> for built-in accessibility
  • Associate with <Label> using matching id and for attributes
  • Supports keyboard navigation (Space to toggle)
  • Properly conveys checked state to screen readers