Skip to content
Navigation

FloatNav

A floating pill bar. The active pill slides between links, and the bar slips away while you scroll down and comes back when you scroll up.

Download
  • React
  • Tailwind CSS v4
  • motion

Props

NameTypeDefaultWhat it does
items{ label, href }[]โ€”The links.
activestringfirst hrefhref of the active link at start.
onSelect(item, e) => voidโ€”Click handler. Call e.preventDefault() to stay on the page.
hideOnScrollbooleantrueSlip away on scroll down, back on scroll up.
containerRefObject<HTMLElement>โ€”Scrolling box to watch. Leave out to watch the page.
colorstring"#a78bfa"Colour of the sliding pill.
activeTextstring"#0b0a14"Text colour on the pill.
labelstring"Main"Name read out by screen readers.
classNamestringdark glass pillReplaces the bar look. Place it yourself (e.g. fixed top-4).