Switch Button

An interactive UI element that represents a particular boolean function.

Published Last updated: 5.1.0 Change log Github NPM
Twig Usage
Twig
{% include '@bolt-components-switch-button/switch-button.twig' with {
  label: 'This is the label for the switch button'
} only %}
Schema Note: when assigning component props as HTML attributes on a web component, make sure to use kebab-case.
Prop Name Description Type Default Value Option(s)
attributes

A Drupal attributes object. Applies extra HTML attributes to this component's parent container.

object
button_attributes

A Drupal attributes object. Applies extra HTML attributes to this component's <button> element.

object
label *

Render a label in front of the switch button.

any
on

Controls the active state of the switch button. Sets button state to "on" by default.

boolean false
Install Install
Bash
npm install @bolt/components-switch-button
Dependencies @bolt/core-v3.x