A bar that slides out of the way as users scroll down, and comes back when they scroll up.
- Add the registry
- Add retracting-bar
Usage
RetractingBar sticks to an edge of the nearest scrolling container, or of the page. It slides away
once someone scrolls down hideAfter pixels without stopping. Bringing it back takes a longer
scroll up, revealAfter pixels, or a quick flick, so the small corrections users make while
reading don't bring it back over the text. It always shows near the top, and it comes back at the
end of the content too, where there's nothing left to read.
A bar at the top is transparent until content scrolls beneath it, and has data-at-top until then.
Set edge="bottom" for a tab bar, and render it last in the scrolling region. The bar has
data-hidden while it's hidden. Like Scroll Header, it takes the
corners of the edge it sticks to from its parent.
Tabbing into a hidden bar brings it back without the page jumping, and keeps it shown while keyboard
focus is inside. Clicking a button in it doesn't keep it shown, so a tab bar still hides once users
scroll on. Set pinned to keep it shown yourself, such as while a menu in it is open. Since it
doesn't hide while pinned, it stays shown after you unpin it until users scroll on.
When reduced motion is on, the bar still hides, but without sliding. onHiddenChange fires each
time the bar hides or comes back, which you can use to move a floating button out of its way.
Props
Base UI's styling (opens in a new tab) and composition (opens in a new tab) guides say more about className, style and render.