Componentnavigation0.7 KB gzipZero dependencies

Scroll Top

Floating elevator button that scrolls smoothly to page top.

Preview

Live Preview
Open ↗

Installation

Tokens guide →

Add to your project via CLI (zero dependencies, code you own):

npx bigbullui add scroll-top

Or install the full npm package:

npm install bigbullui

Usage

tsx3 lines
import { ScrollTop } from "@/components/ui/scroll-top"; <ScrollTop threshold={150} label="TOP" />

Source code

scroll-top.tsx + 1 helper

Zero 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 />
PropTypeDescription
thresholdnumberConfigures threshold. (Default: 200)
labelstringAccessible label text rendered or attached to the control. (Default: "TOP")
classNamestringOptional Tailwind or custom CSS classes merged with component styles.