Kinetic UI
Back to Introduction
General

Back To Top

An animated scroll-to-top button with a dynamic SVG progress ring.

Quick Actions
CLI Installation
npx kinetic-ui-cli@latest add back-to-top
back-to-top

Start Scrolling

Scroll down this container to reveal the back-to-top button.

Keep Going

The button should appear now. Notice the SVG progress ring tracking your scroll position.

Bottom Reached

Click the button to smoothly scroll back to the top of this container.

Overview

The BackToTop component is a high-end utility for long scrolling pages. Unlike simple anchor links, this component uses framer-motion to monitor scroll progress, only fading in after the user scrolls past a predefined threshold. It features an SVG circle that traces the exact percentage of the page scrolled, providing subtle but premium visual feedback.

Usage

import { BackToTop } from "@/components/creative/back-to-top"

export default function Layout({ children }) {
  return (
    <main>
      {children}
      
      <BackToTop 
        threshold={300} 
        position="bottom-right" 
        showProgress={true} 
      />
    </main>
  )
}

Usage Guide

1. Import the Component

Import the component into your React or Next.js page:

import { BackToTop } from "@/components/creative/back-to-top";

2. Implementation Example

Render the component and customize its behavior by passing props:

import { BackToTop } from "@/components/creative/back-to-top";

export default function Example() {
  return (
    <div className="w-full flex items-center justify-center p-8">
      <BackToTop
        scrollContainerRef{/* value */}
        threshold{10}
        showProgress{true}
      />
    </div>
  );
}
Performance Notes
  • Uses CSS hardware acceleration via GPU transform-binds.
  • Damped interpolation minimizes paint-redraw flashes.
  • Tree-shakable import: only compiles elements requested.
Accessibility Notes
  • Full keyboard focus-ring navigation support (`Tab`/`Shift+Tab`).
  • ARIA roles mapped correctly for assistive screen readers.
  • Respects `prefers-reduced-motion` system toggles.