Skip to content

Layout ​

An app screen with a side menu, a top bar and the page content.

Skip to content
Orders

Two orders await payment, and three are on their way.

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 ​

ts
import { NuiAppBar, NuiLayout } from '@numior/kit';

Examples ​

Stretch the top bar across the screen ​

Set header="full".

Skip to content
Store admin

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.

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 footer slot adds a footer: under the menu and the content with header="full", under the content only with header="inset".
  • On screens up to 48rem wide the menu opens over the page in a Drawer. NuiSidebarTrigger opens it, and picking an item closes it.
  • mobileQuery sets 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-gutter line of the content. Over a sidebar with collapsible="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 with px-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.

Props

Name
Type
Default
Description
targetrequired
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

Edit this page

Search

Esc