# Testimonial wall of real life changes (记录真实生活变化的用户评价墙)

A centered heading, one large featured quote, and a three-column wall of short quotes. Each quote names one concrete change in someone's life, with initials avatars and a role or city. No photos, star rows or rating totals.

- Ref: `component/testimonial-wall` (component · reviews)
- Page: https://uifino.com/en/components/reviews/testimonial-wall
- Markdown: https://uifino.com/md/components/testimonial-wall.md
- Preview image: https://uifino.com/blocks/covers/testimonial-wall-dark.webp

## Install

- shadcn: `npx shadcn@latest add "https://uifino.com/r/blocks/testimonial-wall.json"`
- UIFino CLI: `npx uifino@latest add component/testimonial-wall`

## shadcn/ui components it builds on

- `avatar`, `button`. The shadcn CLI installs them together with the block.

## Layout borrowed from

- https://www.raycast.com: Borrowed the short centered two-line heading, the quiet quote-then-person identity row and the generous vertical rhythm of its 'Built for professionals' section. The wall layout, copy and warm light palette are original.

## Theme

The block reads the project's shadcn theme variables, so it follows whatever DESIGN.md the project uses and needs no options of its own.
To give the project the look of a UIFino brand or style, install its theme: `npx shadcn@latest add "https://uifino.com/r/themes/oura.json"`.

## Usage

The files under `examples/` show the block wired with content, including its loading, empty and error states where it has them.

## Files

| Path | Role | Size |
| :--- | :--- | ---: |
| components/blocks/testimonial-wall/examples/content.ts | demo | 6.8 KB |
| components/blocks/testimonial-wall/examples/default.tsx | demo | 378 B |
| components/blocks/testimonial-wall/examples/featured.tsx | demo | 304 B |
| components/blocks/testimonial-wall/testimonial-wall.tsx | source | 5.0 KB |

### components/blocks/testimonial-wall/testimonial-wall.tsx

```tsx
"use client";

import { useState } from "react";
import { Avatar, AvatarFallback } from "@/components/ui/avatar";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";

export interface Testimonial {
  readonly quote: string;
  readonly name: string;
  readonly role: string;
  readonly highlight?: { readonly value: string; readonly label: string };
}

export interface TestimonialWallLabels {
  readonly showMore: string;
  readonly showLess: string;
}

export interface TestimonialWallProps {
  readonly title: string;
  readonly description?: string;
  readonly featured: Testimonial;
  readonly items?: readonly Testimonial[];
  readonly collapsedCount?: number;
  readonly labels?: TestimonialWallLabels;
}

const avatarTones = ["bg-chart-1/20", "bg-chart-2/20", "bg-chart-3/20", "bg-chart-4/20", "bg-chart-5/20"] as const;

function initials(name: string) {
  const parts = name.trim().split(/\s+/);
  const first = parts[0] ?? "";
  const last = parts[parts.length - 1] ?? "";
  if (parts.length === 1) return Array.from(first).slice(-2).join("");
  return (Array.from(first)[0] ?? "") + (Array.from(last)[0] ?? "").toUpperCase();
}

function Person({ name, role, tone, large }: { name: string; role: string; tone: number; large?: boolean }) {
  return (
    <figcaption className="flex min-w-0 items-center gap-3 text-left">
      <Avatar className={cn("bg-background", large ? "size-12" : "size-9")}>
        <AvatarFallback className={cn("text-sm font-medium text-foreground", avatarTones[tone % avatarTones.length])}>
          {initials(name)}
        </AvatarFallback>
      </Avatar>
      <span className="min-w-0">
        <span className="block truncate text-sm font-medium text-foreground">{name}</span>
        <span className="block truncate text-sm text-muted-foreground">{role}</span>
      </span>
    </figcaption>
  );
}

function Highlight({ value, label }: { value: string; label: string }) {
  return (
    <p className="flex flex-col gap-1">
      <span className="font-heading text-3xl font-medium">{value}</span>
      <span className="text-sm text-muted-foreground">{label}</span>
    </p>
  );
}

export function TestimonialWall({ title, description, featured, items = [], collapsedCount = 4, labels }: TestimonialWallProps) {
  const [expanded, setExpanded] = useState(false);
  const hasItems = items.length > 0;
  const canCollapse = Boolean(labels) && items.length > collapsedCount;
  return (
    <section className="@container bg-background text-foreground">
      <div className="mx-auto max-w-5xl px-4 py-16 @3xl:px-8 @3xl:py-24">
        <header className="mx-auto max-w-xl text-center">
          <h2 className="font-heading text-3xl font-semibold tracking-normal text-balance text-foreground @3xl:text-4xl">
            {title}
          </h2>
          {description ? (
            <p className="mt-3 text-base text-balance text-muted-foreground @3xl:text-lg">{description}</p>
          ) : null}
        </header>

        <figure
          className={cn(
            "mx-auto flex flex-col items-center gap-6 text-center",
            hasItems ? "mt-12 max-w-2xl @3xl:mt-16" : "mt-10 max-w-3xl @3xl:mt-14"
          )}
        >
          {featured.highlight ? <Highlight value={featured.highlight.value} label={featured.highlight.label} /> : null}
          <blockquote
            className={cn(
              "font-medium text-pretty text-foreground",
              hasItems ? "text-xl leading-snug @3xl:text-2xl" : "text-2xl leading-snug @3xl:text-3xl"
            )}
          >
            {featured.quote}
          </blockquote>
          <Person name={featured.name} role={featured.role} tone={2} large />
        </figure>

        {hasItems ? (
          <>
            <div className="mt-12 columns-1 gap-4 @2xl:columns-2 @4xl:columns-3 @3xl:mt-16">
              {items.map((item, index) => (
                <figure
                  key={`${item.name}-${index}`}
                  className={cn(
                    "mb-4 flex break-inside-avoid flex-col gap-5 rounded-xl border border-border bg-card p-5 text-card-foreground",
                    canCollapse && !expanded && index >= collapsedCount && "hidden @2xl:flex"
                  )}
                >
                  <div className="flex flex-col gap-3">
                    {item.highlight ? <Highlight value={item.highlight.value} label={item.highlight.label} /> : null}
                    <blockquote className="text-base leading-relaxed text-pretty">{item.quote}</blockquote>
                  </div>
                  <Person name={item.name} role={item.role} tone={index} />
                </figure>
              ))}
            </div>
            {canCollapse && labels ? (
              <div className="mt-6 flex justify-center @2xl:hidden">
                <Button variant="outline" aria-expanded={expanded} onClick={() => setExpanded((value) => !value)}>
                  {expanded ? labels.showLess : labels.showMore}
                </Button>
              </div>
            ) : null}
          </>
        ) : null}
      </div>
    </section>
  );
}
```

Not inlined (3 files, 7.5 KB). Full sources: https://uifino.com/r/blocks/testimonial-wall.json
