Julien Thibeaut

Scroll Button

Buttons 52

About

A floating button component that appears when users scroll up in a container, allowing them to quickly return to the bottom of the content with a single click.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Scroll Button to your project and fits it to your theme.

Code

How Scroll Button is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client"

import { ScrollButton } from "@/components/ui/scroll-button"
import { useRef, useState } from "react"

export function ScrollButtonBasic() {
  const containerRef = useRef<HTMLDivElement>(null)
  const bottomRef = useRef<HTMLDivElement>(null)

  const [content] = useState(
    Array(20)
      .fill(0)
      .map((_, i) => (
        <div key={i} className="border-b p-3">
          <h3 className="font-medium">Item {i + 1}</h3>
          <p className="text-muted-foreground">
            This is a sample item to demonstrate scrolling behavior.
          </p>
        </div>
      ))
  )

  return (
    <div className="relative flex h-[400px] w-full flex-col overflow-hidden">
      <div
        ref={containerRef}
        className="flex h-full w-full flex-col items-center justify-center overflow-y-auto"
      >
        {content}
        <div ref={bottomRef} />
      </div>

      <div className="absolute right-12 bottom-4">
        <ScrollButton containerRef={containerRef} scrollRef={bottomRef} />
      </div>
    </div>
  )
}

Dependencies

More by Julien Thibeaut

View all
  • Dock

    Dock

    3.1K
  • Text Effect

    Text Effect

    1.6K
  • Infinite Slider

    Infinite Slider

    1.5K
  • Text Shimmer

    Text Shimmer

    1.3K
  • Text Scramble

    Text Scramble

    1.1K
  • Progressive blur

    Progressive blur

    683
  • Glow Effect

    Glow Effect

    610
  • Tailwind CSS Background Snippet

    Tailwind CSS Background Snippet

    536

More in Buttons

View all
  • Button Save

    Button Save

    46
  • Button

    Button

    20
  • Eclipse Button

    Eclipse Button

    5
  • Button

    Button

    6
  • Button

    Button

    14
  • Button Group

    Button Group

    37
  • Button

    Button

    32
  • Split Button

    Split Button

    32