The ui5-toggle-button component is an enhanced ui5-button that can be toggled between pressed and normal states. Users can use the ui5-toggle-button as a switch to turn a setting on or off. It can also be used to represent an independent choice similar to a check box.
Clicking or tapping on a ui5-toggle-button changes its state to pressed. The button returns to its initial state when the user clicks or taps on it again. By applying additional custom CSS-styling classes, apps can give a different style to any ui5-toggle-button.
ES6 Module Import
You can use both properties and attributes with the same effect. The name of each attribute is listed below the name of the property, if different.
Determines whether the component is displayed as pressed.
An object of strings that defines several additional accessibility attribute values for customization depending on the use case.
It supports the following fields:
expanded: Indicates whether the button, or another grouping element it controls, is currently expanded or collapsed. Accepts the following string values:
hasPopup: Indicates the availability and type of interactive popup element, such as menu or dialog, that can be triggered by the button. Accepts the following string values:
controls: Identifies the element (or elements) whose contents or presence are controlled by the button element. Accepts a string value.
Defines the accessible aria name of the component.
Receives id(or many ids) of the elements that label the component.
Defines the component design.
The available values are:
Defines whether the component is disabled. A disabled component can't be pressed or focused, and it is not in the tab chain.
Defines the icon to be displayed as graphical element within the component. The SAP-icons font provides numerous options.
See all the available icons in the Icon Explorer.
Defines whether the icon should be displayed after the component text.
When set to true, the component will automatically submit the nearest form element upon press.
Note: For the submits property to have effect, you must add the following import to your project: import "@ui5/webcomponents/dist/features/InputElementsFormSupport.js";
Defines the tooltip of the component. Note: We recommend setting tooltip to icon-only components.
This Element provides slot(s). This means it can display its child nodes.
Unless targeting the default slot, use the slot attribute to define the destination slot for each child.
Text, along with HTML Elements with no slot attribute, goes the the default slot.
Defines the text of the component.
Note: Although this slot accepts HTML Elements, it is strongly recommended that you only use text in order to preserve the intended design.
This Web Component fires semantic events upon user interaction. You can bind to these events with the standard DOM APIs, such as addEventListener.
Fired when the component is activated either with a mouse/tap or by using the Enter or Space key.
Note: The event will not be fired if the disabled property is set to true.
Theme:Quartz LightQuartz DarkQuartz High Contrast BlackQuartz High Contrast WhiteMorning Horizon (Light)Evening Horizon (Dark)Horizon High Contrast BlackHorizon High Contrast WhiteBelize