# Testimonials

> One quote, chosen by its people: faces step forward, the words cross-fade through a blur, a ring keeps time.

A carousel of quote cards asks people to read three things at once. This shows one quote and the people behind it. Choose a face and it steps forward while the others step back; the quote’s height eases to the new words as they cross-fade through a soft blur, and the name morphs letter by letter. With autoplay, a thin ring draws itself around the chosen face as the timer and hands over when it closes, pausing whenever you point at it.

## Install

```bash
npx shadcn@latest add https://hairlineui.com/r/testimonials.json
```

Needs React 19, Tailwind CSS v4 and shadcn/ui theme variables (any style, light and dark). Icons from lucide-react.

- npm: none
- Hairline UI components it needs (the CLI installs them too): `text-morph`
- Docs and live preview: https://hairlineui.com/ui/testimonials
- Registry item (source): https://hairlineui.com/r/testimonials.json

## Usage

```tsx
import { Testimonials } from "@/components/testimonials";

<Testimonials
  autoplay={5200}
  items={[{ quote: "It looks like we hired a studio.", name: "Daniel Okafor", role: "Solo maker", avatar: "/daniel.jpg" }]}
/>
```

## In a proof section

Feed it the quotes you have; photos are optional (tinted initials stand in).

```tsx
import { Testimonials } from "@/components/testimonials";

export default async function Proof() {
  const quotes = await getApprovedTestimonials(); // your CMS or a JSON file

  return (
    <section className="mx-auto max-w-xl py-24">
      <Testimonials
        autoplay={6000}
        items={quotes.map((q) => ({ quote: q.text, name: q.author, role: q.company, avatar: q.photoUrl }))}
      />
    </section>
  );
}
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `items` | `{ quote; name; role?; avatar? }[]` | – | Each person and what they said. Without an avatar, initials tinted from the name. |
| `autoplay` | `number` | – | Move to the next person every this many ms, with the ring as the timer. Off with reduced motion. |
| `defaultIndex` | `number` | `0` | Who speaks first. |

## States

- **choose**: The chosen face scales to full and full colour; the others step back to 88%, faded and greyed.
- **change**: Old words lift and blur away, new ones rise in (520ms) while the block eases to their height; the name morphs and the role fades in.
- **autoplay**: A 1.25px ring draws around the chosen face over the interval, then the next person speaks. Pointer or focus inside pauses it.

## What it handles

A carousel of quote cards asks people to read three things at once. This shows one quote and the person behind it, which is how people actually decide whether to trust it.

- **Choose a face**: The chosen face steps forward in full colour while the others step back.
- **The quote cross-fades**: The old words blur away, the new ones rise in, the block eases to their height and the name morphs.
- **Autoplay with a ring**: A thin ring draws around the chosen face as the timer, and pauses when you point at it.
- **Photos are optional**: Without an avatar, tinted initials stand in.
- **A real radio group**: Faces are labelled with each name and role, and arrow keys, Home and End move between people.
- **Quiet when it should be**: Without autoplay a new choice is read out. With autoplay it stays silent, so it never talks over a reader.

## Replaces

a testimonial carousel, avatar selection, quote transitions, an autoplay timer, initials fallbacks

## Where it fits

- **Landing page social proof**: Quotes from customers under the hero or the features.
- **Pricing pages**: Reassurance next to the plans.
- **Case study pages**: Several voices from one customer or team.
- **Product pages**: A few people saying why they use it, in their own words.

## Notes

- The faces are a radio group labelled with each name and role; arrow keys, Home and End move between people.
- Without autoplay the quote is a polite live region, so a new choice is read out; with autoplay it stays quiet.
- The ring timer is a CSS animation that pauses with play-state, so nothing re-renders while it runs.
- Installs Text morph alongside it. With reduced motion, quotes change in place.

License: MIT (https://hairlineui.com/license#components)
