Testimonials that change on their own. A ring around the active avatar shows how much time is left before the next one. The avatars are radio buttons: a click or the arrow keys pick a quote and restart the cycle from it. The rotation itself is one CSS animation shared by quotes, avatars and rings, so it pauses only while the cursor is over the avatar that is playing now, all without JavaScript. It is a Server Component.
Browser Support
Styles elements based on their contents
Colors the selected review controls
Balances review text wrapping
Animates the review change
Preview
Hover the current avatar to pause the rotation.
We replaced three internal tools with one dashboard. Onboarding a new teammate now takes an afternoon.
The API is boring in the best way. It does what the docs say, every single time.
Support answered faster than our own team chat. That alone made us stay.
We shipped the redesign two weeks early and nobody had to work a weekend.
Installation
Usage
import { TestimonialRotator } from "@/components/ui/testimonial-rotator"
const items = [
{
quote: "We shipped the redesign two weeks early.",
author: "Tom Becker",
role: "Product manager, Quietbyte",
avatar: "/avatars/tom-becker.webp",
},
{
quote: "Support answered faster than our own team chat.",
author: "Priya Nair",
role: "Founder, Little Orbit",
avatar: "/avatars/priya-nair.webp",
},
]
export default function Example() {
return <TestimonialRotator items={items} />
}Examples
Avatars on the side
orientation="horizontal" puts the avatars in a column on the left from the md breakpoint. Here the interval is 4 seconds.
We replaced three internal tools with one dashboard. Onboarding a new teammate now takes an afternoon.
The API is boring in the best way. It does what the docs say, every single time.
Support answered faster than our own team chat. That alone made us stay.
We shipped the redesign two weeks early and nobody had to work a weekend.
<TestimonialRotator items={items} orientation="horizontal" interval={4000} />Manual switching
With autoPlay={false} the quotes change only on click or with the arrow keys. The ring stays as a marker of the active avatar.
We replaced three internal tools with one dashboard. Onboarding a new teammate now takes an afternoon.
The API is boring in the best way. It does what the docs say, every single time.
Support answered faster than our own team chat. That alone made us stay.
<TestimonialRotator items={items} autoPlay={false} defaultIndex={1} />Photos and custom avatars
Pass a square photo URL (160px is enough for the 56px avatar at 2x) or any node in avatar. The photo is a round <img> with lazy loading: inactive ones are dimmed, the active one is at full brightness inside the progress ring. Without avatar the component draws initials on a colored background.
const items = [
{ quote: "…", author: "Lena Hart", avatar: "/avatars/lena-hart.webp" },
{ quote: "…", author: "Marco Silva", avatar: <UserIcon className="size-5" /> },
{ quote: "…", author: "Priya Nair" }, // initials "PN"
]
<TestimonialRotator
items={items}
labels={{ show: (author) => `Read ${author}`, region: "Customer stories" }}
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| items | Testimonial[] | - | List of testimonials |
| interval | number | 6000 | Time per testimonial in ms |
| autoPlay | boolean | true | Switch testimonials automatically |
| defaultIndex | number | 0 | Testimonial shown first |
| name | string | useId() | Name of the radio group. Generated when omitted |
| orientation | "vertical" | "horizontal" | "vertical" | Avatars below the quote or in a column on the left |
| labels | Partial<TestimonialRotatorLabels> | - | Texts: show(author) for the avatar radios, region for the section |
| className | string | - | Additional CSS classes |
Testimonial
| Prop | Type | Default | Description |
|---|---|---|---|
| quote | ReactNode | - | Quote text |
| author | string | - | Author name, also used for initials |
| role | ReactNode | - | Position, company or any caption |
| avatar | string | ReactNode | initials | Square photo URL (160px or more) or a custom node. Falls back to initials |
Features
- No JavaScript: radio buttons and one CSS animation, a Server Component
- Progress ring: the SVG ring fills up until the next switch
- Pause: only on hover over the avatar that is playing now
- Reduced motion: with prefers-reduced-motion automatic switching is off
- Keyboard: the avatars are a radio group: Tab to enter, arrows to switch