メインコンテンツまでスキップ
バージョン: v7

ion-title

shadow

Title is a text component that sets the title for a toolbar. It can be used to describe the screen or section a user is currently on or the app being used.

Basic

Collapsible Large Titles

The large title will display when the content is scrolled to the start of the scroll container. When the title is scrolled behind the header, the condensed title will fade in.

備考

This feature is only available for iOS.

Collapsible Buttons

The buttons component can be used with the collapse property to additionally display in the header as the toolbar is collapsed.

Accessibility

Headings

When creating headings, we typically recommend using semantic heading elements (h1-h6). However, there may be instances where you need to update Title to be treated as a particular heading by assistive technologies. For example, if you have a Title at the top of a view, you may want this to be considered a level 1 heading.

To achieve this, developers should use the heading role on Title. This will indicate to assistive technologies that Title is a type of heading. From there, developers should use the aria-level attribute to set the heading level.

For example, if we wanted to make a Title behave like an h1 element, we would set role="heading" and aria-level="1" on the Title.

Since multiple Title elements can be used on a view in conjunction with semantic heading elements, Ionic does not automatically set the Title's role or aria-level. It is the responsibility of the developer to handle this.

Theming

The collapsible large title should appear seamless in relation to the rest of your content. This means that the background color of the toolbar containing the collapsible large title should always match the background color of the content.

By default, the toolbar that contains the standard title is hidden using opacity: 0 and is progressively shown as you collapse the large title by scrolling. As a result, the background color that you see behind the standard title is actually the background color of the content.

You can change the background color of the toolbar with the standard title by setting the --background CSS variable. This will give the effect of the header changing color as you collapse the large title.

When styling the text color of the large title, you should target the large title globally as opposed to within the context of a particular page or tab, otherwise its styles will not be applied during the navigation animation.

CSS Custom Properties

Properties

color

DescriptionThe color to use from your application's color palette. Default options are: "primary", "secondary", "tertiary", "success", "warning", "danger", "light", "medium", and "dark". For more information on colors, see theming.
Attributecolor
Type"danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string | undefined
Defaultundefined

size

DescriptionThe size of the toolbar title.
Attributesize
Type"large" | "small" | undefined
Defaultundefined

Events

No events available for this component.

Methods

No public methods available for this component.

CSS Shadow Parts

No CSS shadow parts available for this component.

CSS Custom Properties

NameDescription
--colorText color of the title

Slots

No slots available for this component.