Back to Components
Navigation

Scroll To Top

Button that appears after scrolling to quickly return to the top.

PropsUsage ExampleVariations

Scroll to top appears after the threshold.

Set the threshold to 0 for an always on preview.

Dependencies

  • clsx
  • tailwind-merge

Files

  • components/ui/scroll-to-top.tsx

Installation

Using shadcn CLI

npx shadcn add scroll-to-top --url https://ui.hampton.io

Manual installation

Copy the component file to your project and install dependencies:

npm install clsx tailwind-merge

Related Navigation Components