Skip to content

Testimonials Slider

Horizontal slider of pastel testimonial cards with star ratings; round prev/next buttons move one card at a time and pill dots show the position.

soft-flat/section/testimonials-slider
Open ↗

Source

"use client";

import { useState } from "react";
import { ArrowLeft, ArrowRight, Star } from "lucide-react";
import { cn } from "@/lib/utils";

export interface TestimonialsSliderProps {
  title?: string;
  items?: { quote: string; name: string; role: string; rating: number }[];
  className?: string;
}

const TINTS = ["bg-da-accent text-da-accent-fg", "bg-da-secondary text-da-secondary-fg", "bg-da-primary/12", "bg-da-warning/25"];

const DEFAULT_ITEMS = [
  {
    quote: "Planning our content calendar used to be chaos. Now it’s a board and a weekly view — done.",
    name: "Mei Tanaka",
    role: "Content lead, Nook",
    rating: 5,
  },
  { quote: "The first productivity app that doesn’t make me feel behind.", name: "Tom Becker", role: "Founder, Parcelly", rating: 5 },
  { quote: "Guests are free, so our clients see progress without another login fee.", name: "Omar Haddad", role: "Agency owner", rating: 5 },
  { quote: "Recurring tasks + gentle reminders = our office finally runs itself.", name: "Jonas Weber", role: "Ops manager, Hive", rating: 4 },
];

/** Horizontal slider of pastel testimonial cards with star ratings; round prev/next buttons scroll by one card, dots show position. */
export function TestimonialsSlider({ title = "Kind words", items = DEFAULT_ITEMS, className }: TestimonialsSliderProps) {
  const [index, setIndex] = useState(0);
  const go = (d: number) => setIndex((i) => Math.min(items.length - 1, Math.max(0, i + d)));

  return (
    <section aria-roledescription="carousel" aria-label="Testimonials" className={cn("da-section overflow-hidden bg-da-bg text-da-fg", className)}>
      <div className="da-container">
        <div className="flex items-end justify-between gap-4">
          <h2 className="font-da-display text-[clamp(2rem,4.5vw,3rem)] font-extrabold tracking-da-display">{title}</h2>
          <div className="flex gap-2">
            <button
              type="button"
              onClick={() => go(-1)}
              disabled={index === 0}
              aria-label="Previous"
              className="da-focus da-transition grid size-12 place-items-center rounded-full bg-da-surface shadow-da-sm hover:-translate-y-0.5 disabled:opacity-40"
            >
              <ArrowLeft aria-hidden className="size-5" />
            </button>
            <button
              type="button"
              onClick={() => go(1)}
              disabled={index === items.length - 1}
              aria-label="Next"
              className="da-focus da-transition grid size-12 place-items-center rounded-full bg-da-primary text-da-primary-fg shadow-da-sm hover:-translate-y-0.5 disabled:opacity-40"
            >
              <ArrowRight aria-hidden className="size-5" />
            </button>
          </div>
        </div>
        <div className="mt-10">
          <ul
            className="flex gap-5 transition-transform duration-(--da-duration-slow) ease-da motion-reduce:transition-none"
            style={{ transform: `translateX(calc(-${index} * (min(420px, 85vw) + 1.25rem)))` }}
          >
            {items.map((t, i) => (
              <li
                key={t.name}
                aria-roledescription="slide"
                aria-label={`${i + 1} of ${items.length}`}
                aria-hidden={i < index}
                className="w-[min(420px,85vw)] shrink-0"
              >
                <figure className={cn("flex h-full flex-col rounded-da-lg p-8", TINTS[i % TINTS.length])}>
                  <p className="flex" aria-label={`${t.rating} out of 5 stars`}>
                    {Array.from({ length: 5 }, (_, k) => (
                      <Star key={k} aria-hidden className={cn("size-5", k < t.rating ? "fill-current" : "opacity-30")} />
                    ))}
                  </p>
                  <blockquote className="mt-5 flex-1 font-da-display text-xl leading-snug font-bold">“{t.quote}”</blockquote>
                  <figcaption className="mt-6 text-sm">
                    <span className="font-semibold">{t.name}</span> · <span className="opacity-85">{t.role}</span>
                  </figcaption>
                </figure>
              </li>
            ))}
          </ul>
        </div>
        <div className="mt-8 flex justify-center gap-2" aria-hidden>
          {items.map((_, i) => (
            <span key={i} className={cn("da-transition h-2 rounded-full", i === index ? "w-8 bg-da-primary" : "w-2 bg-da-border-strong")} />
          ))}
        </div>
      </div>
    </section>
  );
}

export default TestimonialsSlider;

modules/soft-flat/section/testimonials-slider/index.tsx

Props

