Back to Shark UI

Bottom Navigation

docs/components/bottom-navigation

latest7.9 KB
Original Source

Sections

Components

Utilities

Forms

Hooks

Bottom Navigation

Copy Markdown

Fixed bottom nav for mobile-first apps.

DocsAPI

PreviewCode

HomeSearchNewsProfile

Installation#

CLIManual

pnpmbunnpmyarn

pnpm dlx shadcn@latest add @shark/bottom-navigation

Anatomy#

BottomNavigation
└── BottomNavigationList
    └── BottomNavigationItem
        ├── BottomNavigationItemIcon
        └── BottomNavigationItemLabel

Usage#

import {
  BottomNavigation,
  BottomNavigationList,
  BottomNavigationItem,
  BottomNavigationItemIcon,
  BottomNavigationItemLabel,
} from "@/components/ui/bottom-navigation";
<BottomNavigation defaultValue="home">
  <BottomNavigationList>
    <BottomNavigationItem value="home">
      <BottomNavigationItemIcon>
        <HomeIcon />
      </BottomNavigationItemIcon>
      <BottomNavigationItemLabel>Home</BottomNavigationItemLabel>
    </BottomNavigationItem>
    <BottomNavigationItem value="notifications">
      <BottomNavigationItemIcon>
        <BellIcon />
      </BottomNavigationItemIcon>
      <BottomNavigationItemLabel>Notifications</BottomNavigationItemLabel>
    </BottomNavigationItem>
  </BottomNavigationList>
</BottomNavigation>

Disclaimer#

Don't include position: absolute on the BottomNavigationList. It's just for the examples.

Examples#

Icon only#

Use aria-label on the BottomNavigationItem to give the item a label for screen readers.

PreviewCode

Use the asChild prop on BottomNavigationItem with Link.

PreviewCode

HomeSearchNewsProfile

API Reference#

BottomNavigation#

Root wrapper for the bottom navigation bar.

PropTypeDefault
valuestring-
defaultValuestring-
onValueChange(details: ValueChangeDetails) => void-
classNamestring-
asChildbooleanfalse

BottomNavigationList#

Fixed bar at the bottom. Typically holds nav items.

PropTypeDefault
classNamestring-
asChildbooleanfalse

BottomNavigationItem#

Single navigation link or button.

PropTypeDefault
valuestringrequired
disabledbooleanfalse
classNamestring-
asChildbooleanfalse

BottomNavigationItemIcon#

Holds the item icon.

PropTypeDefault
classNamestring-
asChildbooleanfalse

BottomNavigationItemLabel#

Holds the item label text.

PropTypeDefault
classNamestring-
asChildbooleanfalse

For a complete list of props, see the Ark UI documentation.

[

Previous page

Badge ](/docs/components/badge)[

Next page

Breadcrumb ](/docs/components/breadcrumb)

On This Page

InstallationAnatomyUsageDisclaimerExamplesIcon onlyWith linksAPI ReferenceBottomNavigationBottomNavigationListBottomNavigationItemBottomNavigationItemIconBottomNavigationItemLabel