Topbar Scroll Edge
The client half of `Topbar edge="scroll"`: it marks the header `data-scrolled` once the page has moved off its top, so the bar can sit clear over a hero and gain its surface and border only when content passes beneath it. With `hide` it also marks the…
Preview
Rendered from the story the storybook (a11y) CI gate runs axe against — the preview can't show something that hasn't been verified.
Install
Two equivalent paths — the URL works in any shadcn-CLI setup; the alias works once you've registered @interlace in your components.json.
npx shadcn@latest add https://ds.interlace.tools/r/topbar-scroll-edge.jsonnpx shadcn@latest add @interlace/topbar-scroll-edgeHistory
This component is at v1.0.0, first shipped in @interlace/ui 2.0.0. The version is stamped as a banner into the file the install writes, so the copy in your tree says which one you have — compare it with the number above before deciding whether to re-run the install.
@interlace/ui 2.0.02 entries
- Addedminor
Topbartakes link groups, a quiet edge and a full-screen phone menu. - **Link groups.** An entry oflinkscan be{ label, items }, where each item is a link with an optionaldescriptionandicon. FromcollapseBelowup, a group is a button that opens a panel of its items, built on Base UI NavigationMenu: arrow keys move between triggers, Enter opens a panel and focuses its first item, Escape closes it and returns focus, hover opens it after a short delay and the panel slides between groups. Following a link closes it. BelowcollapseBelow, each group is a labelled section of the menu, andmobileNav="wrap"opens groups out into the row. Plain links work as before. - **edge="scroll".** The bar sits clear over the top of the page, with no surface or border, and fades them in once the page scrolls under it. The default,edge="always", is unchanged. - **menuSide="full".** The small-screen menu covers the whole screen, dropping from the top, with larger links. New parts, installed with Topbar:TopbarNav(the wide row with groups) andTopbarScrollEdge(marks the headerdata-scrolled). - Addedminor
Topbarmotion and focus polish. - **Hover pill.** A soft pill slides under whichever row item the pointer is over, and rests under an open group's trigger. - **Panels slide between groups.** Moving from one group to the next, the panel resizes and its content slides in the direction of travel. The items cascade in, 20ms apart, inside the 150ms stagger window. - **hideOnScroll.** The bar slides away while the reader scrolls down and returns on the first scroll up. It stays put while focus or an open panel is inside it. - **Menu cascade.** The small-screen menu's links fade in a quick cascade. - **Focus ring.** Every row item is now a padded box, so the focus ring sits 2px outside it on the page colour and never touches the words. Rows of plain links now render throughTopbarNavtoo, so they get the same pill and ring. Everything that moves is behindmotion-safe. Under reduced motion the pill and panels still appear, without moving.
Import
Single named export.
import { TopbarScrollEdge } from '@/components/ui/patterns/topbar-scroll-edge';API reference
Parsed from the type declarations in the source — the same file the install writes into your tree, so this table can't drift from the component you get.
TopbarScrollEdgeProps
| Prop | Type | Description |
|---|---|---|
| threshold | number | Pixels of scroll before the header counts as scrolled. @default 4 |
| hide | boolean | Also mark the header `data-hidden` while the reader scrolls down past it, and clear it the moment they scroll back up. Never while focus or an open panel is inside the header. @default false |
Accessibility
Every story for this component is rendered headlessly and checked with axe-core (wcag2aa, wcag22aa, best-practice, ACT) on every PR. That gate has no continue-on-error, so what ships has zero known violations.
What follows is what static analysis can see. Axe cannot press a key and never sees an overlay open, so the operable-without-a-mouse claim lives in Behavior instead, where the keyboard path is replayed step by step.
- Focus + keyboard behaviour
- Native element semantics — no interaction layer to get wrong.
- Focus ring (WCAG 2.2 SC 2.4.13)
- Not focusable — no focus indicator required.
- Reduced motion
- No animation to gate.
- ARIA in the source
- None — semantics come from the element or the Base UI primitive rather than hand-written ARIA.
R-rule compliance
Every primitive in @interlace/ui models to the portable 26-rule floor enforced by the componentApi ESLint preset. The cells below pin exactly where each rule applies in this file.
| Rule | Concept | Where |
|---|---|---|
| R6 | data-slot | `topbar-scroll-edge` |
| R25 | Client component | one passive scroll listener on `window` |
Dependencies
- Base UI primitive
- Native / no Base UI dependency
- Lucide icons
- none
- NPM dependencies
- none
- Registry dependencies
Source
The full implementation — components/ui/patterns/topbar-scroll-edge.tsx once installed.
"use client";
import * as React from "react";
// @interlace/topbar-scroll-edge v1.0.0 — Interlace design system.
// Docs, props and live preview: https://ds.interlace.tools/c/topbar-scroll-edge
// What changed since: https://ds.interlace.tools/c/topbar-scroll-edge#history
// Generated banner — keep it, the upgrade diff reads this version.
/**
* @interlace/ui — TopbarScrollEdge
*
* The client half of `Topbar edge="scroll"`: it marks the header
* `data-scrolled` once the page has moved off its top, so the bar can sit
* clear over a hero and gain its surface and border only when content
* passes beneath it. With `hide` it also marks the header `data-hidden` while
* the reader scrolls down, so the bar slides away and returns on the first
* scroll up. Topbar renders it for you; it draws nothing itself.
*
* | Rule | Concept | Where in this file |
…52 more lines…Registry JSON
The raw registry record — what the shadcn CLI fetches.