• Features
  • Pricing
Get Started

Editorial FeedLaunch JournalEngineering NotesCommunity Stories
Shadcn Registry

Community Stories

A Paragraph CMS-native editorial grid for lightweight story cards.

Community Stories renders a lightweight editorial grid with a title, description, story cards, images, story kind, and published date.

Installation

pnpm dlx shadcn@latest add paragraphcms/shadcn-registry/community-stories
npx shadcn@latest add paragraphcms/shadcn-registry/community-stories
yarn dlx shadcn@latest add paragraphcms/shadcn-registry/community-stories
bunx --bun shadcn@latest add paragraphcms/shadcn-registry/community-stories

Install the runtime dependencies:

pnpm add @paragraphcms/client clsx tailwind-merge
npm install @paragraphcms/client clsx tailwind-merge
yarn add @paragraphcms/client clsx tailwind-merge
bun add @paragraphcms/client clsx tailwind-merge

Add these registry files to your project:

  • ui/community-stories.tsx
  • ui/aspect-ratio.tsx
  • lib/utils.ts

Keep the aliases aligned with your components.json: @/components/ui/* and @/lib/utils.

Prerequisites

You need a Paragraph CMS API key available only on the server:

.env
PARAGRAPH_API_KEY=your_api_key

Create a server-side Paragraph CMS client:

paragraph.config.ts
import { Client } from "@paragraphcms/client";

const apiKey = process.env.PARAGRAPH_API_KEY;

if (!apiKey) {
  throw new Error("PARAGRAPH_API_KEY environment variable is not set");
}

export const client = new Client({ apiKey });

Community Stories expects PageSummaryWithSlug[]. It uses post.heroUrl for story images, post.publishedAt for dates, and post.fields.kind or post.fields.storyKind for the story label.

Usage

Fetch story pages from Paragraph CMS and pass them to CommunityStories.

app/stories/page.tsx
import { CommunityStories } from "@/components/ui/community-stories";
import { client } from "@/paragraph.config";

export default async function StoriesPage() {
  const { data: posts, error } = await client.pages.list({
    collection: "stories",
    requiredSlug: true,
  });

  if (error) {
    throw error;
  }

  return (
    <CommunityStories
      base_path="/stories"
      description="Customer stories, community notes, and product updates."
      posts={posts}
      title="Stories"
    />
  );
}

By default, card links point to base_path#slug. Set fields.href or fields.url in Paragraph CMS when a story should link to a dedicated route.

Engineering Notes

A Paragraph CMS-native technical blog layout with search, filters, a featured post, and archive rows.

Examples

Starter projects and advanced integration examples for common Paragraph CMS stacks.

On this page

InstallationPrerequisitesUsage