GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Getting Started
  • Accordion
  • ion-accordion-group
  • Action Sheet
  • Alert
  • Badge
  • Breadcrumbs
  • ion-breadcrumbs
  • Button
  • ion-ripple-effect
  • Card
  • ion-card-content
  • ion-card-header
  • ion-card-subtitle

This view

  • Original page
  • New address

GeezerVison is showing ionicframework.com — ion-tab-button | Ionic Framework

shadow

A tab button is a UI component that is placed inside of a tab bar. The tab button can specify the layout of the icon and label and connect to a tab view.

Refer to the tabs documentation for more details on configuring tabs.

Usage​

  • Angular
  • Javascript
  • React
  • Vue
<ion-tabs>
<!-- Tab bar -->
<ion-tab-bar slot="bottom">
<ion-tab-button tab="schedule">
<ion-icon name="calendar" aria-hidden="true"></ion-icon>
<ion-label>Schedule</ion-label>
</ion-tab-button>

<ion-tab-button tab="speakers">
<ion-icon name="person-circle" aria-hidden="true"></ion-icon>
<ion-label>Speakers</ion-label>
</ion-tab-button>

<ion-tab-button tab="map">
<ion-icon name="map" aria-hidden="true"></ion-icon>
<ion-label>Map</ion-label>
</ion-tab-button>

<ion-tab-button tab="about">
<ion-icon name="information-circle" aria-hidden="true"></ion-icon>
<ion-label>About</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
<ion-tabs>
<!-- Tab views -->
<ion-tab tab="schedule">
<ion-router-outlet name="schedule"></ion-router-outlet>
</ion-tab>

<ion-tab tab="speakers">
<ion-router-outlet name="speakers"></ion-router-outlet>
</ion-tab>

<ion-tab tab="map">
<ion-router-outlet name="map"></ion-router-outlet>
</ion-tab>

<ion-tab tab="about">
<ion-router-outlet name="about"></ion-router-outlet>
</ion-tab>

<!-- Tab bar -->
<ion-tab-bar slot="bottom">
<ion-tab-button tab="schedule" href="/app/tabs/(schedule:schedule)">
<ion-icon name="calendar" aria-hidden="true"></ion-icon>
<ion-label>Schedule</ion-label>
</ion-tab-button>

<ion-tab-button tab="speakers" href="/app/tabs/(speakers:speakers)">
<ion-icon name="person-circle" aria-hidden="true"></ion-icon>
<ion-label>Speakers</ion-label>
</ion-tab-button>

<ion-tab-button tab="map" href="/app/tabs/(map:map)">
<ion-icon name="map" aria-hidden="true"></ion-icon>
<ion-label>Map</ion-label>
</ion-tab-button>

<ion-tab-button tab="about" href="/app/tabs/(about:about)">
<ion-icon name="information-circle" aria-hidden="true"></ion-icon>
<ion-label>About</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
import React from 'react';
import { IonTabs, IonTabBar, IonTabButton, IonIcon, IonLabel, IonContent } from '@ionic/react';
import { calendar, personCircle, map, informationCircle } from 'ionicons/icons';

export const TabButtonExample: React.FC = () => (
<IonContent>
<IonTabs>
{/*-- Tab bar --*/}
<IonTabBar slot="bottom">
<IonTabButton tab="schedule">
<IonIcon icon={calendar} aria-hidden="true" />
<IonLabel>Schedule</IonLabel>
</IonTabButton>

<IonTabButton tab="speakers">
<IonIcon icon={personCircle} aria-hidden="true" />
<IonLabel>Speakers</IonLabel>
</IonTabButton>

<IonTabButton tab="map">
<IonIcon icon={map} aria-hidden="true" />
<IonLabel>Map</IonLabel>
</IonTabButton>

<IonTabButton tab="about">
<IonIcon icon={informationCircle} aria-hidden="true" />
<IonLabel>About</IonLabel>
</IonTabButton>
</IonTabBar>
</IonTabs>
</IonContent>
);
<template>
<ion-tabs>
<!-- Tab bar -->
<ion-tab-bar slot="bottom">
<ion-tab-button tab="schedule" href="/tabs/schedule">
<ion-icon :icon="calendar" aria-hidden="true"></ion-icon>
<ion-label>Schedule</ion-label>
</ion-tab-button>

