ToggleButton
The ToggleButton
control is a subclass of the Button
control that has a built-in checked
state. This means the button can be checked or unchecked on click by a user. You may change the styling of controls based on whether ToggleButton
is checked or not by using the :checked
pseudoclass.
Source code
Examples
Speaker Mute Button
This button will show a muted speaker icon or an un-muted speaker icon based on whether the button is checked or unchecked, which the ToggleButton
control toggles between when users click on the button.
The style code above reacts to ToggleButton
's :checked
pseudoclass, so that if the ToggleButton
is checked, any DrawingPresenter
with the class .tbchecked
will be visible, and any DrawingPresenter
with the class .tbunchecked
will not be visible.
最后更新于