Checkbox component overview
Every checkbox must have a visible label. Checkboxes that belong to the same decision should be grouped under a shared descriptive heading.
When to use
Use checkboxes when
- People can select one, many, or none from a set of options
- A setting or preference needs a simple on or off choice
- A form needs explicit confirmation, such as accepting terms
Do not use checkboxes when
- The user must choose exactly one option from a list
- An action should happen immediately instead of storing a selected state
- The label is so long or ambiguous that the yes-or-no meaning becomes unclear
Patterns
Anatomy
Checkbox component anatomy
Design guidelines
Use checkbox labels and grouping patterns that make the selected state easy to understand before people interact with the control.1
Start with the key meaning
Labels should start with the important words so people can scan the list quickly.
2
Group related choices
Checkboxes that belong to one decision or category should share a heading or fieldset.
3
Use indeterminate as a summary
Reserve the indeterminate state for parent checkboxes that represent a partially selected group.
If users must choose exactly one option, use Radio instead of adapting a checkbox pattern to a single-select task.
Usage
Default
Use the default checkbox for a straightforward binary choice with a short label.Long label
Use a longer label when people need more context before deciding, but keep the core meaning easy to scan at the beginning of the sentence.Options
Allowed states: unchecked (default),checked, indeterminate. Setting indeterminate sets checked to false, and a user toggle clears indeterminate.
Background on hover
Usebackground-on-hover when the surrounding layout benefits from a larger perceived hit area and stronger hover feedback.
Checked and disabled
Usechecked for a preselected default, and disabled when the option is currently unavailable or not editable in the current context.
Indeterminate group
Use the indeterminate state when a parent checkbox controls a related set of child options and only some of them are selected.Form integration
bq-checkbox participates in native forms. A checked checkbox submits "on" for its name; an unchecked checkbox is omitted from FormData. Use required for consent or confirmation choices that must be selected before submission.
The live preview runs in an iframe sandbox that does not allow native form submission. Its Submit button uses
type="button" and bqClick to validate the form and display FormData without submitting it. The copyable examples use native type="submit" buttons for normal application forms.Best practices
DoWrite checkbox labels as clear statements, not questions, so people understand the resulting selected state.
Don’tDo not use checkboxes when users must choose only one option. Use Radio instead.
DoAlign long labels from the top so wrapped text stays visually connected to the checkbox control.
Don’tDo not center long wrapped labels vertically against the control, because that weakens scanability.
DoGroup related checkboxes under a shared heading when they belong to the same decision.
Don’tDo not rely on unchecked-by-default choices to imply consent when legal or high-stakes confirmation is required.
DoUse the indeterminate state only when it accurately summarizes a partially selected group of child options.
Don’tDo not present indeterminate as a standalone third choice, because it is only meaningful as a group summary.
Accessibility
- Built-in native checkbox semantics — the component uses a native
<input type="checkbox">, so checked, unchecked, disabled, and required states follow standard browser and assistive technology behavior. - Built-in label association — the internal input and the slotted text are wrapped in the same
<label>, so clicking the label toggles the checkbox without extra wiring. - Built-in focus support — the shadow root delegates focus to the native input, and the component emits
bqFocusandbqBlurwhen that input gains or loses focus. - Group related choices semantically — when multiple checkboxes form a set, they should share a heading or a
<fieldset>with an accessible label. - Use indeterminate carefully — it should summarize a partial group selection and must not replace clear child options.
- Do not rely on color alone — the checked mark, focus treatment, and label text together must communicate meaning; color must not be the only cue.
Keyboard interaction
Rules
API reference
Properties
Invalid combinations
Events
Methods
Slots
Shadow parts
CSS custom properties
Resources
Interactive playground
Explore checkbox examples and states in Storybook
Source code
View the component source on GitHub