<ion-tab-button tab="speakers" href="/tabs/speakers">
<ion-icon :icon="personCircle" aria-hidden="true"></ion-icon>
<ion-label>Speakers</ion-label>
</ion-tab-button>

<ion-tab-button tab="map" href="/tabs/map">
<ion-icon :icon="map" aria-hidden="true"></ion-icon>
<ion-label>Map</ion-label>
</ion-tab-button>

<ion-tab-button tab="about" href="/tabs/about">
<ion-icon :icon="informationCircle" aria-hidden="true"></ion-icon>
<ion-label>About</ion-label>
</ion-tab-button>
</ion-tab-bar>
</ion-tabs>
</template>

<script setup lang="ts">
import { IonIcon, IonLabel, IonTabBar, IonTabButton, IonTabs } from '@ionic/vue';
import { calendar, informationCircle, map, personCircle } from 'ionicons/icons';
</script>

Properties​

disabled​

DescriptionIf true, the user cannot interact with the tab button.
Attributedisabled
Typeboolean
Defaultfalse

download​

DescriptionThis attribute instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file. If the attribute has a value, it is used as the pre-filled file name in the Save prompt (the user can still change the file name if they want).
Attributedownload
Typestring | undefined
Defaultundefined

href​

DescriptionContains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered.
Attributehref
Typestring | undefined
Defaultundefined

layout​

DescriptionSet the layout of the text and icon in the tab bar. It defaults to "icon-top".
Attributelayout
Type"icon-bottom" | "icon-end" | "icon-hide" | "icon-start" | "icon-top" | "label-hide" | undefined
Defaultundefined

mode​

DescriptionThe mode determines which platform styles to use.

This is a virtual property that is set once during initialization and will not update if you change its value after the initial render.
Attributemode
Type"ios" | "md"
Defaultundefined

rel​

DescriptionSpecifies the relationship of the target object to the link object. The value is a space-separated list of link types.
Attributerel
Typestring | undefined
Defaultundefined

selected​

DescriptionThe selected tab component
Attributeselected
Typeboolean
Defaultfalse

tab​

DescriptionA tab id must be provided for each ion-tab. It's used internally to reference the selected tab or by the router to switch between them.
Attributetab
Typestring | undefined
Defaultundefined

target​

DescriptionSpecifies where to display the linked URL. Only applies when an href is provided. Special keywords: "_blank", "_self", "_parent", "_top".
Attributetarget
Typestring | undefined
Defaultundefined

Events​

No events available for this component.

Methods​

No public methods available for this component.

CSS Shadow Parts​

NameDescription
nativeThe native HTML anchor element that wraps all child elements.

CSS Custom Properties​

  • iOS
  • MD
NameDescription
--backgroundBackground of the tab button
--background-focusedBackground of the tab button when focused with the tab key
--background-focused-opacityOpacity of the tab button background when focused with the tab key
--colorColor of the tab button
--color-focusedColor of the tab button when focused with the tab key
--color-selectedColor of the selected tab button
--padding-bottomBottom padding of the tab button
--padding-endRight padding if direction is left-to-right, and left padding if direction is right-to-left of the tab button
--padding-startLeft padding if direction is left-to-right, and right padding if direction is right-to-left of the tab button
--padding-topTop padding of the tab button
--ripple-colorColor of the button ripple effect
NameDescription
--backgroundBackground of the tab button
--background-focusedBackground of the tab button when focused with the tab key
--background-focused-opacityOpacity of the tab button background when focused with the tab key
--colorColor of the tab button
--color-focusedColor of the tab button when focused with the tab key
--color-selectedColor of the selected tab button
--padding-bottomBottom padding of the tab button
--padding-endRight padding if direction is left-to-right, and left padding if direction is right-to-left of the tab button
--padding-startLeft padding if direction is left-to-right, and right padding if direction is right-to-left of the tab button
--padding-topTop padding of the tab button
--ripple-colorColor of the button ripple effect

Slots​

NameDescription
The default slot

Contents

  • Usage
  • Properties
    • disabled
    • download
    • href
    • layout
    • mode
    • rel
    • selected
    • tab
    • target
  • Events
  • Methods
  • CSS Shadow Parts
  • CSS Custom Properties
  • Slots
Edit this page
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.