nav-tab-button
Contents
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.
See the tabs documentation for more details on configuring tabs.
Usage
- Javascript
 - React
 - Rindo
 - Kdu
 
<nav-tabs>
  <!-- Tab views -->
  <nav-tab tab="schedule">
    <nav-router-outlet name="schedule"></nav-router-outlet>
  </nav-tab>
  <nav-tab tab="speakers">
    <nav-router-outlet name="speakers"></nav-router-outlet>
  </nav-tab>
  <nav-tab tab="map">
    <nav-router-outlet name="map"></nav-router-outlet>
  </nav-tab>
  <nav-tab tab="about">
    <nav-router-outlet name="about"></nav-router-outlet>
  </nav-tab>
  <!-- Tab bar -->
  <nav-tab-bar slot="bottom">
    <nav-tab-button tab="schedule" href="/app/tabs/(schedule:schedule)">
      <nav-icon name="calendar" aria-hidden="true"></nav-icon>
      <nav-label>Schedule</nav-label>
    </nav-tab-button>
    <nav-tab-button tab="speakers" href="/app/tabs/(speakers:speakers)">
      <nav-icon name="person-circle" aria-hidden="true"></nav-icon>
      <nav-label>Speakers</nav-label>
    </nav-tab-button>
    <nav-tab-button tab="map" href="/app/tabs/(map:map)">
      <nav-icon name="map" aria-hidden="true"></nav-icon>
      <nav-label>Map</nav-label>
    </nav-tab-button>
    <nav-tab-button tab="about" href="/app/tabs/(about:about)">
      <nav-icon name="information-circle" aria-hidden="true"></nav-icon>
      <nav-label>About</nav-label>
    </nav-tab-button>
  </nav-tab-bar>
</nav-tabs>
import React from 'react';
import { NavTabs, NavTabBar, NavTabButton, NavIcon, NavLabel, NavContent } from '@navify/react';
import { calendar, personCircle, map, informationCircle } from 'navicons/icons';
export const TabButtonExample: React.FC = () => (
  <NavContent>
    <NavTabs>
      {/*-- Tab bar --*/}
      <NavTabBar slot="bottom">
        <NavTabButton tab="schedule">
          <NavIcon icon={calendar} aria-hidden="true" />
          <NavLabel>Schedule</NavLabel>
        </NavTabButton>
        <NavTabButton tab="speakers">
          <NavIcon icon={personCircle} aria-hidden="true" />
          <NavLabel>Speakers</NavLabel>
        </NavTabButton>
        <NavTabButton tab="map">
          <NavIcon icon={map} aria-hidden="true" />
          <NavLabel>Map</NavLabel>
        </NavTabButton>
        <NavTabButton tab="about">
          <NavIcon icon={informationCircle} aria-hidden="true" />
          <NavLabel>About</NavLabel>
        </NavTabButton>
      </NavTabBar>
    </NavTabs>
  </NavContent>
);
import { Component, h } from '@rindo/core';
@Component({
  tag: 'tab-button-example',
  styleUrl: 'tab-button-example.css'
})
export class TabButtonExample {
  render() {
    return [
      <nav-tabs>
        {/* Tab views */}
        <nav-tab tab="schedule">
          <nav-router-outlet name="schedule"></nav-router-outlet>
        </nav-tab>
        <nav-tab tab="speakers">
          <nav-router-outlet name="speakers"></nav-router-outlet>
        </nav-tab>
        <nav-tab tab="map">
          <nav-router-outlet name="map"></nav-router-outlet>
        </nav-tab>
        <nav-tab tab="about">
          <nav-router-outlet name="about"></nav-router-outlet>
        </nav-tab>
        {/* Tab bar */}
        <nav-tab-bar slot="bottom">
          <nav-tab-button tab="schedule" href="/app/tabs/(schedule:schedule)">
            <nav-icon name="calendar" aria-hidden="true"></nav-icon>
            <nav-label>Schedule</nav-label>
          </nav-tab-button>
          <nav-tab-button tab="speakers" href="/app/tabs/(speakers:speakers)">
            <nav-icon name="person-circle" aria-hidden="true"></nav-icon>
            <nav-label>Speakers</nav-label>
          </nav-tab-button>
          <nav-tab-button tab="map" href="/app/tabs/(map:map)">
            <nav-icon name="map" aria-hidden="true"></nav-icon>
            <nav-label>Map</nav-label>
          </nav-tab-button>
          <nav-tab-button tab="about" href="/app/tabs/(about:about)">
            <nav-icon name="information-circle" aria-hidden="true"></nav-icon>
            <nav-label>About</nav-label>
          </nav-tab-button>
        </nav-tab-bar>
      </nav-tabs>
    ];
  }
}
<template>
  <nav-tabs>
    <!-- Tab bar -->
    <nav-tab-bar slot="bottom">
      <nav-tab-button tab="schedule" href="/tabs/schedule">
        <nav-icon :icon="calendar" aria-hidden="true"></nav-icon>
        <nav-label>Schedule</nav-label>
      </nav-tab-button>
      <nav-tab-button tab="speakers" href="/tabs/speakers">
        <nav-icon :icon="person-circle" aria-hidden="true"></nav-icon>
        <nav-label>Speakers</nav-label>
      </nav-tab-button>
      <nav-tab-button tab="map" href="/tabs/map">
        <nav-icon :icon="map" aria-hidden="true"></nav-icon>
        <nav-label>Map</nav-label>
      </nav-tab-button>
      <nav-tab-button tab="about" href="/tabs/about">
        <nav-icon :icon="informationCircle" aria-hidden="true"></nav-icon>
        <nav-label>About</nav-label>
      </nav-tab-button>
    </nav-tab-bar>
  </nav-tabs>
