Skip to content

Navigation

Gets people to the part of Silkware they need and tells them where they are.

Navigation answers two questions at every moment: where am I, and where else can I go. This page decides which structure to use for each size of product, how the current place is marked, and what happens to the structure on a phone.

The patterns here are built only from Silkware components. Copy a block into your project with the registry, then change the destinations and the sample data.

The problem

A mid-market company runs production, purchasing, quality and sales in one product. People move between those areas many times a day, and most of them do not know the product's structure by heart. Navigation has to be predictable: the same places in the same position on every page, the current page always marked, and a way back from anywhere.

Anatomy

PartComponentJob
Primary navigationSidebar or Navigation MenuThe areas of the product, always reachable.
LocationBreadcrumbWhere the current page sits, and a way up.
Section switchTabsViews of the same object on one page.
Small-screen menuSheetHolds the primary navigation below 768px in the top navigation.
AccountDropdown Menu with an AvatarProfile, preferences and sign out.
State of an entryState squareThe single crimson square marks the entry that waits on a person.

Blocks

Application shell

navigation-01 is a collapsible sidebar with grouped destinations, a header with a sidebar toggle, a breadcrumb and a notification button, and an account menu at the foot of the sidebar. Pressing a destination changes the page title, the breadcrumb and the list in the content area.

Open in a new tab

Choose it for products people stay in all day, with six or more destinations that fall into groups. The sidebar collapses to icons on a wide screen and becomes a sheet below 768px.

Top navigation

navigation-02 is a header with the logo, a navigation menu with one mega-menu entry, a search button and an account menu. The page below it uses line tabs to switch between orders, suppliers, deliveries and contracts. Below 768px the menu becomes a button that opens a sheet.

Open in a new tab

Choose it for products with four or five top-level areas, or when pages need the full width for content. It suits portals and tools that people open for a task and close again.

Behaviour

States

  • Current: the current destination has a tone step behind it and aria-current="page". Never mark it with colour alone.
  • Hover and focus: a tone step on hover, the system focus ring on keyboard focus.
  • Waiting: a count or one crimson state square, never both. A screen shows at most one crimson element.
  • Collapsed: in the icon sidebar, each icon keeps its label as a tooltip.

Responsive behaviour

WidthApplication shellTop navigation
1280px and widerFull sidebar, 16rem wide, with every label. Collapses to icons with the toggle.Full navigation menu in the header.
768px to 1279pxSame as above. Collapse the sidebar if the content needs the room.Navigation menu stays in the header.
Below 768pxThe sidebar becomes a sheet that opens from the left. The breadcrumb keeps only the current page.The menu becomes a button that opens a sheet. Tabs scroll sideways inside their own row.
320pxSame as below 768px. Page content runs full width with a 16px margin.Same as below 768px. The company name is hidden and only the symbol stays.

Keyboard and focus

KeyAction
TabMoves focus to the skip link, then through the header and navigation in reading order.
CtrlBToggles the sidebar. On macOS use Command and B.
EnterFollows the focused link, or opens the focused menu.
Arrow DownMoves to the next entry inside an open menu.
Arrow RightMoves to the next tab when a tab is focused.
EscCloses the open menu or sheet and returns focus to its trigger.

When a sheet opens, focus moves inside it and stays there until it closes. Pressing a link in the sheet closes it, so the next page starts with focus at the top.

On a phone

navigation-01 puts max-md:touch-controls on the sidebar header, content and footer: below 768px the sidebar is a sheet a finger works through, and above it the desktop density stays. The top bar takes pointer-coarse:touch-controls. navigation-02 puts plain touch-controls on the menu sheet, which only exists in the phone layout, and pointer-coarse:touch-controls on the header, its account menu and the section tabs. See Sizing.

Accessibility

  • Give every navigation landmark a label: Main for the primary navigation, breadcrumb for the trail, and a name for each tab list.
  • Put a skip link first in the page so keyboard users can jump past the navigation to the content.
  • Mark the current page with aria-current="page". The breadcrumb component marks its last item for you.
  • A button that shows only an icon needs an aria-label. A count beside a label needs a text equivalent, such as "2 waiting", for screen readers.
  • The destination name is the accessible name. Do not repeat the group name in each label.

Content

  • Name destinations with nouns that people already use: Orders, Suppliers, Deliveries. Avoid verbs and avoid product jargon.
  • Keep labels to one or two words, in sentence case.
  • Order destinations by how often they are used, not alphabetically. Put Settings last.
  • Use at most seven destinations per group and two groups before you reconsider the structure.

The breadcrumb hides its earlier items on a phone and keeps the current page, so the trail never wraps.

Do and don't

Orders
Do

Name each tab after the thing it shows, so all tabs are views of the same object.

Create an order
Don’t

Don’t mix actions, exports and settings into a tab row. Tabs switch views, they do not run tasks.

Install

Add a block with the registry. The block brings the components it needs.

pnpm dlx shadcn@latest add @silkware/navigation-01
pnpm dlx shadcn@latest add @silkware/navigation-02