Back To Top
A back to top button that appears after scrolling, with a ring that fills as the reader progresses. Smooth scroll that respects reduced motion.
src/registry/ui/back-to-top.tsx/r/back-to-top.json
Installation#
bash
npx shadcn@latest add https://ui.minidev.pro/r/back-to-top.json
Usage#
tsx
import { BackToTop } from "@/components/ui/back-to-top"
export function Example() {
return <BackToTop />
}
API reference#
| Prop | Type | Default |
|---|---|---|
threshold | number | 400 |
target | React.RefObject<HTMLElement | null> | - |
className | string | - |
Dependencies#
npm
lucide-react
Built from
No other MiniDev files
Related navigation components#
Back LinkSmall back navigation link with a left arrow icon, muted text that darkens on hover and a visible focus ring. Defaults to the label Back and accepts any href.Breadcrumb EllipsisEllipsis marker for collapsing the middle of long breadcrumb trails. Decorative and hidden from assistive tech, sized to sit between breadcrumb separators.BreadcrumbBreadcrumb navigation from an items array, with chevron separators, linked ancestors and the current page marked with aria-current. Built with React.Collapsible SidebarSidebar with a toggle button on its edge that collapses it to a narrow rail and expands it again. The button label updates for screen readers.Command ItemRow for command menus with a label, an optional keyboard shortcut in a kbd tag and an active highlight state. Use it to build custom command lists.Command PaletteCmd K style command palette in a dialog with a search field that filters commands as you type, runs the chosen action and closes. Shows an empty state.
All navigation components