Provides standard checkboxes and toggle switches.
The q2-checkbox supports the use of custom content that will be treated as the label of the field.
<q2-checkbox>
  <div>
    <strong>Content can be yielded here</strong>
  </div>
  <div>
    Formatting is <em>flexible</em> with this content and other elements can be placed here, even icons.
    <q2-icon type="search" inline></q2-search-icon>.
  </div>
</q2-checkbox>
The q2-checkbox element has one or more properties that support text localization. Those properties are indicated by the localizable badge in the description.
alignmentDetermine which side of the label the checkbox will render on.
checkedThe state of the checkbox. This modifies the visual appearance of the element.
descriptionPopulates a description that is displayed beneath the label.
disabledDisables the checkbox and prevents interaction.
hasErrorhas-errorDetermines if the component should display in an errant state.
hideLabelhide-labelHide's the field's <label> element from view.
Only use when a visible label is impractical.
indeterminateUsed on a parent checkbox in a checkbox group (e.g. "Select All") to indicate that some, but not all, checkboxes in a group are checked.
When true, the "indeterminate" selection style is applied.
To apply the standard "checked" selection style, checked must be true, and indeterminate must be false.
labelThe visible label text for the checkbox. Appears to the right of the box for 'default' and 'favorite' checkboxes, and to the left for 'toggle' checkboxes. Yielded content will be adjacent to this text.
nameA static string used to establish a symbolic relationship between checkboxes.
readonlyThe field is not interactive, but remains focusable.
slotReadonlyslot-readonlyThe field is not interactive, but remains focusable.
typeThe visual style of the checkbox. This does not need to be defined for a standard checkbox.
valueA static reference value for the checkbox.
The q2-checkbox element exposes events that can be used to send and receive data from the component based on user interaction.
Emitted when the checkbox is toggled.
{ value: string; checked: boolean; }If an event handler is bound to the element using:
onchange property - The default handler will not fire, and the value must be updated in the custom handler.addEventListener("change") method - The default handler will fire alongside the custom handler.This component uses other components in the Tecton library, including:
q2-iconOther components in the Tecton library use this component, including:
q2-data-tableAdd support for ellipcized labels
Initial Release
The following CSS variables are available to override the default theme styles of the q2-checkboxcomponent.
Many Tecton components consume other components to maintain visual and functional consistency. If you are looking for a CSS variable you think should exist but are not seeing it, it may be defined in one of the dependent components below. Either way, if you think it's something we should expose more conveniently, let us know!
There is 1 frequently asked question related to this page.