Back-to-Top Button
A small corner button that appears after scrolling far, taking you back to the top.
<a href="#top">When to use it
On very long pages.
Common mistake
Don’t let it cover another button or content.
Accessibility
Move focus to the top of the page too, not just the scroll position.
Name in code
| HTML/CSS | <a href="#top"> |
|---|---|
| React | ScrollToTop (custom) |
| Jetpack Compose | LazyListState.animateScrollToItem(0) |
| SwiftUI | ScrollViewReader.scrollTo |
Ready prompt for your coding agent
Add a Back-to-Top Button to this screen.
What it is: A small corner button that appears after scrolling far, taking you back to the top.
Implement with: <a href="#top"> (HTML/CSS).
Accessibility: Move focus to the top of the page too, not just the scroll position.
When to use it: On very long pages.
Avoid: Don’t let it cover another button or content.
Reuse the project's existing design tokens, spacing and component conventions.
Or compose a whole page from this element and others →
Prompts are in English for the most precise results with coding agents.