Floating nav

Floating nav is a pill of destinations that floats above the bottom of a phone screen. The current item stretches to show its name, and the bar can step out of the way while people read. It's the nav on this site when you open it on a phone.

Today
Golden section
Seed heads
Pixel rabbits
Floating navTap an item. The fill slides over and the item opens up to show its name.

Examples

Liquid glass

variant="glass" draws the bar as liquid glass. A lightly frosted, tinted layer and a bright rim work in every browser. In Chromium the page behind the rim also bends, through an SVG displacement filter sized to the bar; Safari and Firefox keep the blur and rim. The current item sits under a glass lens that overshoots a little as it lands, and the bar swells a touch under a finger.

Pressing the bar lifts the lens off it, the way iOS does as you change tabs: it grows past the bar's edges, clears, and magnifies the item beneath with a fringe of colour at its rim, then travels to the new item and settles back into its tint. In Safari and Firefox it lifts and clears without the magnifying. With reduced motion it stays put.

The glass bar doesn't clip, so the lens can lift past it, which also means it can't scroll sideways the way the default bar does when its items outgrow the screen. Keep a glass bar to items that fit, or switch to size="sm" on narrow screens.

Library

The golden section turns up in seed heads, shells and the spiral of a rabbit population, each term the sum of the two before.

Liquid glassPress and hold an item, then let go on another. The lens lifts, travels and settles.

Labels and size

Today
Golden section
Seed heads
Pixel rabbits
Labels always shownEvery label under its icon, like a tab bar. Use it when the icons alone wouldn't say where they go.
Today
Golden section
Seed heads
Pixel rabbits
Compact36px items and 16px icons, for a bar that takes less of the screen. It's the size this site uses.

Text items

Leave out an item's icon and it shows its label as text, always. Use it when there are only two or three places and their names say more than icons.

Today
Golden section
Seed heads
Pixel rabbits
Three places, named rather than drawn.

Static

position="static" keeps the bar in the flow, for a toolbar at the foot of a card or a preview like this one.

In the flow, with Explore current.

With your router

Items with an href render as links. onValueChange hands over the click, so an app can call event.preventDefault() and route it itself.

SearchLinks route through the app's own router, so the page never reloads.
Tap an item. The page title follows without a reload.

Anatomy

A nav landmark holding a pill. Each item is a link or a button, with an icon, a label and, on the current one, the fill behind it. A text item has no icon.

Today
Golden section
Seed heads
Pixel rabbits
The barFloating over a feed, with Home current.

Guidelines

  • 01Use it for the three to five places people move between most on a phone. Everything else belongs in a menu.
  • 02Keep labels to one short word. The current label has to fit beside its icon on a 320px screen.
  • 03Turn on hideOnScroll for reading surfaces such as articles and docs. Leave it off where people switch places often.
  • 04Pad the bottom of the page by the bar's height, about 6rem, so the last content can scroll clear of it.
  • 05Hide it at desktop widths, where a sidebar or top bar already does the job.

Best practices

DoKeep it to a handful of places with one-word names.
Don'tDon't fill it with every section. Past five, icons alone stop saying where they go.

Accessibility

Every item is a plain link or button in tab order, so the bar works from the keyboard without anything to learn.

KeyDoes
TabDoesMoves between the items
↵DoesGoes to the item's destination
SpaceDoesGoes to the destination of a button item
  • 01The root is a nav landmark, named Main unless you pass aria-label. Name it when a page has more than one.
  • 02The current item carries aria-current="page" when it's a link, or aria-current="true" when it's a button. Hidden labels stay in the DOM, so every item keeps its name.
  • 03A hidden bar takes no taps or clicks, so it can't catch one meant for the page beneath. Its items stay in the tab order, and tabbing into it brings it back.
  • 04Glass shows the page through it, so its labels' contrast depends on what scrolls beneath. Use it over images and media, and the default bar over dense text.
  • 05Every item is at least 44px square, or 36px with size="sm", well above the 24px minimum target.
  • 06With reduced motion, the indicator and the bar move without animating.

References