class sap.ui.commons.ToggleButton

Visiblity: public
UX Guidelines:
Implements:
Available since: N/A
Module: sap/ui/commons/ToggleButton
Application Component: CA-UI5-CTR

The ToggleButton Control is a Button that can be toggled between pressed and normal state


Constructor

Constructor for a new ToggleButton.

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

new sap.ui.commons.ToggleButton(sId?, mSettings?)
Param Type Default Value Description
sId? string

id for the new control, generated automatically if no id is given

mSettings? object

initial settings for the new control


Properties

Name Type Default Value Description
pressed boolean false

The property is “true” when the control is toggled. The default state of this property is "false".

Visibility: public

Borrowed Properties

Name Type Default Value Description
enabled boolean true

Boolean property to enable the control (default is true). Buttons that are disabled have other colors than enabled ones, depending on custom settings.

Visibility: public
height sap.ui.core.CSSSize

Specifies the button height. If this property is set, the height which is specified by the underlying theme is not used any longer.

Visibility: public
helpId string empty string

Unique identifier used for help service

Visibility: public
icon sap.ui.core.URI empty string

Icon to be displayed as graphical element within the button. This can be a URI to an image or an icon font URI.

Visibility: public
iconFirst boolean true

If set to true (default), the display sequence is 1. icon 2. control text .

Visibility: public
iconHovered sap.ui.core.URI empty string

Icon to be displayed as graphical element within the button when it is hovered (only if also a base icon was specified). If not specified the base icon is used. If an icon font icon is used, this property is ignored.

Visibility: public
iconSelected sap.ui.core.URI empty string

Icon to be displayed as graphical element within the button when it is selected (only if also a base icon was specified). If not specified the base or hovered icon is used. If an icon font icon is used, this property is ignored.

Visibility: public
lite boolean false

The button is rendered as lite button.

Visibility: public
style sap.ui.commons.ButtonStyle Default

Style of the button. (e.g. emphasized)

Visibility: public
styled boolean true

Indicates if the button is styled. If not it is rendered as native HTML-button. In this case a custom styling can be added usig addStyleClass.

Visibility: public
text string empty string

Button text displayed at runtime.

Visibility: public
width sap.ui.core.CSSSize

Control width as common CSS-size (px or % as unit, for example)

Visibility: public

Methods Overview

Method Description
sap.ui.commons.ToggleButton.extend

Creates a new subclass of class sap.ui.commons.ToggleButton with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.commons.Button.extend.

getAccessibilityInfo

References:

  • sap.ui.core.Control#getAccessibilityInfo

sap.ui.commons.ToggleButton.getMetadata

Returns a metadata object for class sap.ui.commons.ToggleButton.

getPressed

Gets current value of property pressed.

The property is “true” when the control is toggled. The default state of this property is "false".

Default value is false.

setPressed

Sets a new value for property pressed.

The property is “true” when the control is toggled. The default state of this property is "false".

When called with a value of null or undefined, the default value of the property will be restored.

Default value is false.

sap.ui.commons.ToggleButton.extend

Creates a new subclass of class sap.ui.commons.ToggleButton with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.commons.Button.extend.

Param Type DefaultValue Description
sClassName string

Name of the class being created

oClassInfo object

Object literal with information about the class

FNMetaImpl function

Constructor function for the metadata object; if not given, it defaults to the metadata implementation used by this class

getAccessibilityInfo

References:

sap.ui.commons.ToggleButton.getMetadata

Returns a metadata object for class sap.ui.commons.ToggleButton.

getPressed

Gets current value of property pressed.

The property is “true” when the control is toggled. The default state of this property is "false".

Default value is false.

setPressed

Sets a new value for property pressed.

The property is “true” when the control is toggled. The default state of this property is "false".

When called with a value of null or undefined, the default value of the property will be restored.

Default value is false.

Param Type DefaultValue Description
bPressed boolean false

New value for property pressed