PropTypeDefaultDescription
titlestring—Heading.
items{ quote, name, role, rating }[]—Cards.
classNamestring—Classes.

Other testimonials variants in Soft Flat

Testimonials in other art directions

Testimonials Big Quote

Full-bleed blue section showing one giant uppercase quote at a time with a tilted yellow metric card, author row, pressable prev/next buttons and bar-shaped pagination.

BrutalistTestimonials

Testimonials Logos

Case-study strip: four ruled cells, each with a company wordmark, a giant result number, its label and a one-line quote, alternating solid and paper tones.

BrutalistTestimonials

Testimonials Posts

Social-post wall: ruled cards styled like timeline posts (square colored avatar, handle, date, casual copy, reply/repost/like counts) in a 3-column grid with a 'see more' CTA.

BrutalistTestimonials

Testimonials Wall

Wall of quote cards in alternating solid colors with hard shadows, initials avatars and optional rotated metric stickers ("2× adoption").

BrutalistTestimonials

Testimonials Deck

Stacked deck of glass testimonial cards offset in depth; a ‘Next story’ button sends the top card to the back and the others slide forward, with a live counter.

GlassTestimonials

Testimonials Marquee

Two rows of frosted testimonial cards scrolling infinitely in opposite directions with faded edges, pause on hover, star rating summary above. A static sr-only list carries the content for assistive tech.

GlassTestimonials

Testimonials Masonry

Rating summary pill (stars, 4.9/5, review count) above a masonry wall of glass quote cards with star ratings; one highlight card is filled with the brand gradient.

GlassTestimonials

Testimonials Video

Three video-testimonial glass cards with gradient posters, initials, play button and duration; opening one expands a glass player panel above with headline, quote and author.

GlassTestimonials

Testimonials Carousel

One large quote at a time with initials avatar and role, cross-fading between slides; progress dots, a 01 / 04 counter and round prev/next buttons, arrow-key navigation.

MinimalTestimonials

Testimonials Case Studies

Three case-study cards led by an oversized mono metric in indigo (−71% pages), a short quote, author and a Read the story link that makes the whole card clickable.

MinimalTestimonials

Testimonials Grid

Asymmetric testimonial grid: one large featured quote with a headline metric, flanked by two compact quotes, then a second row. Hairline cards, initials avatars, no logos needed.

MinimalTestimonials

Testimonials Posts

Masonry wall of social-post cards in 1–3 CSS columns: initials avatar, name and handle, post text, date and like count. Hairline cards, centered header.

MinimalTestimonials

Testimonials Grid

Hairline grid of short quotes (gap-px on a border-colored background) — 3 columns desktop, each cell with the quote and mono attribution; no cards, no shadows.

Mono CleanTestimonials

Testimonials List

Testimonials as an editorial ruled list: each row pairs a mono index + name/studio/city on the left with the quote on the right in a larger size; rows separated by hairlines.

Mono CleanTestimonials

Testimonials Marquee

Slow horizontal ticker of short quotes in large display type, separated by signal dots, between two ink rules; pauses on hover, static and wrapped with reduced motion. Pure CSS.

Mono CleanTestimonials

Testimonials Quote

One oversized pull quote set in the display face with a hanging opening quote mark, mono attribution under a short ink rule; lots of whitespace.

Mono CleanTestimonials

Testimonials Cards

Clean 3-column grid of bordered quote cards with company name header, quote, and initials avatar + role footer divided by a hairline.

Neo CorporateTestimonials

Testimonials Case Study

Featured customer story: bordered card split into a company quote (logo wordmark, quote, author) and a tinted column of three big result metrics with a “Read the case study” link.

Neo CorporateTestimonials

Testimonials Logos

Row of customer wordmark buttons acting as tabs; selecting one swaps the quote, author and key metric below.

Neo CorporateTestimonials

Testimonials Ratings

Review-site proof: rating tiles per platform (score + stars + review count), a row of award badges, and two review excerpts.

Neo CorporateTestimonials

Testimonials Carousel

Gentle one-at-a-time carousel on a sage band: serif quote cross-fades, round prev/next buttons, leaf-shaped position dots; no autoplay.

Organic SoftTestimonials

Testimonials Notes

Kind words as handwritten-feeling notes: slightly tilted paper/sage/clay cards with italic serif quotes and a small “pinned” dot, straightening on hover.

Organic SoftTestimonials

Testimonials Portrait

Single large testimonial: an arch-shaped sage “portrait” with big initials and a leaf, next to a large serif quote, attribution and a clay result chip.

Organic SoftTestimonials

Testimonials Wall

Masonry wall of soft rounded quote cards in mixed tints (CSS columns), each with a small leaf-dot avatar, name and role.

Organic SoftTestimonials