Navigation

Back To Top

An outline with a return to the top: the "back to top" button is a plain anchor link that hides itself while the start of the text is still on screen.

React + Tailwind, shadcn-compatible: press “Copy for AI” and your Cursor or Claude Code agent installs it with the shadcn CLI.

What you can change

  • the outline heading through title and the return caption through topLabel
  • the sections through sections: id, title and text
  • the accent colour through accent

A link for your AI agent: preview, code and instructions.

Preview

1440pxHost theme
Back To Top — An outline with a return to the top: the "back to top" button is a plain anchor link that hides itself while the start of the text is still on screen.

Use it with AI

  1. 1. Copy the link.
  2. 2. Write to your agent in your own words and drop the link into the sentence.
  3. 3. The agent opens the link and installs the component from the registry.
AI
1Pick it here

put this on the home page as the hero:

https://vibeui.club/c/scrollspy-006?lang=en&theme=dark

2Paste into the chat
3Get it in your project

Not sure where to paste it? Step-by-step guide

Show the full instructions

What the link says, spelled out. Use it when your agent cannot open links — paste this text instead.

Loading…

How to use

<Scrollspy006
  title="Contents"
  topLabel="Back to top"
  sections={[
    { id: "intro", title: "Intro", text: "Why a long page needs a way back" },
    { id: "usage", title: "Usage", text: "Links stay links" },
  ]}
/>

A sample call. The agent installs the component itself from the registry via the “Copy for AI” link.

Settings

Return caption
topLabel · default: Back to top
Accent
accent · default: theme colour
Background
background · default: theme colour

FAQ

How do I add Back To Top with Cursor or Claude Code?
Press “Copy for AI” on this page and paste it into your agent's chat. The instruction contains the shadcn CLI install command, the dependencies and what to keep, so the agent installs this exact component instead of recreating a lookalike.
What does Back To Top depend on?
No npm packages beyond React and Tailwind CSS.
What can I change in Back To Top?
Adapt: the outline heading through title and the return caption through topLabel; the sections through sections: id, title and text; the accent colour through accent. Keep as installed: the local --vibeui-scrollspy-006-* palette — do not swap it for your theme tokens; the return as a plain anchor link: a script-only button does nothing without JS; the initial "visible" state: with JS disabled the link must stay in place.
Is Back To Top free?
Yes. The preview is open without an account; with a free account you can copy up to 20 components a month.

For developers

npx shadcn@latest add https://vibeui.club/r/pro/scrollspy-006.json

This command needs a signed link: sign in and open “Component source” below — it issues a working link valid for 30 minutes. All install options

Technical notes

The component is self-contained: one file, no dependencies, the palette in local variables --vibeui-scrollspy-006-*. Client-side ("use client") — IntersectionObserver is needed. There are two observers: the first highlights the active section, the second watches a sentinel marker at the very top of the text and hides the return link while the start is visible. The initial state is the link shown, so with JS disabled it stays in place and works as a plain anchor. It is hidden with the hidden attribute rather than opacity: an invisible link must not catch focus on Tab.

Tags

  • scrollspy
  • toc
  • back-to-top
  • anchor
Component source

The same file your agent installs. Here in case you would rather copy it by hand.

Loading…