class sap.m.Title

Control sample: sap.m.Title
Visiblity: public
UX Guidelines: Title
Implements: sap.ui.core.IShrinkablesap.m.IHyphenation
Available since: N/A
Module: sap/m/Title
Application Component: CA-UI5-CTR

A simple, large-sized text with explicit header / title semantics.

Overview

The Title control is a simple, large-sized text containing additional semantic information for accessibility purposes.

As of version 1.52, you can truncate or wrap long titles if the screen is narrower than the full title by using the with the use of the wrapping property.

As of version 1.60, you can hyphenate the label's text with the use of the wrappingType property. For more information, see Text Controls Hyphenation.

As of version 1.87, you can set the content aggregation to use sap.m.Link or any control that implements sap.ui.core.ITitleContent interface. This control will be rendered instead of the text placed in text property. In this case the following properties of sap.m.Title control are overridden: text, textAlign, textDirection, or not used: wrapping, wrappingType. The title association will be ignored too.

If the title association is used, text, level and tooltip properties will override the corresponding properties of the sap.m.Title control.

Usage

When to use

When not to use


Constructor

Constructor for a new Title control.

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.m.Title(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
level sap.ui.core.TitleLevel Auto

Defines the semantic level of the title. This information is e.g. used by assistive technologies like screenreaders to create a hierarchical site map for faster navigation. Depending on this setting either an HTML h1-h6 element is used or when using level Auto no explicit level information is written (HTML5 header element). This property does not influence the style of the control. Use the property titleStyle for this purpose instead.

Note: this property will be overridden if there is title element associated and it has level property set.

Visibility: public
text string

Defines the text that should be displayed as a title.

Note: this property is not used if there is a control added to the content aggregation Note: this property will be overridden if there is title element associated and it has text property set.

Visibility: public
textAlign sap.ui.core.TextAlign Initial

Defines the alignment of the text within the title. Note: This property only has an effect if the overall width of the title control is larger than the displayed text.

Note: this property will be overridden if there is a control added to the content aggregation

Visibility: public
textDirection sap.ui.core.TextDirection Inherit

Options for the text direction are RTL and LTR. Alternatively, the control can inherit the text direction from its parent container.

Note: this property will be overridden if there is a control added to the content aggregation

Visibility: public
titleStyle sap.ui.core.TitleLevel Auto

Defines the style of the title. When using the Auto styling, the appearance of the title depends on the current position of the title (e.g. inside a Toolbar). This default behavior can be overridden by setting a different style explicitly. The actual appearance of the title and the different styles always depends on the theme being used.

Visibility: public
width sap.ui.core.CSSSize

Defines the width of the title.

Visibility: public
wrapping boolean false

Enables text wrapping.

Note: Wrapping must only be activated if the surrounding container allows flexible heights. Note: this property will be ignored if there is a control added to the content aggregation

Since: 1.52.

Visibility: public
wrappingType sap.m.WrappingType Normal

Defines the type of text wrapping to be used (hyphenated or normal).

Note: This property takes effect only when the wrapping property is set to true. Note: this property will be ignored if there is a control added to the content aggregation

Since: 1.60.

Visibility: public

Aggregations

Default Aggregation: content

Name Cardinality Type Description
content (default) 0..1 sap.ui.core.ITitleContent

Holds a control that implements sap.ui.core.ITitleContent and renders this control instead of simple text

Note: if a control is placed in this aggregation, the following properties of sap.m.Title will be overridden - text, textAlign, textDirection; the following will be ignored - wrapping, wrappingType. The title association will be ignored too.

Since: 1.87.


Associations

Name Cardinality Type Description
title 0..1 sap.ui.core.Title

Defines a relationship to a generic title description.

Note: if a control is placed in content aggregation, the title element associated will be ignored; otherwise the properties text, level and tooltip (text only) of this element will override the corresponding properties of the Title control.


Methods Overview

Method Description
destroyContent

Destroys the content in the aggregation content.

sap.m.Title.extend

Creates a new subclass of class sap.m.Title 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.core.Control.extend.

getAccessibilityInfo

Gets the accessibility information for the sap.m.Title control.

References:

  • sap.ui.core.Control#getAccessibilityInfo

getContent

Gets content of aggregation content.

Holds a control that implements sap.ui.core.ITitleContent and renders this control instead of simple text

Note: if a control is placed in this aggregation, the following properties of sap.m.Title will be overridden - text, textAlign, textDirection; the following will be ignored - wrapping, wrappingType. The title association will be ignored too.

getLevel

Gets current value of property level.

Defines the semantic level of the title. This information is e.g. used by assistive technologies like screenreaders to create a hierarchical site map for faster navigation. Depending on this setting either an HTML h1-h6 element is used or when using level Auto no explicit level information is written (HTML5 header element). This property does not influence the style of the control. Use the property titleStyle for this purpose instead.

Note: this property will be overridden if there is title element associated and it has level property set.

Default value is Auto.

sap.m.Title.getMetadata

Returns a metadata object for class sap.m.Title.

getText

Gets current value of property text.

Defines the text that should be displayed as a title.

Note: this property is not used if there is a control added to the content aggregation Note: this property will be overridden if there is title element associated and it has text property set.

getTextAlign

Gets current value of property textAlign.

Defines the alignment of the text within the title. Note: This property only has an effect if the overall width of the title control is larger than the displayed text.

Note: this property will be overridden if there is a control added to the content aggregation

Default value is Initial.

getTextDirection

Gets current value of property textDirection.

Options for the text direction are RTL and LTR. Alternatively, the control can inherit the text direction from its parent container.

Note: this property will be overridden if there is a control added to the content aggregation

Default value is Inherit.

getTitle

ID of the element which is the current target of the association title, or null.

getTitleStyle

Gets current value of property titleStyle.

Defines the style of the title. When using the Auto styling, the appearance of the title depends on the current position of the title (e.g. inside a Toolbar). This default behavior can be overridden by setting a different style explicitly. The actual appearance of the title and the different styles always depends on the theme being used.

Default value is Auto.

getWidth

Gets current value of property width.

Defines the width of the title.

getWrapping

Gets current value of property wrapping.

Enables text wrapping.

Note: Wrapping must only be activated if the surrounding container allows flexible heights. Note: this property will be ignored if there is a control added to the content aggregation

Default value is false.

getWrappingType

Gets current value of property wrappingType.

Defines the type of text wrapping to be used (hyphenated or normal).

Note: This property takes effect only when the wrapping property is set to true. Note: this property will be ignored if there is a control added to the content aggregation

Default value is Normal.

setContent

Sets the aggregated content.

setLevel

Sets a new value for property level.

Defines the semantic level of the title. This information is e.g. used by assistive technologies like screenreaders to create a hierarchical site map for faster navigation. Depending on this setting either an HTML h1-h6 element is used or when using level Auto no explicit level information is written (HTML5 header element). This property does not influence the style of the control. Use the property titleStyle for this purpose instead.

Note: this property will be overridden if there is title element associated and it has level property set.

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

Default value is Auto.

setText

Sets a new value for property text.

Defines the text that should be displayed as a title.

Note: this property is not used if there is a control added to the content aggregation Note: this property will be overridden if there is title element associated and it has text property set.

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

setTextAlign

Sets a new value for property textAlign.

Defines the alignment of the text within the title. Note: This property only has an effect if the overall width of the title control is larger than the displayed text.

Note: this property will be overridden if there is a control added to the content aggregation

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

Default value is Initial.

setTextDirection

Sets a new value for property textDirection.

Options for the text direction are RTL and LTR. Alternatively, the control can inherit the text direction from its parent container.

Note: this property will be overridden if there is a control added to the content aggregation

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

Default value is Inherit.

setTitle

Sets the title for a sap.m.Title or sap.ui.core.Title

setTitleStyle

Sets a new value for property titleStyle.

Defines the style of the title. When using the Auto styling, the appearance of the title depends on the current position of the title (e.g. inside a Toolbar). This default behavior can be overridden by setting a different style explicitly. The actual appearance of the title and the different styles always depends on the theme being used.

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

Default value is Auto.

setWidth

Sets a new value for property width.

Defines the width of the title.

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

setWrapping

Sets a new value for property wrapping.

Enables text wrapping.

Note: Wrapping must only be activated if the surrounding container allows flexible heights. Note: this property will be ignored if there is a control added to the content aggregation

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

Default value is false.

setWrappingType

Sets a new value for property wrappingType.

Defines the type of text wrapping to be used (hyphenated or normal).

Note: This property takes effect only when the wrapping property is set to true. Note: this property will be ignored if there is a control added to the content aggregation

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

Default value is Normal.

destroyContent

Destroys the content in the aggregation content.

sap.m.Title.extend

Creates a new subclass of class sap.m.Title 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.core.Control.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

Gets the accessibility information for the sap.m.Title control.

References:

getContent

Gets content of aggregation content.

Holds a control that implements sap.ui.core.ITitleContent and renders this control instead of simple text

Note: if a control is placed in this aggregation, the following properties of sap.m.Title will be overridden - text, textAlign, textDirection; the following will be ignored - wrapping, wrappingType. The title association will be ignored too.

getLevel

Gets current value of property level.

Defines the semantic level of the title. This information is e.g. used by assistive technologies like screenreaders to create a hierarchical site map for faster navigation. Depending on this setting either an HTML h1-h6 element is used or when using level Auto no explicit level information is written (HTML5 header element). This property does not influence the style of the control. Use the property titleStyle for this purpose instead.

Note: this property will be overridden if there is title element associated and it has level property set.

Default value is Auto.

sap.m.Title.getMetadata

Returns a metadata object for class sap.m.Title.

getText

Gets current value of property text.

Defines the text that should be displayed as a title.

Note: this property is not used if there is a control added to the content aggregation Note: this property will be overridden if there is title element associated and it has text property set.

getTextAlign

Gets current value of property textAlign.

Defines the alignment of the text within the title. Note: This property only has an effect if the overall width of the title control is larger than the displayed text.

Note: this property will be overridden if there is a control added to the content aggregation

Default value is Initial.

getTextDirection

Gets current value of property textDirection.

Options for the text direction are RTL and LTR. Alternatively, the control can inherit the text direction from its parent container.

Note: this property will be overridden if there is a control added to the content aggregation

Default value is Inherit.

getTitle

ID of the element which is the current target of the association title, or null.

getTitleStyle

Gets current value of property titleStyle.

Defines the style of the title. When using the Auto styling, the appearance of the title depends on the current position of the title (e.g. inside a Toolbar). This default behavior can be overridden by setting a different style explicitly. The actual appearance of the title and the different styles always depends on the theme being used.

Default value is Auto.

getWidth

Gets current value of property width.

Defines the width of the title.

getWrapping

Gets current value of property wrapping.

Enables text wrapping.

Note: Wrapping must only be activated if the surrounding container allows flexible heights. Note: this property will be ignored if there is a control added to the content aggregation

Default value is false.

getWrappingType

Gets current value of property wrappingType.

Defines the type of text wrapping to be used (hyphenated or normal).

Note: This property takes effect only when the wrapping property is set to true. Note: this property will be ignored if there is a control added to the content aggregation

Default value is Normal.

setContent

Sets the aggregated content.

Param Type DefaultValue Description
oContent sap.ui.core.ITitleContent

The content to set

setLevel

Sets a new value for property level.

Defines the semantic level of the title. This information is e.g. used by assistive technologies like screenreaders to create a hierarchical site map for faster navigation. Depending on this setting either an HTML h1-h6 element is used or when using level Auto no explicit level information is written (HTML5 header element). This property does not influence the style of the control. Use the property titleStyle for this purpose instead.

Note: this property will be overridden if there is title element associated and it has level property set.

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

Default value is Auto.

Param Type DefaultValue Description
sLevel sap.ui.core.TitleLevel Auto

New value for property level

setText

Sets a new value for property text.

Defines the text that should be displayed as a title.

Note: this property is not used if there is a control added to the content aggregation Note: this property will be overridden if there is title element associated and it has text property set.

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

Param Type DefaultValue Description
sText string

New value for property text

setTextAlign

Sets a new value for property textAlign.

Defines the alignment of the text within the title. Note: This property only has an effect if the overall width of the title control is larger than the displayed text.

Note: this property will be overridden if there is a control added to the content aggregation

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

Default value is Initial.

Param Type DefaultValue Description
sTextAlign sap.ui.core.TextAlign Initial

New value for property textAlign

setTextDirection

Sets a new value for property textDirection.

Options for the text direction are RTL and LTR. Alternatively, the control can inherit the text direction from its parent container.

Note: this property will be overridden if there is a control added to the content aggregation

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

Default value is Inherit.

Param Type DefaultValue Description
sTextDirection sap.ui.core.TextDirection Inherit

New value for property textDirection

setTitle

Sets the title for a sap.m.Title or sap.ui.core.Title

Param Type DefaultValue Description
vTitle sap.m.Title sap.ui.core.Title

Given variant of the a title which can be sap.m.Title or sap.ui.core.Title.

setTitleStyle

Sets a new value for property titleStyle.

Defines the style of the title. When using the Auto styling, the appearance of the title depends on the current position of the title (e.g. inside a Toolbar). This default behavior can be overridden by setting a different style explicitly. The actual appearance of the title and the different styles always depends on the theme being used.

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

Default value is Auto.

Param Type DefaultValue Description
sTitleStyle sap.ui.core.TitleLevel Auto

New value for property titleStyle

setWidth

Sets a new value for property width.

Defines the width of the title.

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

Param Type DefaultValue Description
sWidth sap.ui.core.CSSSize

New value for property width

setWrapping

Sets a new value for property wrapping.

Enables text wrapping.

Note: Wrapping must only be activated if the surrounding container allows flexible heights. Note: this property will be ignored if there is a control added to the content aggregation

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
bWrapping boolean false

New value for property wrapping

setWrappingType

Sets a new value for property wrappingType.

Defines the type of text wrapping to be used (hyphenated or normal).

Note: This property takes effect only when the wrapping property is set to true. Note: this property will be ignored if there is a control added to the content aggregation

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

Default value is Normal.

Param Type DefaultValue Description
sWrappingType sap.m.WrappingType Normal

New value for property wrappingType