UI5-Toggle Button

lightUI5-Toggle Button



Toggle Button has two states like a switch to turn on and off. 


By default state is – off. Press the button.


State is ON. Close the pop up and press the switch again.


State is off.


To make the switch default state as ON. Use attribute Pressed.



Code Snippet:

// Instantiate a Toggle Button
oToggleButton = new sap.ui.commons.ToggleButton({
text: “ON”,
pressed: true,
press: function() {alert(oToggleButton.getPressed());}


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s