Checkbox

Checkboxes allow users to select one or more items from a set. Can be used to turn an option on or off.

When To Use

  • Used for selecting multiple values from several options.
  • If you use only one checkbox, it is the same as using Switch to toggle between two states. The difference is that Switch will trigger the state change directly, but Checkbox just marks the state as changed and this needs to be submitted.

Example Usage

Basic usage of checkbox.

Disabled

Disabled checkbox.

States

Checkboxes can have error states and disabled states.

Custom Label and Error with Slots

You can use slots to customize the label and error messages with HTML elements like links.

Property
Description
Type
Default

id

Unique identifier for the input element. An auto-generated string is used if not provided. string auto-generated

label

The label text to display next to the checkbox. string

variant

Controls the visual variant of the checkbox. When the 'error' prop/slot is used, this defaults to 'error'. 'default' | 'error' 'default'

checked

Determines if the checkbox is checked by default. boolean false

class

Additional CSS classes to apply to the root element. string ''

error

Indicates an error state or displays an error message string | boolean

success

Indicates a success state or displays a success message string | boolean

disabled

Disables the component boolean false