Loading preview
Animated Tabs
NavigationTabs with a sliding underline and fading panels, following the WAI-ARIA tabs pattern.
A thin bar that fills as the reader scrolls through a page or container.
npx shadcn@latest add @venusui/scroll-progressRun this in a project set up with shadcn. If you haven’t set it up yet, run npx shadcn@latest init first.
Paths use the default shadcn aliases. The CLI follows the aliases in your components.json.
@/components/ui/scroll-progress.tsxThe code behind the preview above.
scroll-progress-demo.tsx
"use client"
import * as React from "react"
import { ScrollProgress } from "@/components/ui/scroll-progress"
export default function ScrollProgressDemo() {
const ref = React.useRef<HTMLDivElement>(null)
return (
<div className="w-full max-w-md overflow-hidden rounded-xl border bg-card">
<ScrollProgress target={ref} label="Article progress" />
<div ref={ref} tabIndex={0} role="region" aria-label="Scrollable article" className="h-56 space-y-3 overflow-y-auto p-5 text-sm text-muted-foreground outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset">
<p className="font-medium text-foreground">Scroll inside this box</p>
{Array.from({ length: 10 }, (_, i) => (
<p key={i}>Paragraph {i + 1}. The bar above fills as you read further down.</p>
))}
</div>
</div>
)
}
| Prop | Type | Default | Description |
|---|---|---|---|
| target | RefObject<HTMLElement | null> | — | Scrollable element to track. Defaults to the page. |
| label | string | "Reading progress" | Accessible name. |
| className | string | — | Classes, e.g. fixed inset-x-0 top-0 z-50. |
Only the props above.
fixed top-14 inset-x-0.bg-primary to change it.aria-valuenow follows the scroll.target) must be taller than the viewport to scroll.Unknown registry "@venusui"npx shadcn@latest), install by URL, or register it with its address: npx shadcn@latest registry add @venusui=https://venusui.com/r/{name}.json.No components.json foundnpx shadcn@latest init in your project first.Tabs with a sliding underline and fading panels, following the WAI-ARIA tabs pattern.
A thin indeterminate progress bar for pages and cards that are loading.
A row of icons that magnify as the mouse approaches, like the macOS dock.