Testimonials Quote
A single featured customer testimonial — a quote with a left accent bar, author, optional role, and avatar.
import type { Block } from 'payload'import { testimonialItemFields } from '@/blocks/shared/testimonialFields'export const TestimonialsQuote: Block = { slug: 'testimonialsQuote', interfaceName: 'TestimonialsQuoteBlock', fields: [ // A single featured testimonial — the shared one-quote shape (quote, author, // optional role, optional avatar). Edit the shared shape in // @/blocks/shared/testimonialFields to update every testimonials variant. ...testimonialItemFields, ], labels: { plural: 'Testimonials Quote Blocks', singular: 'Testimonials Quote', },}import React from 'react'import type { TestimonialsQuoteBlock as TestimonialsQuoteBlockData } from '@/payload-types'import { Media } from '@/components/Media'import { cn } from '@/utilities/ui'// Layout adapted from tailark/blocks (MIT) — re-implemented as a Payload block.type Props = TestimonialsQuoteBlockData & { id?: string className?: string disableInnerContainer?: boolean}export const TestimonialsQuoteBlock: React.FC<Props> = ({ author, avatar, className, disableInnerContainer, id, quote, role,}) => { return ( <section className={cn('container', className)} id={id ? `block-${id}` : undefined}> <div className="overflow-hidden rounded-frame border border-border/70 bg-card/35 px-6 py-12 sm:px-8 lg:px-12 lg:py-16"> <figure className={cn('border-l-2 border-primary pl-6', { 'mx-auto max-w-2xl': !disableInnerContainer, })} > <blockquote className="text-pretty text-xl leading-8 text-foreground sm:text-2xl"> {quote} </blockquote> <figcaption className="mt-6 flex items-center gap-3"> {avatar ? ( <div className="flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-full border border-border/70 bg-card"> <Media resource={avatar} imgClassName="size-full object-cover" /> </div> ) : null} <cite className="text-sm font-medium not-italic text-foreground">{author}</cite> {role ? ( <> <span aria-hidden="true" className="size-1 rounded-full bg-foreground/25" /> <span className="text-sm text-muted-foreground">{role}</span> </> ) : null} </figcaption> </figure> </div> </section> )}import type { Field } from 'payload'/** * Shared field core for the Testimonials component family. * * Every testimonials variant spreads `testimonialFields` first for the shared * section heading (eyebrow + title + intro), then appends its own * variant-specific shape — a grid of cards, a star rating, a bento, or a dense * wall. Editing the shared heading here updates every installed testimonials * block at once, so the family never drifts field-by-field across a repo. * * `testimonialItemFields` is the one-quote shape (quote, author, optional role, * optional avatar upload) reused everywhere a testimonial appears — as the array * items in the grid/rating/bento/wall variants, and as the single subject of the * quote/spotlight variants — so a testimonial looks the same wherever it shows. * Each avatar is an editable Media upload, so editors manage social proof from * the admin instead of shipping hardcoded image URLs. * * Installed once per repo at `src/blocks/shared/testimonialFields.ts`; re-running * `payload-components add testimonials-*` never overwrites a copy you have * already edited. */export const testimonialFields: Field[] = [ { name: 'eyebrow', type: 'text', }, { name: 'title', type: 'text', required: true, }, { name: 'description', type: 'textarea', },]export const testimonialItemFields: Field[] = [ { name: 'quote', type: 'textarea', required: true, }, { name: 'author', type: 'text', required: true, }, { name: 'role', type: 'text', }, { name: 'avatar', type: 'upload', relationTo: 'media', },]Installation
npx payload-components add testimonials-quoteCopy the files straight from the registry, then wire the Payload fragments by hand:
pnpm dlx shadcn@latest add https://payload-components.xyz/r/testimonials-quote.jsonWhat it installs
Copies 3 source files into your project:
src/blocks/shared/testimonialFields.tssharedsrc/blocks/TestimonialsQuote/config.tssrc/blocks/TestimonialsQuote/Component.tsx
…and makes 4 edits to wire the block into your project:
| Registers the block | src/collections/Pages/index.ts |
| Maps the renderer | src/blocks/RenderBlocks.tsx |
| Regenerates types | src/payload-types.ts |
| Regenerates the admin import map | src/app/(payload)/admin/importMap.js |
testimonialFields.ts is the shared field core for this family — every variant composes it. Editing it updates each installed block at once, and re-running an install never overwrites a copy you have changed.Re-running the install converges: it detects existing wiring, skips it, and records install state in .payload-components/state.json.
Content model
quote, author, role, and avatar come from the shared Testimonials family
base (src/blocks/shared/testimonialFields.ts), used here as a single featured testimonial.
Prop
Type
Usage
TestimonialsQuote block to its layout.RenderBlocks on the frontend, fully typed — no extra wiring.Requirements
- Target
- payload-website-starter
- Payload
- v3
- Next.js
- 15 / 16
- shadcn UI
- none
Your project must already expose components.json, src/payload.config.ts, src/blocks/RenderBlocks.tsx, src/collections/Pages/index.ts — the surfaces payload-components add patches. The CLI verifies this against the support matrix before touching anything.
In this family
testimonials-gridtestimonials-bentotestimonials-walltestimonials-ratingtestimonials-spotlighttestimonials-quotecurrent