ion-tabs
タブは、タブベースのナビゲーションを実装するためのトップレベルのナビゲーションコンポーネントです。 このコンポーネントは、個々のTabコンポーネントのコンテナである。
ion-tabs コンポーネントはスタイルを持たず、ナビゲーションを処理するためのルータアウトレットとして動作します。また、UI フィードバックやタブを切り替えるための機構は提供しない。タブを切り替えるには、ion-tabs の直接の子として ion-tab-bar を用意しなければなりません。
ion-tabs と ion-tab-bar はどちらもスタンドアロンな要素として利用することができます。これ らは互いに依存せずに動作しますが、通常は、ネイティブアプリのように動作するタブベースのナビゲーションを実装するために一緒に使用します。
ion-tab-bar は、ion-tabs コンポーネントの適切な場所に投影するために、スロットを定義する必要があります。
Basic Usage
タブは、URLを変更することなく、異なるコンテンツを表示するために使用することができます。これは、タブをナビゲーションのために使用するのではなく、異なるコンテンツを表示するために使用する場合に便利です。
ルーターとの併用
タブをIonicルーターで使用すると、タブベースのナビゲーションを実装できます。タブバーとアクティブタブはURLに基づいて自動的に解決されます。これはタブナビゲーションの最も一般的なパターンです。
Programmatically Selecting Tabs
タブはselectメソッドを使用してプログラムで選択できます。これは、ボタンのクリックに応答したり、フォームを完了した後など、アプリケーションロジックからタブの変更をトリガーする必要がある場合に便利です。次の例では、ボタンを使用してselectメソッドを呼び出し、別のタブにナビゲートする方法を示しています。
Interfaces
TabsCustomEvent
必須ではありませんが、このコンポーネントから発行される Ionic イベントでより強く型付けを行うために、CustomEvent インターフェースの代わりにこのインターフェースを使用することが可能です。
interface TabsCustomEvent extends CustomEvent {
detail: { tab: string };
target: HTMLIonTabsElement;
}
プロパティ
No properties available for this component.
イベント
| Name | Description | Bubbles |
|---|---|---|
ionTabsDidChange | Emitted when the navigation has finished transitioning to a new component. | false |
ionTabsWillChange | Emitted when the navigation is about to transition to a new component. | false |
メソッド
getSelected
| Description | Get the currently selected tab. This method is only available for vanilla JavaScript projects. The Angular, React, and Vue implementations of tabs are coupled to each framework's router. |
| Signature | getSelected() => Promise<string | undefined> |
getTab
| Description | Get a specific tab by the value of its tab property or an element reference. This method is only available for vanilla JavaScript projects. The Angular, React, and Vue implementations of tabs are coupled to each framework's router. |
| Signature | getTab(tab: string | HTMLIonTabElement) => Promise<HTMLIonTabElement | undefined> |
| Parameters | tab: The tab instance to select. If passed a string, it should be the value of the tab's tab property. |
select
| Description | Select a tab by the value of its tab property or an element reference. This method is only available for vanilla JavaScript projects. The Angular, React, and Vue implementations of tabs are coupled to each framework's router. |
| Signature | select(tab: string | HTMLIonTabElement) => Promise<boolean> |
| Parameters | tab: The tab instance to select. If passed a string, it should be the value of the tab's tab property. |
CSS Shadow Parts
No CSS shadow parts available for this component.
CSSカスタムプロパティ
No CSS custom properties available for this component.
Slots
| Name | 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. |