Navbar that tucks away on scroll down and drops back on scroll up, with a springy link highlight, a search trigger with its shortcut and a peek of the current section.
Scroll insideScroll inside
Fulfilment
Today
Scroll the list: the bar steps aside, a peek keeps your place.
To pack
4
Shipped
27
Late
1
Orders
#2041Ceramic mug set × 2Packing
#2040Linen apron × 1Late
#2039Oak serving board × 1Labelled
#2038Tea towels × 3Packing
#2037Espresso cups × 4Packing
Returns
Linen apron
R-118 · Wrong size
Glass carafe
R-117 · Arrived chipped
floating-navbar · , lively
floating-navbar-demo.tsx
When to use
Deprecated: for new work use Morphing Navbar (its island preset replaces pill, shrink replaces bar). Keep this only where it is already in place as a top bar that hides on scroll down, with link highlight, a Cmd+K search trigger and a section peek.
When not to use
For any new header use Morphing Navbar, which replaces this deprecated component. For an app with many sections use Sidebar.
Use it as the top bar of an app screen or a long page (a dashboard list, a report, API docs) where
the header should give the working space back while people scroll down, and be there the moment
they scroll up to go somewhere else. With peek, people never lose their place while the bar is
away: a small capsule names the section they are in, a hairline under it shows how far they have
read, and a tap brings the whole bar back.
For a header that changes shape as you leave the top, use Morphing Navbar;
for app shells with many sections, use Sidebar.
The motion follows the MotionKit grammar in three beats. When you scroll down past revealAt,
the navbar charges (it dips by the temperament's squash for a few dozen milliseconds), then
the action lifts it away on the temperament's spring. Scrolling up drops it back, and it
settles with the temperament's bounce. Inside it, a highlight springs from link to link
after the pointer and keyboard focus, and rests on the active link when neither is there. The peek
arrives on the same timeline: it waits for the bar's charge, then drops in on the same spring.
FloatingNavbar.Search is the search field of the bar. Its shortcut (Cmd+K on Apple devices,
Ctrl+K elsewhere) brings a hidden navbar back and presses the keycap, so people see the shortcut
was understood; open your command palette in onOpen.
Without container the navbar is fixed to the top of the viewport and follows the page scroll;
give your main content a top padding equal to its height. Inside a scroll area pass the area's
ref as container and render the navbar as its first child: it becomes sticky.
Named "Main" by default (aria-label to change). Scrolls sideways if narrow.
Link
<a> in an <li>
active sets aria-current="page"; asChild renders your router's link.
Search
<button>
onOpen, shortcut ("k" by default, false to turn off), disabled.
Anything else (logo, notifications, a workspace menu) goes straight into Root; its children are
laid out in a row with space between them. Below 640px Search shows only its icon, keeping its
accessible name.
With container, the search shortcut only works while focus is inside that scroll area, so an
embedded app pane never takes over the page's own Cmd+K. Without it, the shortcut works from
anywhere on the page.
pill (default): a floating glass capsule with a rim light and a soft shadow; the highlight is a
filled pill.
bar: a full-width blurred bar with a hairline border that gains a shadow once the page leaves
the top; the highlight is an underline on the bar's bottom edge.
minimal: transparent over the hero, a hairline glass bar once scrolled; the highlight is a
small dot under the link.
The bar preset over a quickstart guide: an underline marks the section, and while you read the
bar leaves and the peek says which step you are on.
Scroll insideScroll inside
{}Example API
Guides / Getting started
Quickstart
Five minutes from an empty project to your first tracked event. Read on: the bar steps aside, the peek above keeps the step you are on, and scrolling up brings the bar back.
1. Install the client
Add the package with your package manager and import it once at the root of your app.
npm install @example/client
2. Create a key
Keys are scoped to one project. Keep them on the server and rotate them from the dashboard.
EXAMPLE_KEY=sk_test_123
3. Send your first event
Events are batched and retried, so a flaky connection never loses data.
The minimal preset sits transparent over a report's header band (a negative bottom margin lets
the band run under it) and turns into a hairline glass bar once you read on.
Scroll insideScroll inside
Reports / Q3 review
July to September
Fulfilment review
Orders
2,418
Avg. pack time
11 min
Returns
3.1%
Carriers
Carrier A62% of parcels · 97% on time
Carrier B28% of parcels · 91% on time
Carrier C10% of parcels · 88% on time
Notes
Pack time dropped after the second bench opened in August. Returns stay concentrated on sized items; the size guide update ships next quarter.
Root is a <header> (the page's banner landmark when it is not inside another sectioning
element) and Links a <nav> named "Main", with a real list of links. The active link has
aria-current="page".
Hidden is only visual: the links stay in the tab order, and focusing anything inside brings the
navbar back, so keyboard users never tab into an invisible header.
While hidden the bar takes no clicks; the header's transparent padding never covers the page.
The peek is a pointer and touch shortcut (aria-hidden, out of the tab order): keyboard users
bring the navbar back by focusing it, and the section is already announced by the active link's
aria-current. Tapping it does not move focus, so the navbar hides again on the next scroll down.
Search is a real button with aria-keyshortcuts; the keycap is decorative. Disabled, it gets a
dashed outline (text keeps its contrast) and the shortcut stops listening. Add aria-expanded
and aria-haspopup="dialog" when it opens a palette.
The highlight is decorative (aria-hidden); the active link is also shown by its full-contrast
text color, so the state never relies on the highlight alone. Inactive links use
muted-foreground, which meets AA in shadcn themes.
Links are 36px tall, above the 24px minimum target size, with a visible focus ring.
With reduced motion (the OS setting, or MotionKitProvider reducedMotion="always") the navbar
does not travel: it fades out and back in place in a short fade, the peek fades in where it rests,
the highlight fades onto a link instead of sliding between links, and the search keycap does not
press.
One passive scroll listener. React re-renders only when the navbar changes state (hidden,
shown, scrolled), never on every scroll event; the peek's progress hairline is a motion value
scaled on the compositor.
Search adds one keydown listener (on the container or the window), removed on unmount.
The hide and show moves are transform and opacity on one motion value each; the highlight
is a Motion shared-layout animation that measures two links once per move.
The glass surfaces use backdrop-filter; on very long pages with heavy content behind the
navbar, a solid surfaceClassName="bg-background" is cheaper.
About 5.5 kB gzip including the MotionKit helpers, on top of Motion and Radix Slot.
Technical sheet
Motion
calm
260 ms · bounce 0
lively
400 ms · bounce 0.3
playful
540 ms · bounce 0.45
Main spring of each temperament. Set it with the temperament prop or MotionKitProvider; the default is lively.
Size
Not measured yet · budget 15.0 kB gzip
Component and MotionKit helpers; excludes react, react-dom, @radix-ui/react-slot, motion.
Dependencies
@radix-ui/react-slot · peer
motion · peer
Triggers
scroll, hover, keyboard focus
Reduced motion
No travel: the navbar fades out and back in place, the peek and the link highlight fade instead of sliding, and the search keycap does not press.
Keyboard
Tab / Shift+Tab
Moves between links and controls; focusing anything inside brings a hidden navbar back
Enter
Follows the focused link or opens search
Cmd+K / Ctrl+K
Opens search and brings a hidden navbar back (inside the container when one is set)
Browsers
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)