Bottom Navigation

A bottom bar whose highlight glides to the selected item, and that can shrink to its icons or slide away while the page scrolls down.

Today

  • SSpotify08:12€10.99
  • FFigma09:30€15.00
  • UUber12:42€6.05
  • NNotion14:05€8.00
  • AAirbnb17:03€256.73
  • VVercel18:21€20.00
  • AApple19:18€2.99
  • DDribbble20:47€52.92
  • NNetflix21:15€13.49
  • LLinear22:02€8.00
"use client"

import * as React from "react"
import {
  BottomNavigation,
  BottomNavigationHighlight,
  BottomNavigationHighlightItem,
  BottomNavigationAccessory,
  BottomNavigationItem,
  BottomNavigationLabel,
} from "@animate-ui/react/primitives/bottom-navigation"
import { Button } from "@animate-ui/react/primitives/buttons/button"

import { House } from "@/components/animate-ui/icons/house"
import { Plus } from "@/components/animate-ui/icons/plus"
import { Search } from "@/components/animate-ui/icons/search"
import { User } from "@/components/animate-ui/icons/user"
import { Wallet } from "@/components/animate-ui/icons/wallet"

const ITEMS = [
  { value: "home", label: "Home", Icon: House },
  { value: "search", label: "Search", Icon: Search },
  { value: "wallet", label: "Wallet", Icon: Wallet },
  { value: "profile", label: "Profile", Icon: User },
]

const PAYMENTS = [
  { name: "Spotify", time: "08:12", amount: "€10.99" },
  { name: "Figma", time: "09:30", amount: "€15.00" },
  { name: "Uber", time: "12:42", amount: "€6.05" },
  { name: "Notion", time: "14:05", amount: "€8.00" },
  { name: "Airbnb", time: "17:03", amount: "€256.73" },
  { name: "Vercel", time: "18:21", amount: "€20.00" },
  { name: "Apple", time: "19:18", amount: "€2.99" },
  { name: "Dribbble", time: "20:47", amount: "€52.92" },
  { name: "Netflix", time: "21:15", amount: "€13.49" },
  { name: "Linear", time: "22:02", amount: "€8.00" },
]

// Labels below the icons make wider items, beside them only the selected one.
const LAYOUT = {
  below: "w-[4.875rem] flex-col pt-[5px] data-[minimized]:w-12 data-[minimized]:pt-0",
  beside: "px-5 data-[minimized]:w-12 data-[minimized]:px-0",
}

