Layout
An app screen with a side menu, a top bar and the page content.
Two orders await payment, and three are on their way.
<template> <div class="w-full h-96 overflow-hidden rounded-lg border"> <NuiLayout v-model:open="open" content-as="div" :shortcut="false" class="h-full"> <template #sidebar> <NuiSidebar collapsible="icon" label="Store sections"> <NuiSidebarContent> <NuiSidebarGroup> <NuiSidebarItem v-for="section in sections" :key="section.key" :label="section.label" :icon="section.icon" :badge="section.badge" :current="active === section.key" @click="active = section.key" /> </NuiSidebarGroup> </NuiSidebarContent> <NuiSidebarFooter> <NuiSidebarGroup> <NuiSidebarItem :label="manager.name" icon="user" /> </NuiSidebarGroup> </NuiSidebarFooter> </NuiSidebar> </template> <template #header> <NuiAppBar> <template #start> <NuiSidebarTrigger /> </template> {{ current.label }} </NuiAppBar> </template> <p class="m-0 px-layout-gutter py-6">{{ current.summary }}</p> </NuiLayout> </div></template><script setup lang="ts">import { computed, ref, type Component } from 'vue';import { ChartColumn, Package, ShoppingCart, Users, Warehouse } from '@lucide/vue';import { NuiAppBar, NuiLayout, NuiSidebar, NuiSidebarContent, NuiSidebarFooter, NuiSidebarGroup, NuiSidebarItem, NuiSidebarTrigger,} from '@numior/kit';import { team } from './team';interface Section { readonly key: string; readonly label: string; readonly icon: Component; readonly summary: string; readonly badge?: number;}const sections: readonly [Section, ...Section[]] = [ { key: 'orders', label: 'Orders', icon: ShoppingCart, summary: 'Two orders await payment, and three are on their way.', badge: 2, }, { key: 'products', label: 'Products', icon: Package, summary: 'Loft stools are sold out, and only four Fjord dressers are left.', }, { key: 'customers', label: 'Customers', icon: Users, summary: 'Peter Wolfe has placed 14 orders, more than anyone else.', }, { key: 'warehouse', label: 'Warehouse', icon: Warehouse, summary: 'Ian Bell is packing orders 20409 and 20410.', }, { key: 'reports', label: 'Reports', icon: ChartColumn, summary: 'The sales report for September is ready.', },];const [manager] = team;const open = ref(true);const active = ref('orders');const current = computed( () => sections.find((section) => section.key === active.value) ?? sections[0],);</script>export interface Employee { readonly id: string; readonly name: string; readonly role: string; readonly email: string;}export const team: readonly [Employee, Employee, Employee, Employee, Employee] = [ { id: 'anna', name: 'Anna Turner', role: 'Order manager', email: 'anna@example.com' }, { id: 'igor', name: 'Ian Bell', role: 'Warehouse', email: 'igor@example.com' }, { id: 'maria', name: 'Maria Kim', role: 'Support', email: 'maria@example.com' }, { id: 'oleg', name: 'Owen Smith', role: 'Purchasing', email: 'oleg@example.com' }, { id: 'dina', name: 'Dina Ahmed', role: 'Marketing', email: 'dina@example.com' },];Put a Sidebar into the sidebar slot and a NuiAppBar into the header slot. v-model:open holds whether the menu is expanded on a wide screen, and v-model:mobileOpen whether it is open on a phone.
Installation
import { NuiAppBar, NuiLayout } from '@numior/kit';Examples
Stretch the top bar across the screen
Set header="full".
Order 20408
Items
Fjord dresser × 1, $299
Nord table lamp × 1, $69
Delivery
Courier, Boston, to Paul Hawkins.
The courier calls an hour before arriving.
Payment
Card, $368.
The receipt went to the customer by email.
History
Placed on September 23, handled by Anna Turner.
<template> <div class="w-full h-96 overflow-hidden rounded-lg border"> <NuiLayout v-model:open="open" content-as="div" header="full" sidebar-width="12rem" end-width="10rem" :shortcut="false" class="h-full" > <template #header> <NuiAppBar> <template #start> <NuiSidebarTrigger /> </template> Store admin </NuiAppBar> </template> <template #sidebar> <NuiSidebar label="Shipped orders"> <NuiSidebarContent> <NuiSidebarGroup label="Shipped"> <NuiSidebarItem v-for="entry in shipped" :key="entry.id" :label="`Order ${entry.id}`" :current="active === entry.id" @click="active = entry.id" /> </NuiSidebarGroup> </NuiSidebarContent> </NuiSidebar> </template> <div ref="article" class="flex h-full flex-col gap-2 overflow-auto p-6" tabindex="0"> <template v-if="order"> <h2 class="m-0 text-lg font-semibold">Order {{ order.id }}</h2> <h3 id="layout-order-items" class="mb-0 mt-3 text-base font-semibold">Items</h3> <p v-for="line in order.lines" :key="line.sku" class="m-0"> {{ line.name }} × {{ line.quantity }}, {{ money.format(line.price * line.quantity) }} </p> <h3 id="layout-order-delivery" class="mb-0 mt-3 text-base font-semibold">Delivery</h3> <p class="m-0"> {{ DELIVERIES[order.delivery] }}, {{ order.city }}, to {{ order.customer }}. </p> <p class="m-0">The courier calls an hour before arriving.</p> <h3 id="layout-order-payment" class="mb-0 mt-3 text-base font-semibold">Payment</h3> <p class="m-0">{{ PAYMENTS[order.payment] }}, {{ money.format(order.total) }}.</p> <p class="m-0">The receipt went to the customer by email.</p> <h3 id="layout-order-history" class="mb-0 mt-3 text-base font-semibold">History</h3> <p class="m-0"> Placed on {{ dayFormat.format(new Date(order.date)) }}, handled by {{ order.manager }}. </p> </template> </div> <template #end> <div class="p-4"> <NuiToc :items="toc" :root="article" title="On this page" /> </div> </template> </NuiLayout> </div></template><script setup lang="ts">import { computed, ref, useTemplateRef } from 'vue';import { NuiAppBar, NuiLayout, NuiSidebar, NuiSidebarContent, NuiSidebarGroup, NuiSidebarItem, NuiSidebarTrigger, NuiToc, type NuiTocItem,} from '@numior/kit';import { DELIVERIES, PAYMENTS, orders } from './orders';const money = new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', maximumFractionDigits: 0,});const dayFormat = new Intl.DateTimeFormat('en-US', { day: 'numeric', month: 'long', timeZone: 'UTC',});const toc: readonly NuiTocItem[] = [ { id: 'layout-order-items', label: 'Items' }, { id: 'layout-order-delivery', label: 'Delivery' }, { id: 'layout-order-payment', label: 'Payment' }, { id: 'layout-order-history', label: 'History' },];const shipped = orders.filter((entry) => entry.status === 'shipped');const article = useTemplateRef<HTMLElement>('article');const open = ref(true);const active = ref(20408);const order = computed(() => shipped.find((entry) => entry.id === active.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 }, ], },];Put a table of contents or other side content into the end slot. Add sticky to keep the menu and that column in place while the page scrolls.
Behavior
- The
footerslot adds a footer: under the menu and the content withheader="full", under the content only withheader="inset". - On screens up to 48rem wide the menu opens over the page in a Drawer.
NuiSidebarTriggeropens it, and picking an item closes it. mobileQuerysets the screen width at which the menu moves into the drawer.- Ctrl+B, or Cmd+B on a Mac, collapses and expands the menu unless the focus is in a text field.
- A top bar beside the menu starts on the
--spacing-layout-gutterline of the content. Over a sidebar withcollapsible="icon", a full top bar centers its button in the icon column and starts the rest on the same line. Give your content the same gutter, for example withpx-layout-gutter.
The server renders the layout of a wide screen, and on a phone the menu stays hidden until scripts load.
Accessibility
By default the content area is a <main> element and the top bar is a <header>. The menu button tells a screen reader whether the menu is open.
The first element on the page is a "Skip to content" link. It shows up only when reached with Tab and moves the focus past the menu to the content. Change its text in skipLabel, or remove it with :skip-link="false" when the page has its own.
Keys | Action | |
|---|---|---|
CtrlB | Collapses and expands the sidebar. ⌘B on Mac. |
API
NuiLayout
Props
Name | Type | Default | Description | |
|---|---|---|---|---|
id | string | — | Base of the sidebar and content area id. Generated when omitted. | |
header | NuiLayoutHeader | "inset" | Where the top bar goes: inset beside the sidebar, full across the full width above it. | |
sidebarWidth | string | "16rem" | Width of the expanded sidebar, such as 16rem. | |
railWidth | string | — | Width of the collapsed sidebar that shows only icons. Defaults to the --spacing-layout-rail token. | |
endWidth | string | "14rem" | Width of the column from the end slot. | |
mobileQuery | string | "(max-width: 48rem)" | Media query at which the sidebar opens over the page, such as (max-width: 48rem). | |
shortcut | boolean | true | Turns on Ctrl+B (⌘B on Mac), which collapses and expands the sidebar. | |
sticky | boolean | false | Pins the columns to the window height. Each one scrolls on its own. | |
contentAs | string | "main" | Tag of the content area. Defaults to main. | |
skipLink | boolean | true | Adds a "Skip to content" link first on the page for keyboard users. | |
skipLabel | string | — | Text of the skip link. Defaults to "Skip to content" from the dictionary. |
Models
Name | Type | Default | Description | |
|---|---|---|---|---|
v-model:open | boolean | true | Whether the sidebar is expanded on a wide screen. | |
v-model:mobileOpen | boolean | false | Whether the sidebar is open on a narrow screen. |
Slots
Name | Slot props | Description | |
|---|---|---|---|
sidebar | any | The NuiSidebar sidebar. | |
header | any | The NuiAppBar top bar. | |
default | any | Page content. | |
end | any | Column after the content, such as a table of contents. | |
footer | any | Footer. With header="full" it spans the full width under the sidebar and the content, with header="inset" it sits under the content. |
NuiAppBar
Props
Name | Type | Default | Description | |
|---|---|---|---|---|
sticky | boolean | true | Keeps the bar at the top of the window while scrolling. |
Slots
Name | Slot props | Description | |
|---|---|---|---|
start | any | Start of the bar: the sidebar button and the logo. | |
default | any | Middle of the bar, such as search. | |
end | any | End of the bar: action buttons and the profile. |
NuiSkipLink
Props
Name | Type | Default | Description | |
|---|---|---|---|---|
target*required required | string | — | id of the element that receives focus, such as main. | |
label | string | — | Link text. Defaults to “Skip to content” from the dictionary. |
Slots
Name | Slot props | Description | |
|---|---|---|---|
default | any | Markup in place of the text. |
Texts
Key | Russian | English | |
|---|---|---|---|
skip | К содержимому | Skip to content |