ToggleButton for Flow
Web Component providing an on/off switch that users can toggle
Usage
Toggle button provides an on/off switch that user can toggle by tapping the switch.
Client-side implementation
From 3.0.0
The client-side is a standard checkbox with a custom css file.
Before 3.0.0
This is the server-side (Java) API for Vaadin Platform for the vcf-toggle-button component. Looking for the client-side version? It can be found here: https://vaadin.com/directory/component/vaadin-component-factoryvcf-toggle-button
License & Author
This Add-on is distributed under Apache 2.0
Component Factory Toggle Button is written by Vaadin Ltd.
Sponsored development
Major pieces of development of this add-on has been sponsored by multiple customers of Vaadin. Read more about Expert on Demand at: Support and Pricing
Sample code
ToggleButton toggle = new ToggleButton(); toggle.setLabel("Label");
ToggleButton disabledToggle = new ToggleButton("Disabled"); disabledToggle.setEnabled(false);
ToggleButton toggle = new ToggleButton("Toggle"); Div message = new Div(); toggle.addValueChangeListener(evt -> message.setText( String.format("Toggle button value changed from '%s' to '%s'", evt.getOldValue(), evt.getValue())));
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Update web component version to 1.0.4 that includes fix that adds aria-label to label span to improve accessibility for screen readers.
- Released
- 2023-05-05
- Maturity
- STABLE
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 14
- Vaadin 24 in 3.0.0
- Vaadin 23 in 3.0.0
- Browser
- Firefox
- Safari
- Google Chrome
- Internet Explorer
- Microsoft Edge