Componentnavigation0.7 KB gzipZero dependencies
Scroll Top
Floating elevator button that scrolls smoothly to page top.
Preview
Live Preview
Installation
Tokens guide →Add to your project via CLI (zero dependencies, code you own):
npx bigbullui add scroll-topOr install the full npm package:
npm install bigbulluiUsage
tsx3 lines
import { ScrollTop } from "@/components/ui/scroll-top"; <ScrollTop threshold={150} label="TOP" />Source code
scroll-top.tsx + 1 helperZero third-party dependencies (2 local files shown in tabs below).
tsxscroll-top.tsx54 lines
"use client"; import * as React from "react";import { cn } from "./lib/utils"; export interface ScrollTopProps extends React.ButtonHTMLAttributes<HTMLButtonElement> { threshold?: number; label?: string; className?: string;} export function ScrollTop({ threshold = 200, label = "TOP", className, ...props}: ScrollTopProps) { const [visible, setVisible] = React.useState(false);Props
Interactive Prop Playground
Tweak parsed AST props below to generate ready-to-paste JSX.
tsx3 lines
import { ScrollTop } from "@/components/ui/scroll-top"; <ScrollTop />| Prop | Type | Description |
|---|---|---|
| threshold | number | Configures threshold. (Default: 200) |
| label | string | Accessible label text rendered or attached to the control. (Default: "TOP") |
| className | string | Optional Tailwind or custom CSS classes merged with component styles. |