ion-tabs
Tabs are a top level navigation component to implement a tab-based navigation. The component is a container of individual Tab components.
The ion-tabs
component does not have any styling and works as a router outlet in order to handle navigation. It does not provide any UI feedback or mechanism to switch between tabs. In order to do so, an ion-tab-bar
should be provided as a direct child of ion-tabs
.
Both ion-tabs
and ion-tab-bar
can be used as standalone elements. They don’t depend on each other to work, but they are usually used together in order to implement a tab-based navigation that behaves like a native app.
The ion-tab-bar
needs a slot defined in order to be projected to the right place in an ion-tabs
component.
#
Usage- ANGULAR
- JAVASCRIPT
- REACT
- STENCIL
- VUE
#
Router integrationWhen used with Angular's router the tab
property of the ion-tab-button
should be a reference to the route path.
#
Activating TabsEach ion-tab-button
will activate one of the tabs when pressed. In order to link the ion-tab-button
to the ion-tab
container, a matching tab
property should be set on each component.
The ion-tab-button
and ion-tab
above are linked by the common tab
property.
The tab
property identifies each tab, and it has to be unique within the ion-tabs
. It's important to always set the tab
property on the ion-tab
and ion-tab-button
, even if one component is not used.
#
Router integrationWhen used with Ionic's router (ion-router
) the tab
property of the ion-tab
matches the component
property of an ion-route
.
The following route within the scope of an ion-tabs
outlet:
will match the following tab:
#
Activating TabsEach ion-tab-button
will activate one of the tabs when pressed. In order to link the ion-tab-button
to the ion-tab
container, a matching tab
property should be set on each component.
The ion-tab-button
and ion-tab
above are linked by the common tab
property.
The tab
property identifies each tab, and it has to be unique within the ion-tabs
. It's important to always set the tab
property on the ion-tab
and ion-tab-button
, even if one component is not used.
#
Router integrationWhen used with Ionic's router (ion-router
) the tab
property of the ion-tab
matches the component
property of an ion-route
.
The following route within the scope of an ion-tabs
outlet:
will match the following tab:
Tabs.vue
Schedule.vue
Speakers.vue
#
EventsName | Description |
---|---|
ionTabsDidChange | Emitted when the navigation has finished transitioning to a new component. |
ionTabsWillChange | Emitted when the navigation is about to transition to a new component. |
#
Methods#
getSelectedDescription | Get the currently selected tab. |
Signature | getSelected() => Promise<string \| undefined> |
#
getTabDescription | Get a specific tab by the value of its tab property or an element reference. |
Signature | getTab(tab: string \| HTMLIonTabElement) => Promise<HTMLIonTabElement \| undefined> |
#
selectDescription | Select a tab by the value of its tab property or an element reference. |
Signature | select(tab: string \| HTMLIonTabElement) => Promise<boolean> |
#
SlotsName | Description |
---|---|
`` | Content is placed between the named slots if provided without a slot. |
bottom | Content is placed at the bottom of the screen. |
top | Content is placed at the top of the screen. |