Back to top button in React
A floating button that appears after scrolling, glides back to the top of the page and shows reading progress.
Here is an excerpt of this component's code in React. The full code is free for members, ready to copy into your project.
This component also comes in
The code in React
import { useEffect, useRef, useState, type MouseEvent } from "react";
const sections = [
{
id: "bth-itineraire",
title: "Choisir l'itinéraire",
paragraphs: [
"Pour une première sortie, visez un dénivelé positif de 600 à 800 mètres et une durée de marche de quatre à cinq heures au maximum. Les topoguides et les cartes IGN au 1:25 000 indiquent les temps de parcours, les points d'eau et les refuges.",
"Repérez à l'avance les échappatoires : un chemin plus court pour redescendre si la météo tourne ou si la fatigue arrive plus vite que prévu. Partagez ensuite votre itinéraire et votre heure de retour avec un proche.",
],
},
{Free component: copy it freely, including for commercial projects.
Other breadcrumbs and pagination components in React
Breadcrumbs and pagination components in React
A bottom bar with Call, Directions and Free quote that tucks away while visitors read down the page and returns as soon as they scroll up. Built for tradespeople whose customers arrive on a phone.
- Tailwind
- React
- CSS
- WordPress

A slim bar at the top of the page with a message, a link and a close button; once closed, it stays hidden for the period you choose.
- Tailwind
- React
- CSS
- WordPress

A sticky sidebar table of contents for blog posts: it highlights the section being read, shows the reading time left and folds into a list under the title on mobile.
- Tailwind
- React
- CSS
- WordPress

A column of dots on the side of the page that follows the section being read and lets visitors jump to it, with a label on hover and focus.
- Tailwind
- React
- CSS
- WordPress

Step indicator
FreeAn order step indicator: finished steps clickable to go back, the current step announced, upcoming steps locked.
- Tailwind
- React
- CSS
- WordPress

Tooltips in four positions that open on hover, tap and keyboard focus, and close with Escape, as WCAG requires.
- Tailwind
- React
- CSS
- WordPress