Mushilu-San UI

Search components

PlaygroundStorybookGitHub
Mobile

Mobile navigation

A fixed bottom bar of three to five destinations, with badges for new items.

Selector: mui-mobile-nav

Import
import { MobileNav, MobileNavItem } from '@mushilu-san/ui/mobile';
PreviewCode

Loading example…

Overview

Mobile nav is a nav landmark with mui-mobile-nav-item links. activeItem is a two-way model holding the value of the current item, which gets aria-current="page".

badge shows a count on an item.

When to use

  • The three to five main sections of a phone app.
  • Sections a user switches between often.

When not to use

  • More than five destinations. Use a sidebar or a menu. Use Sidebar instead.
  • Sections of one page. Use tabs. Use Tabs instead.

Guidelines

Do

  • Pair every icon with a short text label.
  • Show a badge only for items that need attention.

Don't

  • Do not hide the bar when the user scrolls down.

Accessibility

Roles and attributes

ElementRoleNotes
hostnavigationLabelled "Main navigation".
itemlinkaria-current="page" on the active item. Badge counts are part of the name.

Keyboard

KeysAction
TabShiftTabMoves between the items.
EnterSpaceOpens the focused item.
  • Each item needs a visible label. Icons alone are not enough.

API

MobileNav

Selector: mui-mobile-nav

NameTypeDefaultDescription
activeItemstring'' Two-way binding for the currently active item value.

CSS parts

  • ::part(bar)
  • ::part(root)

MobileNavItem

Selector: mui-mobile-nav-item

NameTypeDefaultDescription
valuerequiredstring— Unique value identifying this destination.
labelrequiredstring— Visible label text shown beneath the icon.
badgenumber0 Optional badge count. A value > 0 shows a numeric badge; -1 shows a dot badge.

CSS parts

  • ::part(badge)
  • ::part(button)
  • ::part(icon)
  • ::part(item)
  • ::part(label)

Tokens

  • --mui-color-surface-raised
  • --mui-color-border
  • --mui-color-primary
  • --mui-color-danger
  • --mui-touch-target