Cards & content / Carousels

Grayscale Story Carousel

Horizontal row of large rounded-corner-free cards with grayscale interview photography under a dark bottom gradient, mono pixel title overlay top-left, triangle mark and caption bottom-left. Below: arrow buttons and a thin progress track with dark fill.

Rebuilt from vercel.com/customers in the Monochrome Precision style.

npx shadcn@latest add https://justyoink.it/r/monochrome-precision/blocks/video-story-carousel.json

Looks exactly like vercel.com: brings its fonts and colours, namespaced so your own theme stays untouched.

Images4 in this component. Swap any for a library image or one of your own.All images in this style →

Choose an image

Image

Loading…

Usage

Pass `heading` and a `stories` array of {title, caption, image, position}. Arrows scroll the track by one card, the progress bar follows scroll, and the left arrow fades when disabled.

components/video-story-carousel.tsx
import { useEffect, useRef, useState } from "react";

type Story = { title: string; caption: string; image: string; position?: string };

type Props = {
  heading?: string;
  stories?: Story[];
};

const defaults: Story[] = [
  { title: "// customer_stories\n_Altura", caption: "How Altura ships reviewed changes to production in under ten minutes.", image: "https://yoink-app.fly.dev/stock/people-2.jpg", position: "50% 40%" },
  { title: "// customer_stories\n_Kitefield", caption: "Kitefield rebuilt its storefront for faster page loads worldwide.", image: "https://yoink-app.fly.dev/stock/workspace-6.jpg", position: "50% 50%" },
  { title: "// customer_stories\n_Northwind", caption: "Northwind cut its release cycle from weeks to a single afternoon.", image: "https://yoink-app.fly.dev/stock/office-1.jpg", position: "50% 50%" },
  { title: "// customer_stories\n_Lumen", caption: "Lumen scales campaign launches without adding infrastructure work.", image: "https://yoink-app.fly.dev/stock/interior-1.jpg", position: "50% 50%" },
];

export default function GrayscaleStoryCarousel({ heading = "Customer stories", stories = defaults }: Props) {
  const ref = useRef<HTMLDivElement>(null);
  const [progress, setProgress] = useState(0.35);
  const [atStart, setAtStart] = useState(true);
  const [atEnd, setAtEnd] = useState(false);

  const update = () => {
    const el = ref.current;
    if (!el) return;
    const max = el.scrollWidth - el.clientWidth;
    const ratio = el.scrollWidth ? el.clientWidth / el.scrollWidth : 1;
    const p = max > 0 ? el.scrollLeft / max : 0;
    setProgress(ratio + (1 - ratio) * p);
    setAtStart(el.scrollLeft <= 2);
    setAtEnd(el.scrollLeft >= max - 2);
  };

  useEffect(() => {
    update();
    window.addEventListener("resize", update);
    return () => window.removeEventListener("resize", update);
  }, []);

  const scrollBy = (dir: number) => {
    const el = ref.current;
    if (!el) return;
    const card = el.firstElementChild as HTMLElement | null;
    el.scrollBy({ left: dir * ((card?.offsetWidth ?? 600) + 16), behavior: "smooth" });
  };

  const btn = "flex h-8 w-8 items-center justify-center rounded-pill text-ink backdrop-blur-[4px] transition-opacity focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-link-blue disabled:opacity-30";

  return (
    <section className="bg-canvas px-4 py-10 text-ink md:px-6">
      <h2 className="mb-8 font-sans text-h1 tracking-[-0.04em] md:text-display">{heading}</h2>
      <div ref={ref} onScroll={update} className="flex snap-x snap-mandatory gap-4 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
        {stories.map((s, i) => (
          <article key={i} className="relative aspect-[974/548] min-h-[360px] w-[88%] shrink-0 snap-start overflow-hidden bg-[#171717] md:w-[70%]">
            <img src={s.image} alt="" width={1600} height={1067} loading={i === 0 ? undefined : "lazy"} className="absolute inset-0 h-full w-full object-cover grayscale" style={{ objectPosition: s.position }} />
            <div className="absolute inset-0 bg-black/20" />
            <div className="absolute inset-x-0 bottom-0 h-1/2 bg-[linear-gradient(to_top,#171717,transparent)]" />
            <h3 className="absolute left-6 top-8 whitespace-pre-line font-mono text-[28px] leading-[1.9rem] text-white/90 md:left-[30px] md:top-[50px] md:text-[34px] md:leading-[52px]">{s.title}</h3>
            <div className="absolute bottom-6 left-6 right-6">
              <svg width="48" height="42" viewBox="0 0 48 42" aria-hidden="true" className="mb-4 ml-1 text-white/40"><path d="M24 0 48 42H0z" fill="currentColor" /></svg>
              <p className="text-ui text-white">{s.caption}</p>
            </div>
          </article>
        ))}
      </div>
      <div className="mt-4 flex items-center gap-4">
        <div className="flex gap-2">
          <button type="button" aria-label="Previous stories" disabled={atStart} onClick={() => scrollBy(-1)} className={btn}>
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5"><path d="M10 3 5 8l5 5" /></svg>
          </button>
          <button type="button" aria-label="Next stories" disabled={atEnd} onClick={() => scrollBy(1)} className={btn}>
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5"><path d="m6 3 5 5-5 5" /></svg>
          </button>
        </div>
        <div className="h-[3px] flex-1 bg-hairline" role="progressbar" aria-valuemin={0} aria-valuemax={100} aria-valuenow={Math.round(progress * 100)} aria-label="Carousel progress">
          <div className="h-full bg-ink transition-[width] duration-300" style={{ width: `${progress * 100}%` }} />
        </div>
      </div>
    </section>
  );
}

Quality checks

Automated, in a real browser · 4d ago
—

More from Monochrome Precision

The whole style →

Ink and Ghost Button Pair

Buttons

Dashed Orbit Integration Ring

Animated graphics

Customer Story Index List

Lists

Centered Quote with Meta Row

Testimonials

Hairline Navigation Bar

Headers & nav bars

Floating Triangle Hero with Logo Strip

Heroes