Skip to main content

Introducing Starwind Pro with free access to 35+ Premium Blocks

Checkbox

Installation

Usage

variant

size

disabled

API Reference

Checkbox

An accessible checkbox component with multiple variants and sizes.

PropTypeDefault
idstringRequired
labelstring-
variant"default" | "primary" | "secondary" | "info" | "success" | "warning" | "error""default"
size"sm" | "md" | "lg""md"
classstring-
<Checkbox id="terms" label="Accept terms" variant="default" size="md" />

Additional Notes:

  • id: Unique identifier for the checkbox, used for label association
  • label: Text label displayed next to the checkbox

Changelog

v1.4.1

  • add aria-invalid styling

v1.4.0

  • style and focus state updates

v1.3.0

  • Add a data-slot attribute to all components to enable global styling updates

v1.2.0

  • No longer require an “id” prop
  • Adjust component to use type VariantProps from tailwind-variants. This provides greater type safety and cleans up component frontmatter.

v1.1.0

  • tailwind-variants now implemented. This uses tailwind-merge under the hood to merge Tailwind classes without style conflicts, allowing you to override any existing classes using the “class” prop.