Navigation / Tabs

Navigation

Tabs

A row of views of one thing, the active one underlined in accent: page tabs across a screen, or section tabs inside a card.

import { EcoTabs } from "vue-ecosphere"

Page tabs

The screen's main views. Arrow keys, Home and End move between tabs; only the tab where acting is possible takes the filled notification count. A row wider than its container scrolls sideways instead of wrapping or widening the page.

Showing the Open requests.

Section tabs

Two to four short sections inside a card or a drawer.

3 new replies since your last visit.

No counts

Links to views, with icons and a panel

When each view is worth a URL, give every tab an href: the row becomes nav.tabs with aria-current, and the browser history does the rest.

Account
Northwind Logistics
Since
March 2019
Region
North America

Through the router

With vue-router installed, give every tab a `to`: each renders an anchor with the resolved href and navigates without a page load, and the tab of the current route is current, through back and forward too. Modifier-clicks still open a new tab. Render the view with RouterView under the row.

API

NameTypeDefaultDescription
itemsEcoTabItem[]—{ key, label, count?, notify?, icon?, href?, to?, disabled? }. notify renders the count as badge--notification (one tab per row at most). to is a vue-router destination: the tab renders through RouterLink and is current while its route is active (a nested view below it included); a string falls back to a plain link without the router.
v-modelstringfirst tabKey of the active tab.
size"page" | "section""section"page → tabs--page for the screen's main views; section tabs share the width equally.
labelstring—Accessible name of the row.
#panel-<key> / #panelslot—Content in tabpanel under the row, 16px clear of the rule.
@change(key: string) => void—Fires when the active tab changes.