Class ToggleButton

All Implemented Interfaces:
AttachNotifier, BlurNotifier<ToggleButton>, DetachNotifier, Focusable<ToggleButton>, FocusNotifier<ToggleButton>, HasAriaLabel, HasElement, HasEnabled, HasHelper, HasLabel, HasSize, HasStyle, HasTheme, HasValidation, HasValue<AbstractField.ComponentValueChangeEvent<ToggleButton,Boolean>,Boolean>, HasValueAndElement<AbstractField.ComponentValueChangeEvent<ToggleButton,Boolean>,Boolean>, HasThemeVariant<ToggleButtonVariant>, HasTooltip, HasValidationProperties, Serializable

@Tag("fc-toggle-button") @JsModule("./fc-toggle-button.js") @CssImport("./styles/fc-toggle-button.css") public class ToggleButton extends AbstractField<ToggleButton,Boolean> implements HasSize, HasLabel, HasAriaLabel, HasTooltip, HasHelper, HasValidationProperties, Focusable<ToggleButton>, HasThemeVariant<ToggleButtonVariant>
A toggle button component built on the core Vaadin Switch, with support for customizable labels and icons on both sides.

The switch itself (value, keyboard, focus, ARIA role and state, read-only and disabled behavior) is provided by an inner Switch. This component adds the field label, the side labels and icons, label highlighting, helper text, error message and theme variants around it. All of them are rendered as regular (light DOM) elements, so the switch can reference them for accessibility and they can be styled from the application.

The field label, helper text, error message and required indicator are implemented here on purpose, even though Switch has its own. The ones in Switch render next to the track, which would place them inside the row, between the side labels and icons. The inner switch is still marked as required (for aria-required) and invalid, and is linked to these elements with aria-labelledby and aria-describedby.

Since:
1.0.0
See Also: