Checkbox

Some default theming for form-item--checkboxes.

This is a javascript-free implementation that respects keyboard accessibility and has a disabled state.

We also have the theming for a switcher variation of the checkbox included.

Using the switcher variation

Single checkboxes can be used as switchers by setting the variation variable as 'switcher':

$form['switcher'] = [
  '#title' => $this->t('Switcher variation'),
  '#type' => 'checkbox',
  '#variation' => 'switcher',
];

Feel free to use this variable to come up with different variations.

Specifications

Machine name

form-item--checkbox

Built upon

Drupal Core

Perks

Using Sass
Responsive
Accessible

Building blocks

HTML
CSS

Inspired by

Flat design

Stats

Public component
46 downloads
No open issue

Contributors