Try 'magnetic button'
View code

Specification

Catalogue
No. 43 of 110
Interaction
Scroll
Element
Carousel
Preview
Live component
Imports
react 19.3.1
Added

Notes

An endless row of cards where the middle one is full size and the rest step back.

The focus follows the scroll position itself, so a swipe feels as smooth as the autoplay. It pauses when touched or hovered, has a pause button, and stops after one round on the first card.

Rests 2.2s, glides 0.9s ease-in-out cubic. A click glides 0.45s, then 6s rest. Edges 0.8 scale / 0.3 opacity, centre 1 / 1, scroll-driven.

The names, figures and pictures in the demo are sample content; a real build uses the client's own.

Code

React and plain CSS
"use client";

import { FocusCarousel } from "@/components/pieces/kit/focus-carousel";
import type { LivePreviewProps } from "@/components/live/types";
import { PieceStage } from "@/components/pieces/stage/PieceStage";
import "./focus-carousel.css";

const RESULTS = ["A", "B", "C", "D", "E", "F"];

function FocusCarouselDemo() {
  return (
    <div className="dm dm-carousel">
      <FocusCarousel
        label="Sample results"
        items={RESULTS.map((r, i) => ({
          id: r,
          label: `Result ${r}`,
          tab: <span>Result {r}</span>,
          card: (
            <div className="dm-proof">
              <div className="dm-proof-head">
                <span className="dm-proof-name">Result {r}</span>
                <span className="dm-pass">Passed</span>
              </div>
              <div className="dm-lines" aria-hidden="true">
                {[92, 78, 85, 60 + i * 5].map((w, k) => (
                  <i key={k} style={{ width: `${w}%` }} />
                ))}
              </div>
            </div>
          ),
        }))}
      />
    </div>
  );
}

export default function FocusCarouselEntry(props: LivePreviewProps) {
  return (
    <PieceStage {...props} label="Focus carousel" sample replay>
      <FocusCarouselDemo />
    </PieceStage>
  );
}

More like this

Header that steps aside

ScrollNavigation

Menu that opens into link cards

Press, Layout AnimationNavigation

Cookie choice that folds away

FeedbackOverlays and toasts

Bookshelf

Press, Layout AnimationMedia and galleries

Steps that scroll past a picture that holds

ScrollPage sections

Cards that stack as you scroll

ScrollCards and accordions