Content Community
A centered content section with a heading, body copy, and a wall of community avatars.
import type { Block } from 'payload'import { contentFields } from '@/blocks/shared/contentFields'export const ContentCommunity: Block = { slug: 'contentCommunity', interfaceName: 'ContentCommunityBlock', fields: [ // Shared content core (eyebrow, title, paragraphs). Variant-specific fields // follow; edit the shared shape in @/blocks/shared/contentFields. ...contentFields, { name: 'avatars', type: 'array', required: true, minRows: 3, maxRows: 24, admin: { initCollapsed: true, }, fields: [ { name: 'avatar', type: 'upload', relationTo: 'media', required: true, }, { name: 'name', type: 'text', required: true, }, { name: 'href', type: 'text', }, ], }, ], labels: { plural: 'Content Community Blocks', singular: 'Content Community', },}import React from 'react'import type { ContentCommunityBlock as ContentCommunityBlockData } from '@/payload-types'import { Media } from '@/components/Media'import { Badge } from '@/components/ui/badge'import { cn } from '@/utilities/ui'type Props = ContentCommunityBlockData & { id?: string className?: string disableInnerContainer?: boolean}export const ContentCommunityBlock: React.FC<Props> = ({ avatars, className, disableInnerContainer, eyebrow, id, paragraphs, title,}) => { 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-10 sm:px-8 lg:px-12 lg:py-14"> <div className={cn('flex flex-col gap-12', { 'mx-auto max-w-5xl': !disableInnerContainer, })} > <div className="mx-auto flex max-w-2xl flex-col items-center gap-6 text-center"> {eyebrow ? ( <Badge variant="outline" className="w-fit rounded-full px-3 py-1 uppercase tracking-eyebrow"> {eyebrow} </Badge> ) : null} <h2 className="text-3xl font-medium tracking-title text-balance sm:text-4xl">{title}</h2> {paragraphs && paragraphs.length > 0 ? paragraphs.map((paragraph, index) => ( <p className="text-base leading-7 text-muted-foreground" key={paragraph.id ?? index}> {paragraph.text} </p> )) : null} </div> {avatars && avatars.length > 0 ? ( <div className="mx-auto flex max-w-3xl flex-wrap justify-center gap-3"> {avatars.map((item, index) => { const avatar = ( <Media resource={item.avatar} imgClassName="h-full w-full object-cover" /> ) return item.href ? ( <a className="size-14 overflow-hidden rounded-full border border-border/70" href={item.href} key={item.id ?? `${item.name}-${index}`} title={item.name} > {avatar} </a> ) : ( <div className="size-14 overflow-hidden rounded-full border border-border/70" key={item.id ?? `${item.name}-${index}`} > {avatar} </div> ) })} </div> ) : null} </div> </div> </section> )}import type { Field } from 'payload'/** * Shared field core for the Content component family. * * Every content variant (content-columns, content-image-lead, * content-feature-media, content-feature-split, content-showcase, * content-quote, content-community, …) spreads these heading fields first and * then appends its own variant-specific shape — the media upload, feature * list, pull quote, or avatar wall that differs per layout. Editing the shared * eyebrow/title/paragraphs shape here updates every installed content block at * once, so the family never drifts field-by-field across a repo. * * The body copy is a repeatable `paragraphs` array of plain textareas (the * tailark content sections lead with one or two short marketing paragraphs); * editors add or remove paragraphs without a rich-text dependency. * * Installed once per repo at `src/blocks/shared/contentFields.ts`; re-running * `payload-components add content-*` never overwrites a copy you have already edited. */export const contentFields: Field[] = [ { name: 'eyebrow', type: 'text', }, { name: 'title', type: 'text', required: true, }, { name: 'paragraphs', type: 'array', minRows: 1, maxRows: 4, admin: { initCollapsed: true, }, fields: [ { name: 'text', type: 'textarea', required: true, }, ], },]Installation
npx payload-components add content-communityCopy the files straight from the registry, then wire the Payload fragments by hand:
pnpm dlx shadcn@latest add https://www.payload-components.xyz/r/content-community.jsonWhat it installs
Copies 3 source files into your project:
src/blocks/shared/contentFields.tssharedsrc/blocks/ContentCommunity/config.tssrc/blocks/ContentCommunity/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 |
contentFields.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
The eyebrow, title, and paragraphs fields come from the shared Content family base
(src/blocks/shared/contentFields.ts); the avatars list is specific to this variant.
Prop
Type
Each item in avatars carries:
Prop
Type
Usage
ContentCommunity 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
- badge
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
content-columnscontent-image-leadcontent-feature-mediacontent-feature-splitcontent-showcasecontent-quotecontent-communitycurrentcontent-split-rowscontent-rowscontent-image-framecontent-statscontent-listcontent-list-columnscontent-list-icons