# Testimonial 5

> Quote cards in a carousel on a coloured band (from Marbrook)

A shadcn/ui block from the [@cnippet-blocks](https://blocks.cnippet.dev/?utm_source=shadcn.exchange) registry, listed on [shadcn.exchange](https://shadcn.exchange/r/cnippet-blocks/testimonial-5).

- Page, with a live preview: https://shadcn.exchange/r/cnippet-blocks/testimonial-5
- Screenshot: https://shadcn.exchange/shot/cnippet-blocks/testimonial-5/light.png
- Registry item: https://blocks.cnippet.dev/r/testimonial-5.json
- Categories: testimonial
- Listed: 2026-11-01, source last changed 2026-11-01

## Install

```bash
npx shadcn@latest add https://shadcn.exchange/r/cnippet-blocks/testimonial-5.json
```

Run it in a project that has shadcn/ui set up. It adds the files below and installs what they depend on.

## Dependencies

- npm packages: `lucide-react`
- Registry items: `@cnippet/carousel`, `@cnippet/utils`

## Files

### `registry/default/sections/testimonial-5/index.tsx`

```tsx
"use client";

import { Quote, Star } from "lucide-react";
import Image from "next/image";

import {
  Carousel,
  CarouselContent,
  CarouselItem,
  CarouselNext,
  CarouselPrevious,
} from "@/components/ui/carousel";
import { cn } from "@/lib/utils";

import type { Surface } from "../_types/common";
import type { TestimonialContent } from "../_types/testimonial";
import { defaultTestimonial5Content } from "./data";
import { SectionHeader, surfaceClass, toneFor } from "./section-header";

// Stable keys for the star row — the rating is never more than five.
const starSlots = ["one", "two", "three", "four", "five"];

const arrowClasses =
  "static size-12 translate-x-0 translate-y-0 border-current/20 bg-transparent text-current shadow-none before:shadow-none hover:bg-current/5 dark:bg-transparent";

/** Quote cards in a carousel on a coloured band, arrows beside the header. */
export default function Testimonial5({
  content = defaultTestimonial5Content,
  surface = "secondary",
}: {
  content?: TestimonialContent;
  surface?: Surface;
}) {
  return (
    <section className={cn("py-20 sm:py-28", surfaceClass[surface])}>
      <div className="mx-auto max-w-7xl px-5 sm:px-8 lg:px-12">
        <Carousel className="flex flex-col gap-10" opts={{ align: "start" }}>
          <SectionHeader
            action={
              <div className="flex items-center gap-2">
                <CarouselPrevious className={arrowClasses} variant="outline" />
                <CarouselNext className={arrowClasses} variant="outline" />
              </div>
            }
            description={content.description}
            eyebrow={content.eyebrow}
            title={content.title}
            tone={toneFor(surface)}
          />

          <CarouselContent className="-ml-5">
            {content.items.map((item) => (
              <CarouselItem
                className="basis-full pl-5 md:basis-1/2 lg:basis-1/3"
                key={item.name}
              >
                <figure className="flex h-full flex-col justify-between rounded-lg bg-card p-8">
                  <div>
                    <Quote className="size-8 text-secondary" />
                    {item.rating && (
                      <div className="mt-5 flex gap-0.5">
                        {starSlots.slice(0, item.rating).map((slot) => (
                          <Star
                            className="size-4 fill-primary text-primary"
                            key={`${item.name}-${slot}`}
                          />
                        ))}
                      </div>
                    )}
                    <blockquote className="mt-5 text-primary leading-relaxed">
                      {item.quote}
                    </blockquote>
                  </div>

                  <figcaption className="mt-8 flex items-center gap-4 border-border border-t pt-6">
                    <Image
                      alt={item.avatar.alt}
                      className="size-12 rounded-md object-cover"
                      height={48}
                      src={item.avatar.src}
                      width={48}
                    />
                    <div>
                      <p className="font-medium text-primary text-sm">
                        {item.name}
                      </p>
                      <p className="text-muted-foreground text-xs">
                        {item.context}
                      </p>
                    </div>
                  </figcaption>
                </figure>
              </CarouselItem>
            ))}
          </CarouselContent>
        </Carousel>
      </div>
    </section>
  );
}
```

### `registry/default/sections/testimonial-5/data.ts`

```ts
import type { TestimonialContent } from "../_types/testimonial";

export const defaultTestimonial5Content: TestimonialContent = {
  description:
    "Or send a friend. It is the only marketing metric we genuinely watch.",
  eyebrow: "Client stories",
  items: [
    {
      avatar: {
        alt: "Elena Whitfield",
        src: "https://res.cloudinary.com/dvwtcsh5v/image/upload/v1770279333/a5.jpg",
      },
      context: "Bought in Harbour District",
      name: "Elena Whitfield",
      quote:
        "They showed us four houses instead of forty, and the second one was ours. Nadia knew the building's history better than the vendor did — including the roof work we would have missed.",
      rating: 5,
    },
    {
      avatar: {
        alt: "Marcus Adeyemi",
        src: "https://res.cloudinary.com/dvwtcsh5v/image/upload/v1770279333/a6.jpg",
      },
      context: "Sold in Northgate Heights",
      name: "Marcus Adeyemi",
      quote:
        "We had the house listed elsewhere for seven months. Marbrook re-photographed it, repriced it honestly, and had three offers in a fortnight. It sold two percent above the guide.",
      rating: 5,
    },
    {
      avatar: {
        alt: "Priya Raghunathan",
        src: "https://res.cloudinary.com/dvwtcsh5v/image/upload/v1770279333/a2.jpg",
      },
      context: "Relocated from overseas",
      name: "Priya Raghunathan",
      quote:
        "I was buying from eight time zones away. Theo walked every room on video, answered questions at odd hours, and met the surveyor himself. It never once felt remote.",
      rating: 5,
    },
    {
      avatar: {
        alt: "Julian Vance",
        src: "https://res.cloudinary.com/dvwtcsh5v/image/upload/v1770279333/a3.jpg",
      },
      context: "Let a portfolio of four",
      name: "Julian Vance",
      quote:
        "Four flats, four tenancies, zero voids in three years. The reporting is clear and nobody calls me about a boiler at midnight anymore.",
      rating: 5,
    },
  ],
  title: "Sixty-eight percent come back",
};
```

### `registry/default/sections/testimonial-5/section-header.tsx`

```tsx
import type React from "react";

import { cn } from "@/lib/utils";

import type { Surface } from "../_types/common";

/** The small uppercase label that opens most headers. */
export const eyebrowClass =
  "inline-flex items-center gap-2 font-medium text-[0.6875rem] uppercase tracking-[0.22em]";

export const surfaceClass: Record<Surface, string> = {
  default: "bg-background text-foreground",
  muted: "bg-muted text-foreground",
  primary: "bg-primary text-primary-foreground",
  secondary: "bg-secondary text-secondary-foreground",
};

/**
 * Which band the header sits on. `photo` keeps literal white, because
 * `--primary-foreground` inverts in dark mode and would be unreadable over a
 * photograph.
 */
export type SectionTone = "light" | "photo" | "primary" | "secondary";

export function toneFor(surface: Surface): SectionTone {
  if (surface === "primary") return "primary";
  if (surface === "secondary") return "secondary";
  return "light";
}

const toneClasses: Record<
  SectionTone,
  { eyebrow: string; heading: string; lede: string; tick: string }
> = {
  light: {
    eyebrow: "text-muted-foreground/70",
    heading: "text-primary",
    lede: "text-muted-foreground",
    tick: "bg-secondary",
  },
  photo: {
    eyebrow: "text-white/50",
    heading: "text-white",
    lede: "text-white/65",
    tick: "bg-secondary",
  },
  primary: {
    eyebrow: "text-primary-foreground/40",
    heading: "text-primary-foreground",
    lede: "text-primary-foreground/60",
    tick: "bg-secondary",
  },
  secondary: {
    eyebrow: "text-secondary-foreground/50",
    heading: "text-secondary-foreground",
    lede: "text-secondary-foreground/70",
    tick: "bg-primary",
  },
};

export function SectionHeader({
  action,
  actionAt = "sm",
  className,
  description,
  eyebrow,
  size = "default",
  title,
  tone = "light",
}: {
  /** Rendered beside the heading block once `actionAt` is reached. */
  action?: React.ReactNode;
  /** A text link fits from `sm`; a row of filter tabs needs `lg`. */
  actionAt?: "lg" | "sm";
  className?: string;
  description?: React.ReactNode;
  eyebrow: string;
  /** `sm` is the narrow-sidebar size used by 4/8 splits. */
  size?: "default" | "sm";
  title: React.ReactNode;
  tone?: SectionTone;
}): React.ReactElement {
  const tones = toneClasses[tone];

  return (
    <div
      className={cn(
        action && "flex flex-col gap-6",
        action &&
          (actionAt === "lg"
            ? "gap-8 lg:flex-row lg:items-end lg:justify-between"
            : "sm:flex-row sm:items-end sm:justify-between"),
        className,
      )}
    >
      <div className={cn(action && "max-w-xl")}>
        <p className={cn(eyebrowClass, tones.eyebrow)}>
          <span className={cn("size-1", tones.tick)} />
          {eyebrow}
        </p>

        <h2
          className={cn(
            "mt-5 font-display",
            tones.heading,
            size === "sm"
              ? "text-3xl leading-[1.1] sm:text-4xl"
              : "text-4xl leading-[1.05] sm:text-5xl",
          )}
        >
          {title}
        </h2>

        {description && (
          <p className={cn("mt-4 max-w-xl leading-relaxed", tones.lede)}>
            {description}
          </p>
        )}
      </div>

      {action}
    </div>
  );
}
```

### `registry/default/sections/_types/common.ts`

```ts
/**
 * Shapes shared by every token-based section. Each section ships this file
 * alongside its own category types, so installing several sections simply
 * rewrites the same file.
 */

/** Which band a section sits on. A style choice, never part of `content`. */
export type Surface = "default" | "muted" | "primary" | "secondary";

export type ImageAsset = {
  alt: string;
  src: string;
};

export type LinkAction = {
  href: string;
  label: string;
};

/** Eyebrow + heading + optional lede, the header most sections open with. */
export type SectionIntro = {
  description?: string;
  eyebrow: string;
  title: string;
};

/** A figure that counts up when it scrolls into view. */
export type Stat = {
  decimals?: number;
  label: string;
  prefix?: string;
  suffix?: string;
  value: number;
};

/** A figure that is displayed as written ("1,240+", "4.9/5"). */
export type Highlight = {
  label: string;
  value: string;
};

export type FormField = {
  label: string;
  name: string;
  /** Only for `type: "select"`. The first option is the default. */
  options?: string[];
  placeholder?: string;
  required?: boolean;
  /** `full` spans both columns of a two-column form. */
  span?: "full" | "half";
  type?: "email" | "select" | "tel" | "text" | "textarea";
};

export type FormContent = {
  description?: string;
  fields: FormField[];
  note?: string;
  submitLabel: string;
  success: {
    description: string;
    resetLabel: string;
    title: string;
  };
  title: string;
};
```

### `registry/default/sections/_types/testimonial.ts`

```ts
import type { ImageAsset, SectionIntro } from "./common";

export type TestimonialContent = SectionIntro & {
  items: {
    avatar: ImageAsset;
    context: string;
    name: string;
    quote: string;
    /** 1–5 */
    rating?: number;
  }[];
};
```