</template>
<script>
import { 
  NavIcon, 
  NavLabel, 
  NavTabBar, 
  NavTabButton, 
  NavTabs
} from '@navify/kdu';
import { calendar, informationCircle, map, personCircle } from 'navicons/icons';
import { defineComponent } from 'kdu';
export default defineComponent({
  components: {
    NavIcon, 
    NavLabel, 
    NavTabBar, 
    NavTabButton, 
    NavTabs
  },
  setup() {
    return { calendar, informationCircle, map, personCircle }
  }
});
</script>
Properties
disabled
| Description | If true, the user cannot interact with the tab button. | 
| Attribute | disabled | 
| Type | boolean | 
| Default | false | 
download
| Description | This 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). | 
| Attribute | download | 
| Type | string ๏ฝ undefined | 
| Default | undefined | 
href
| Description | Contains a URL or a URL fragment that the hyperlink points to. If this property is set, an anchor tag will be rendered. | 
| Attribute | href | 
| Type | string ๏ฝ undefined | 
| Default | undefined | 
layout
| Description | Set the layout of the text and icon in the tab bar. It defaults to 'icon-top'. | 
| Attribute | layout | 
| Type | "icon-bottom" ๏ฝ "icon-end" ๏ฝ "icon-hide" ๏ฝ "icon-start" ๏ฝ "icon-top" ๏ฝ "label-hide" ๏ฝ undefined | 
| Default | undefined | 
mode
| Description | The mode determines which platform styles to use. | 
| Attribute | mode | 
| Type | "ios" ๏ฝ "md" | 
| Default | undefined | 
rel
| Description | Specifies the relationship of the target object to the link object. The value is a space-separated list of link types. | 
| Attribute | rel | 
| Type | string ๏ฝ undefined | 
| Default | undefined | 
selected
| Description | The selected tab component | 
| Attribute | selected | 
| Type | boolean | 
| Default | false | 
tab
| Description | A tab id must be provided for each nav-tab. It's used internally to reference the selected tab or by the router to switch between them. | 
| Attribute | tab | 
| Type | string ๏ฝ undefined | 
| Default | undefined | 
target
| Description | Specifies where to display the linked URL. Only applies when an href is provided. Special keywords: "_blank", "_self", "_parent", "_top". | 
| Attribute | target | 
| Type | string ๏ฝ undefined | 
| Default | undefined | 
Events
No events available for this component.
Methods
No public methods available for this component.
CSS Shadow Parts
| Name | Description | 
|---|---|
native | The native HTML anchor element that wraps all child elements. | 
CSS Custom Properties
| Name | Description | 
|---|---|
--background | Background of the tab button | 
--background-focused | Background of the tab button when focused with the tab key | 
--background-focused-opacity | Opacity of the tab button background when focused with the tab key | 
--color | Color of the tab button | 
--color-focused | Color of the tab button when focused with the tab key | 
--color-selected | Color of the selected tab button | 
--padding-bottom | Bottom padding of the tab button | 
--padding-end | Right padding if direction is left-to-right, and left padding if direction is right-to-left of the tab button | 
--padding-start | Left padding if direction is left-to-right, and right padding if direction is right-to-left of the tab button | 
--padding-top | Top padding of the tab button | 
--ripple-color | Color of the button ripple effect | 
Slots
No slots available for this component.