Barely Designer

Bottom Nav

Component

About

Mobile bottom navigation with a springy sliding pill, filled icon on select and arrow-key support. Built with the Vercel UI SDK Tabs and Phosphor icons.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Bottom Nav to your project and fits it to your theme.

Code

How Bottom Nav is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import { useEffect, useState } from "react"

import BottomNav, { defaultItems } from "@/components/ui/bottom-nav"

const STEP_MS = 1800

// Autoplays Home -> Medicines -> Check ups -> Home until the viewer taps a tab.
export default function BottomNavDemo() {
  const [value, setValue] = useState(defaultItems[0].value)
  const [touched, setTouched] = useState(false)

  useEffect(() => {
    if (touched) return
    const id = setInterval(() => {
      setValue((current) => {
        const next = (defaultItems.findIndex((item) => item.value === current) + 1) % defaultItems.length
        return defaultItems[next].value
      })
    }, STEP_MS)
    return () => clearInterval(id)
  }, [touched])

  return (
    <div className="fixed inset-0 flex items-center justify-center bg-zinc-100 p-4 dark:bg-zinc-950">
      <div className="h-full max-h-[720px] w-full max-w-[360px] overflow-hidden rounded-[2.5rem] border border-zinc-200 bg-zinc-50 shadow-xl dark:border-zinc-800 dark:bg-zinc-950">
        <BottomNav
          value={value}
          onValueChange={(next) => {
            setTouched(true)
            if (next) setValue(next)
          }}
        />
      </div>
    </div>
  )
}

Dependencies

More by Barely Designer

View all
  • Car sales Dashboard

    Car sales Dashboard

    10
  • ASCII Heart Login

    ASCII Heart Login

    2
  • No Green Tick

    No Green Tick

Explore more

Part of Health care — browse the full library on 21st.dev.