export default function BottomNavigationDemo({
  scrollBehavior = "minimize",
  labels = "below",
  accessory = true,
}: {
  scrollBehavior?: "none" | "hide" | "minimize"
  labels?: "below" | "beside" | "none"
  accessory?: boolean | string
}) {
  const layout = LAYOUT[labels === "below" ? "below" : "beside"]
  const showAccessory = String(accessory) === "true"
  const [value, setValue] = React.useState("home")
  const [presses, setPresses] = React.useState(0)
  const scrollRef = React.useRef<HTMLDivElement>(null)

  return (
    <div className="relative h-[440px] w-[420px] overflow-hidden rounded-[2rem] border bg-background shadow-sm">
      <div ref={scrollRef} className="h-full overflow-y-auto px-5 pt-6 pb-24">
        <p className="mb-3 text-xs font-medium tracking-wide text-muted-foreground uppercase">
          Today
        </p>
        <ul className="flex flex-col gap-4">
          {PAYMENTS.map((payment) => (
            <li key={payment.name} className="flex items-center gap-3">
              <span className="flex size-9 items-center justify-center rounded-full bg-muted text-sm font-medium">
                {payment.name[0]}
              </span>
              <span className="flex flex-1 flex-col">
                <span className="text-sm font-medium">{payment.name}</span>
                <span className="text-xs text-muted-foreground">
                  {payment.time}
                </span>
              </span>
              <span className="text-sm font-medium tabular-nums">
                {payment.amount}
              </span>
            </li>
          ))}
        </ul>
      </div>
      <div className="pointer-events-none absolute inset-x-0 bottom-0 h-24 bg-linear-to-t from-background to-transparent" />
      <div className="pointer-events-none absolute inset-x-0 bottom-4 flex justify-center">
        <BottomNavigation
          value={value}
          onValueChange={setValue}
          scrollBehavior={scrollBehavior}
          scrollContainer={scrollRef}
          aria-label="Main"
          className="pointer-events-auto flex items-center gap-2.5"
        >
          <BottomNavigationHighlight className="absolute inset-x-0 inset-y-1 z-0 rounded-full bg-muted">
            <ul className="flex items-center rounded-full bg-background/80 px-1 shadow-lg ring-1 ring-border backdrop-blur">
              {ITEMS.map(({ value: item, label, Icon }) => (
                <li key={item}>
                  <BottomNavigationHighlightItem value={item}>
                    <BottomNavigationItem value={item} asChild>
                      <button
                        type="button"
                        aria-label={label}
                        className={`relative z-10 flex h-[3.875rem] items-center justify-center overflow-hidden rounded-full text-muted-foreground outline-none transition-colors focus-visible:ring-[3px] focus-visible:ring-ring/50 hover:text-foreground data-[minimized]:h-12 data-[state=active]:text-foreground ${layout}`}
                      >
                        <Icon
                          animate={value === item}
                          initial={false}
                          size={22}
                          className="shrink-0"
                        />
                        {labels === "below" && (
                          <BottomNavigationLabel className="pt-[5px] text-xs leading-4 font-medium">
                            {label}
                          </BottomNavigationLabel>
                        )}
                        {labels === "beside" && (
                          <BottomNavigationLabel
                            show="active"
                            className="pl-2 text-sm font-medium"
                          >
                            {label}
                          </BottomNavigationLabel>
                        )}
                      </button>
                    </BottomNavigationItem>
                  </BottomNavigationHighlightItem>
                </li>
              ))}
            </ul>
          </BottomNavigationHighlight>
          {showAccessory && (
            <BottomNavigationAccessory
              className="size-[3.875rem] rounded-full bg-background/80 p-1 shadow-lg ring-1 ring-border backdrop-blur data-[minimized]:size-12"
            >
              <Button
                type="button"
                aria-label="New payment"
                onClick={() => setPresses((count) => count + 1)}
                className="flex size-full items-center justify-center rounded-full text-muted-foreground outline-none transition-colors duration-300 ease-out hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50"
              >
                <Plus key={presses} animate={presses > 0} size={22} />
              </Button>
            </BottomNavigationAccessory>
          )}
        </BottomNavigation>
      </div>
    </div>
  )
}

Installation

npm install @animate-ui/react motion
pnpm add @animate-ui/react motion
yarn add @animate-ui/react motion
bun add @animate-ui/react motion

Usage

import {
  BottomNavigation,
  BottomNavigationAccessory,
  BottomNavigationHighlight,
  BottomNavigationHighlightItem,
  BottomNavigationItem,
  BottomNavigationLabel,
} from '@animate-ui/react/primitives/bottom-navigation';

const ITEMS = [
  { value: 'home', href: '/', label: 'Home', icon: <HomeIcon /> },
  { value: 'search', href: '/search', label: 'Search', icon: <SearchIcon /> },
];

export function AppNavigation() {
  return (
    <BottomNavigation
      defaultValue="home"
      scrollBehavior="minimize"
      aria-label="Main"
      className="fixed inset-x-0 bottom-4 mx-auto flex w-fit items-center gap-2.5"
    >
      <BottomNavigationHighlight className="absolute inset-x-0 inset-y-1 rounded-full bg-muted">
        <ul className="flex rounded-full bg-background px-1 ring-1 ring-border">
          {ITEMS.map((item) => (
            <li key={item.value}>
              <BottomNavigationHighlightItem value={item.value}>
                <BottomNavigationItem
                  value={item.value}
                  href={item.href}
                  className="flex h-[3.875rem] w-[4.875rem] flex-col items-center justify-center pt-[5px] data-[minimized]:size-12 data-[minimized]:pt-0"
                >
                  {item.icon}
                  <BottomNavigationLabel className="pt-[5px] text-xs">
                    {item.label}
                  </BottomNavigationLabel>
                </BottomNavigationItem>
              </BottomNavigationHighlightItem>
            </li>
          ))}
        </ul>
      </BottomNavigationHighlight>
      <BottomNavigationAccessory className="size-[3.875rem] rounded-full bg-background p-1 ring-1 ring-border data-[minimized]:size-12">
        <button className="size-full rounded-full hover:bg-muted">+</button>
      </BottomNavigationAccessory>
    </BottomNavigation>
  );
}

