Tabs
Tabs for the sections of one screen.
<template> <NuiTabs v-model="tab" class="w-full max-w-md"> <NuiTabList label="Order 20408"> <NuiTab value="items">Items</NuiTab> <NuiTab value="delivery">Delivery</NuiTab> <NuiTab value="history">History</NuiTab> </NuiTabList> <NuiTabPanel value="items">Fjord dresser and Nord table lamp for $368.</NuiTabPanel> <NuiTabPanel value="delivery">By courier in Boston on September 25, noon to 4 PM.</NuiTabPanel> <NuiTabPanel value="history" >Placed on September 23, paid by card, handed to the courier.</NuiTabPanel > </NuiTabs></template><script setup lang="ts">import { ref } from 'vue';import { NuiTab, NuiTabList, NuiTabPanel, NuiTabs } from '@numior/kit';const tab = ref('items');</script>Bind the open tab with v-model: it holds the value of that tab.
Installation
import { NuiTab, NuiTabList, NuiTabPanel, NuiTabs } from '@numior/kit';Usage
Change the look, size and orientation of the tabs and the way arrow keys open them.
- Order 20409, Olga Graham
- Order 20410, Sam Ellis
- Order 20406, Evan Porter
- Order 20407, Mary Cooper
- Order 20408, Paul Hawkins
- Order 20401, Peter Wolfe
- Order 20402, Lena Ortiz
- Order 20403, Tim Sayed
- Order 20405, Glen Nash
<template> <NuiTabs label="Orders by status" v-model="status" :tabs="statuses"> <template #panel="{ tab }"> <ul class="flex flex-col gap-1 text-sm"> <li v-for="order in ordersIn(tab.value)" :key="order.id"> Order {{ order.id }}, {{ order.customer }} </li> </ul> </template> </NuiTabs></template><script setup lang="ts">import { ref } from 'vue';import { NuiTabs, type NuiTabDescriptor } from '@numior/kit';import { orders, type Order } from './orders';const status = ref('shipped');const statuses: NuiTabDescriptor[] = [ { value: 'paid', label: 'Paid' }, { value: 'shipped', label: 'Shipped' }, { value: 'delivered', label: 'Delivered' },];const ordersIn = (value: string): Order[] => orders.filter((order) => order.status === value);</script>export type OrderStatus = 'pending' | 'paid' | 'shipped' | 'delivered' | 'cancelled';export type Payment = 'card' | 'transfer' | 'cash';export type Delivery = 'courier' | 'pickup' | 'post';export interface OrderLine { readonly sku: string; readonly name: string; readonly quantity: number; readonly price: number;}export interface Order { readonly id: number; readonly date: string; readonly customer: string; readonly city: string; readonly status: OrderStatus; readonly payment: Payment; readonly delivery: Delivery; readonly manager: string; readonly total: number; readonly lines: readonly OrderLine[];}export const ORDER_STATUSES: Record<OrderStatus, string> = { pending: 'Awaiting payment', paid: 'Paid', shipped: 'Shipped', delivered: 'Delivered', cancelled: 'Canceled',};export const PAYMENTS: Record<Payment, string> = { card: 'Card', transfer: 'Bank transfer', cash: 'On delivery',};export const DELIVERIES: Record<Delivery, string> = { courier: 'Courier', pickup: 'Pickup', post: 'Mail',};export const orders: readonly Order[] = [ { id: 20401, date: '2026-09-16', customer: 'Peter Wolfe', city: 'Boston', status: 'delivered', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 307, lines: [ { sku: 'S-101', name: 'Oslo armchair', quantity: 1, price: 249 }, { sku: 'X-507', name: 'Linen pillow', quantity: 2, price: 29 }, ], }, { id: 20402, date: '2026-09-17', customer: 'Lena Ortiz', city: 'Chicago', status: 'delivered', payment: 'card', delivery: 'pickup', manager: 'Anna Turner', total: 138, lines: [{ sku: 'L-401', name: 'Nord table lamp', quantity: 2, price: 69 }], }, { id: 20403, date: '2026-09-18', customer: 'Tim Sayed', city: 'Denver', status: 'delivered', payment: 'transfer', delivery: 'courier', manager: 'Maria Kim', total: 507, lines: [ { sku: 'T-201', name: 'Malmo desk', quantity: 1, price: 329 }, { sku: 'S-104', name: 'Bergen chair', quantity: 2, price: 89 }, ], }, { id: 20404, date: '2026-09-19', customer: 'Vera Lane', city: 'Boston', status: 'cancelled', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 180, lines: [{ sku: 'S-110', name: 'Loft stool', quantity: 4, price: 45 }], }, { id: 20405, date: '2026-09-20', customer: 'Glen Nash', city: 'Austin', status: 'delivered', payment: 'cash', delivery: 'post', manager: 'Maria Kim', total: 175, lines: [ { sku: 'X-501', name: 'Wool throw', quantity: 1, price: 59 }, { sku: 'X-507', name: 'Linen pillow', quantity: 4, price: 29 }, ], }, { id: 20406, date: '2026-09-21', customer: 'Evan Porter', city: 'Seattle', status: 'shipped', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 199, lines: [{ sku: 'H-301', name: 'Vik shelving unit', quantity: 1, price: 199 }], }, { id: 20407, date: '2026-09-22', customer: 'Mary Cooper', city: 'Portland', status: 'shipped', payment: 'transfer', delivery: 'post', manager: 'Maria Kim', total: 416, lines: [ { sku: 'L-408', name: 'Arc floor lamp', quantity: 1, price: 119 }, { sku: 'L-412', name: 'Sphere pendant', quantity: 3, price: 99 }, ], }, { id: 20408, date: '2026-09-23', customer: 'Paul Hawkins', city: 'Boston', status: 'shipped', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 368, lines: [ { sku: 'H-305', name: 'Fjord dresser', quantity: 1, price: 299 }, { sku: 'L-401', name: 'Nord table lamp', quantity: 1, price: 69 }, ], }, { id: 20409, date: '2026-09-24', customer: 'Olga Graham', city: 'Chicago', status: 'paid', payment: 'card', delivery: 'pickup', manager: 'Maria Kim', total: 139, lines: [{ sku: 'T-207', name: 'Tromso coffee table', quantity: 1, price: 139 }], }, { id: 20410, date: '2026-09-25', customer: 'Sam Ellis', city: 'Denver', status: 'paid', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 863, lines: [ { sku: 'S-104', name: 'Bergen chair', quantity: 6, price: 89 }, { sku: 'T-201', name: 'Malmo desk', quantity: 1, price: 329 }, ], }, { id: 20411, date: '2026-09-26', customer: 'Nina Hart', city: 'Austin', status: 'pending', payment: 'transfer', delivery: 'courier', manager: 'Maria Kim', total: 498, lines: [{ sku: 'S-101', name: 'Oslo armchair', quantity: 2, price: 249 }], }, { id: 20412, date: '2026-09-27', customer: 'Alina Yusuf', city: 'Portland', status: 'pending', payment: 'card', delivery: 'pickup', manager: 'Anna Turner', total: 187, lines: [ { sku: 'X-501', name: 'Wool throw', quantity: 2, price: 59 }, { sku: 'L-401', name: 'Nord table lamp', quantity: 1, price: 69 }, ], },];Examples
Build tabs from data
Pass a tabs array and render the panels in the panel slot.
- Oslo armchair, 12 in stock
- Bergen chair, 34 in stock
- Loft stool, 0 in stock
- Malmo desk, 7 in stock
- Tromso coffee table, 15 in stock
- Vik shelving unit, 9 in stock
- Fjord dresser, 4 in stock
- Nord table lamp, 41 in stock
- Arc floor lamp, 18 in stock
- Sphere pendant, 22 in stock
- Wool throw, 56 in stock
- Linen pillow, 80 in stock
<template> <NuiTabs v-model="category" :tabs="sections" label="Catalog sections" class="w-full max-w-md"> <template #panel="{ tab }"> <ul class="flex flex-col gap-1 text-sm"> <li v-for="product in productsOf(tab.value)" :key="product.sku"> {{ product.name }}, {{ product.stock }} in stock </li> </ul> </template> </NuiTabs></template><script setup lang="ts">import { ref } from 'vue';import { NuiTabs, type NuiTabDescriptor } from '@numior/kit';import { categories, products, type Product } from './products';const category = ref('lighting');const sections: NuiTabDescriptor[] = categories.map(({ value, label }) => ({ value, label }));const productsOf = (value: string): Product[] => { const kinds = categories.find((entry) => entry.value === value)?.children ?? []; return products.filter((product) => kinds.some((kind) => kind.value === product.category));};</script>export interface Product { readonly sku: string; readonly name: string; readonly category: string; readonly price: number; readonly stock: number;}export interface Category { readonly value: string; readonly label: string; readonly children?: readonly Category[];}export const categories: readonly Category[] = [ { value: 'furniture', label: 'Furniture', children: [ { value: 'seating', label: 'Chairs' }, { value: 'tables', label: 'Tables' }, { value: 'storage', label: 'Storage' }, ], }, { value: 'lighting', label: 'Lighting', children: [ { value: 'lamps', label: 'Lamps' }, { value: 'pendants', label: 'Pendants' }, ], }, { value: 'textile', label: 'Textiles', children: [ { value: 'throws', label: 'Throws' }, { value: 'pillows', label: 'Pillows' }, ], },];export const products: readonly Product[] = [ { sku: 'S-101', name: 'Oslo armchair', category: 'seating', price: 249, stock: 12 }, { sku: 'S-104', name: 'Bergen chair', category: 'seating', price: 89, stock: 34 }, { sku: 'S-110', name: 'Loft stool', category: 'seating', price: 45, stock: 0 }, { sku: 'T-201', name: 'Malmo desk', category: 'tables', price: 329, stock: 7 }, { sku: 'T-207', name: 'Tromso coffee table', category: 'tables', price: 139, stock: 15 }, { sku: 'H-301', name: 'Vik shelving unit', category: 'storage', price: 199, stock: 9 }, { sku: 'H-305', name: 'Fjord dresser', category: 'storage', price: 299, stock: 4 }, { sku: 'L-401', name: 'Nord table lamp', category: 'lamps', price: 69, stock: 41 }, { sku: 'L-408', name: 'Arc floor lamp', category: 'lamps', price: 119, stock: 18 }, { sku: 'L-412', name: 'Sphere pendant', category: 'pendants', price: 99, stock: 22 }, { sku: 'X-501', name: 'Wool throw', category: 'throws', price: 59, stock: 56 }, { sku: 'X-507', name: 'Linen pillow', category: 'pillows', price: 29, stock: 80 },];Without the slot the tabs only switch: v-model gets the chosen tab, and your app decides what to show.
Close tabs
Add closable and remove the tab from your list in the close handler.
<template> <NuiTabs v-if="opened.length > 0" v-model="tab" class="w-full max-w-md"> <NuiTabList label="Open orders"> <NuiTab v-for="order in opened" :key="order.id" :value="String(order.id)" closable @close="close(order.id)" > Order {{ order.id }} </NuiTab> </NuiTabList> <NuiTabPanel v-for="order in opened" :key="order.id" :value="String(order.id)"> {{ order.customer }}, {{ order.city }}, {{ money.format(order.total) }}. </NuiTabPanel> </NuiTabs> <NuiButton v-else variant="outline" tone="neutral" @click="reopen">Reopen the orders</NuiButton></template><script setup lang="ts">import { ref } from 'vue';import { NuiButton, NuiTab, NuiTabList, NuiTabPanel, NuiTabs } from '@numior/kit';import { orders } from './orders';const money = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', maximumFractionDigits: 0,});const shipped = orders.filter((order) => order.status === 'shipped');const first = String(shipped[0]?.id ?? '');const opened = ref([...shipped]);const tab = ref(first);const close = (id: number): void => { const index = opened.value.findIndex((order) => order.id === id); opened.value = opened.value.filter((order) => order.id !== id); if (tab.value !== String(id)) { return; } tab.value = String(opened.value.at(Math.min(index, opened.value.length - 1))?.id ?? '');};const reopen = (): void => { opened.value = [...shipped]; tab.value = first;};</script>export type OrderStatus = 'pending' | 'paid' | 'shipped' | 'delivered' | 'cancelled';export type Payment = 'card' | 'transfer' | 'cash';export type Delivery = 'courier' | 'pickup' | 'post';export interface OrderLine { readonly sku: string; readonly name: string; readonly quantity: number; readonly price: number;}export interface Order { readonly id: number; readonly date: string; readonly customer: string; readonly city: string; readonly status: OrderStatus; readonly payment: Payment; readonly delivery: Delivery; readonly manager: string; readonly total: number; readonly lines: readonly OrderLine[];}export const ORDER_STATUSES: Record<OrderStatus, string> = { pending: 'Awaiting payment', paid: 'Paid', shipped: 'Shipped', delivered: 'Delivered', cancelled: 'Canceled',};export const PAYMENTS: Record<Payment, string> = { card: 'Card', transfer: 'Bank transfer', cash: 'On delivery',};export const DELIVERIES: Record<Delivery, string> = { courier: 'Courier', pickup: 'Pickup', post: 'Mail',};export const orders: readonly Order[] = [ { id: 20401, date: '2026-09-16', customer: 'Peter Wolfe', city: 'Boston', status: 'delivered', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 307, lines: [ { sku: 'S-101', name: 'Oslo armchair', quantity: 1, price: 249 }, { sku: 'X-507', name: 'Linen pillow', quantity: 2, price: 29 }, ], }, { id: 20402, date: '2026-09-17', customer: 'Lena Ortiz', city: 'Chicago', status: 'delivered', payment: 'card', delivery: 'pickup', manager: 'Anna Turner', total: 138, lines: [{ sku: 'L-401', name: 'Nord table lamp', quantity: 2, price: 69 }], }, { id: 20403, date: '2026-09-18', customer: 'Tim Sayed', city: 'Denver', status: 'delivered', payment: 'transfer', delivery: 'courier', manager: 'Maria Kim', total: 507, lines: [ { sku: 'T-201', name: 'Malmo desk', quantity: 1, price: 329 }, { sku: 'S-104', name: 'Bergen chair', quantity: 2, price: 89 }, ], }, { id: 20404, date: '2026-09-19', customer: 'Vera Lane', city: 'Boston', status: 'cancelled', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 180, lines: [{ sku: 'S-110', name: 'Loft stool', quantity: 4, price: 45 }], }, { id: 20405, date: '2026-09-20', customer: 'Glen Nash', city: 'Austin', status: 'delivered', payment: 'cash', delivery: 'post', manager: 'Maria Kim', total: 175, lines: [ { sku: 'X-501', name: 'Wool throw', quantity: 1, price: 59 }, { sku: 'X-507', name: 'Linen pillow', quantity: 4, price: 29 }, ], }, { id: 20406, date: '2026-09-21', customer: 'Evan Porter', city: 'Seattle', status: 'shipped', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 199, lines: [{ sku: 'H-301', name: 'Vik shelving unit', quantity: 1, price: 199 }], }, { id: 20407, date: '2026-09-22', customer: 'Mary Cooper', city: 'Portland', status: 'shipped', payment: 'transfer', delivery: 'post', manager: 'Maria Kim', total: 416, lines: [ { sku: 'L-408', name: 'Arc floor lamp', quantity: 1, price: 119 }, { sku: 'L-412', name: 'Sphere pendant', quantity: 3, price: 99 }, ], }, { id: 20408, date: '2026-09-23', customer: 'Paul Hawkins', city: 'Boston', status: 'shipped', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 368, lines: [ { sku: 'H-305', name: 'Fjord dresser', quantity: 1, price: 299 }, { sku: 'L-401', name: 'Nord table lamp', quantity: 1, price: 69 }, ], }, { id: 20409, date: '2026-09-24', customer: 'Olga Graham', city: 'Chicago', status: 'paid', payment: 'card', delivery: 'pickup', manager: 'Maria Kim', total: 139, lines: [{ sku: 'T-207', name: 'Tromso coffee table', quantity: 1, price: 139 }], }, { id: 20410, date: '2026-09-25', customer: 'Sam Ellis', city: 'Denver', status: 'paid', payment: 'card', delivery: 'courier', manager: 'Anna Turner', total: 863, lines: [ { sku: 'S-104', name: 'Bergen chair', quantity: 6, price: 89 }, { sku: 'T-201', name: 'Malmo desk', quantity: 1, price: 329 }, ], }, { id: 20411, date: '2026-09-26', customer: 'Nina Hart', city: 'Austin', status: 'pending', payment: 'transfer', delivery: 'courier', manager: 'Maria Kim', total: 498, lines: [{ sku: 'S-101', name: 'Oslo armchair', quantity: 2, price: 249 }], }, { id: 20412, date: '2026-09-27', customer: 'Alina Yusuf', city: 'Portland', status: 'pending', payment: 'card', delivery: 'pickup', manager: 'Anna Turner', total: 187, lines: [ { sku: 'X-501', name: 'Wool throw', quantity: 2, price: 59 }, { sku: 'L-401', name: 'Nord table lamp', quantity: 1, price: 69 }, ], },];A tab closes with its button, a middle click or Delete. Tabs from tabs take closable in their descriptor, and NuiTabs then fires close with the value of the tab.
Link tabs to routes
Pass links.
<template> <NuiTabs v-model="page" :links="pages" label="Store sections" class="w-full max-w-md" /></template><script setup lang="ts">import { ref } from 'vue';import { NuiTabs, type NuiTabLinkDescriptor } from '@numior/kit';const page = ref('#tabs-orders');const pages: NuiTabLinkDescriptor[] = [ { to: '#tabs-orders', label: 'Orders' }, { to: '#tabs-customers', label: 'Customers' }, { to: '#tabs-products', label: 'Products' }, { to: '#tabs-reports', label: 'Reports', disabled: true },];</script>Each tab becomes a link to its to and renders like a Link with to. v-model holds the key of the current page: a string to is its own key, and getKey builds one from a route object. A click without modifier keys updates the model.
Behavior
Arrow keys wrap around and skip disabled tabs. Without a v-model value no tab is open.
When the tabs do not fit, the list scrolls with a swipe, the mouse wheel and the arrow buttons at its edges. A button shows up only at the edge that hides tabs. While the list can still scroll in the direction of the wheel, the page does not scroll.
The open tab and the focused tab always scroll into view. A vertical list does not scroll.
Hidden panels stay in the markup. With lazy, a panel renders the first time its tab opens.
The underline and the background follow the open tab when a label changes or tabs come and go. When the focused tab closes, the focus moves to the open one. A disabled tab cannot be closed.
Accessibility
Only the open tab is in the Tab order. Arrow keys open the next tab at once; with activation="manual" they only move the focus, and Enter or Space opens the tab.
A screen reader does not see the close button, because a tab list may hold only tabs. Delete closes the focused tab, as the WAI-ARIA pattern suggests.
A panel takes the focus on Tab, so the user reaches its text from the keyboard. When a panel always starts with a button or a link, remove that stop with :focusable="false".
Tabs from tabs without the panel slot have no panels, so they get no aria-controls.
Link tabs are a nav labeled by label, with plain links in place of tabs. The current page gets aria-current="page". Every link is in the Tab order, and arrow keys do not move between them.
Keys | Action | |
|---|---|---|
→ | Moves to the next tab in a row. | |
← | Moves to the previous tab in a row. | |
↓ | Moves to the next tab in a column. | |
↑ | Moves to the previous tab in a column. | |
Home | Moves to the first tab. | |
End | Moves to the last tab. | |
⌦ | Closes a closable tab. | |
↵ | Opens the focused tab when activation is manual. | |
Space | Opens the focused tab when activation is manual. |
API
NuiTabs
Props
Name | Type | Default | Description | |
|---|---|---|---|---|
id | string | — | Id of the tabs. Generated automatically by default. | |
activation | NuiTabsActivation | "automatic" | automatic opens a tab on arrow keys, manual only moves focus until Enter. | |
orientation | NuiTabsOrientation | "horizontal" | Lays out the tabs in a row or a column. | |
variant | NuiTabsVariant | "line" | Style: line underlines the selected tab, soft gives it a background. | |
size | NuiSize | "md" | Changes the size of the tabs: sm, md or lg. The theme density shifts the height of each size. | |
lazy | boolean | false | Renders a panel only when its tab is opened for the first time. | |
tabs | readonly NuiTabDescriptor[] | — | Tabs as an array instead of NuiTabList and NuiTab. | |
links | readonly NuiTabLinkDescriptor[] | — | Link tabs as an array of to, label, icon and disabled. Renders a nav of links instead of a tab list. | |
getKey | NuiTabLinkKey | defaultOptionKey | Key of a link tab from its to. A string address is its own key by default. | |
as | string | Component | — | Link component for links instead of the shared kit helper. | |
label | string | — | Label of the tab list or the navigation for screen readers. |
Models
Name | Type | Default | Description | |
|---|---|---|---|---|
v-model | string | — | value of the selected tab or the key of the current link tab. |
Events
Name | Payload | Description | |
|---|---|---|---|
close | [value: string] | Fires when a tab from tabs is closed, with its value. |
Slots
Name | Slot props | Description | |
|---|---|---|---|
default | any | A NuiTabList and NuiTabPanel panels. | |
panel | NuiTabsPanelSlot | Panel content for a tab from tabs. Receives tab. |
NuiTabList
Props
Name | Type | Default | Description | |
|---|---|---|---|---|
label | string | — | Label of the tab list for screen readers. |
Slots
Name | Slot props | Description | |
|---|---|---|---|
default | {} | NuiTab tabs. |
NuiTab
Props
Name | Type | Default | Description | |
|---|---|---|---|---|
value*required required | string | — | Value of the tab that v-model receives. | |
icon | IconSource | — | Icon before the label, such as settings. | |
disabled | boolean | false | Disables the tab: it stays visible but cannot be opened or closed. | |
closable | boolean | false | Shows a close button. The tab closes with it, the middle mouse button or the Delete key. |
Events
Name | Payload | Description | |
|---|---|---|---|
close | [] | Fires when the tab is closed. Remove it from the list yourself. |
Slots
Name | Slot props | Description | |
|---|---|---|---|
default | {} | Text of the tab. |
NuiTabPanel
Props
Name | Type | Default | Description | |
|---|---|---|---|---|
value*required required | string | — | value of the tab the panel belongs to. | |
lazy | boolean | — | Renders the content only when the panel is opened for the first time. | |
focusable | boolean | true | Makes the panel reachable with Tab. Turn it off when the panel always holds buttons or links. |
Slots
Name | Slot props | Description | |
|---|---|---|---|
default | {} | Content of the panel. |