Items are links: give them an href, or asChild with your router's link or a button. The selected item gets aria-current="page" and data-state="active". With a router, pass the current route as value so the highlight follows navigation. BottomNavigationHighlight and BottomNavigationHighlightItem are optional; without them, style the active item with data-state="active".

scrollBehavior sets what the bar does while the page scrolls down: "minimize" shrinks it to its icons, like iOS' tab bar, "hide" slides it out, and "none" (the default) leaves it. It comes back as soon as the page scrolls up or reaches the top, an item takes keyboard focus, or the bar is tapped. It listens to the window, or to scrollContainer when the page scrolls inside an element.

While minimized, the items, the labels and the accessory get data-minimized: give the items and the accessory their minimized size with it (data-[minimized]:size-12). They ease between their two sizes, padding included, and the labels fold away.

BottomNavigationLabel and BottomNavigationAccessory are optional:

  • A label shows on every item. With show="active", it shows only on the selected item, beside its icon, so the bar stays icons and one name. Its text stays in the accessibility tree, so it names the item even while folded.
  • The accessory (a button, a player, a search field) stays beside the bar and minimizes with it. Pressing or focusing it leaves the bar minimized.

Under its icon (an item laid out in a column), a label folds its height; beside it, its width. A folded label takes no room: put its spacing inside it (pt-[5px], pl-2), not on the item.

Animation

  • The highlight slides to the selected item on a spring (stiffness 300, damping 30): one surface is handed from the previous item to the new one, at full opacity (Highlight).
  • Items scale to 0.97 while pressed, on the buttons' spring.
  • With show="active", labels open on the highlight's spring, so the highlight widens with the selected item: the new label grows from nothing out of a 4px blur as the previous one narrows and blurs away.
  • Both scroll behaviors start once the page has scrolled down by 6px and run on a critically damped spring (stiffness 300, damping 35).
    • "minimize": the items and the accessory ease to their minimized size and padding, the highlight staying on the selected item. Labels fade out into a 4px blur in 0.1s and fold away on the same spring, and fade back in over 0.2s; beside their icons, they fade with their width. Tapped while minimized, an item grows the bar and takes the selection in one move.
    • "hide": the bar slides out past the bottom edge, and back on the way up.
  • <AnimateUIProvider tempo> paces every spring.
  • Under reduced motion, the highlight moves at once, items don't scale, labels open and fold at once, the bar minimizes at once, and the hidden bar fades out instead of sliding (and can’t be clicked while hidden).

API Reference

BottomNavigation

PropTypeDefault
defaultValue?
string-
value?
string-
onValueChange?
(value: string) => void-
scrollBehavior?
'none' | 'hide' | 'minimize''none'
scrollContainer?
React.RefObject<HTMLElement | null>-
transition?
Transition{ type: 'spring', stiffness: 300, damping: 35, restDelta: 0.01 }
...props?
HTMLMotionProps<'nav'>-

BottomNavigationHighlight

Takes the Highlight props, except controlledItems and value.

PropTypeDefault
transition?
Transition{ type: 'spring', stiffness: 300, damping: 30 }

BottomNavigationHighlightItem

Takes the HighlightItem props.

PropTypeDefault
value
string-

BottomNavigationItem

PropTypeDefault
asChild?
booleanfalse
value
string-
tapScale?
number0.97
...props?
HTMLMotionProps<'a'>-

BottomNavigationLabel

Goes inside a BottomNavigationItem.

PropTypeDefault
show?
'always' | 'active''always'
transition?
Transitionthe bar's transition; with `show="active"`, { type: 'spring', stiffness: 300, damping: 30 }
...props?
HTMLMotionProps<'span'>-

BottomNavigationAccessory

PropTypeDefault
...props?
HTMLMotionProps<'div'>-

useBottomNavigation

Returns activeValue, handleValueChange, scrollBehavior and minimized.

Built by Skyleen. The source code is available on GitHub.

Last updated: 10/27/2026