Loading...
I've thoroughly explored the multi-store blocks system and created comprehensive documentation. Here's what you now have:
BLOCKS_SYSTEM_GUIDE.md (Main Reference)
BLOCKS_CREATION_CHECKLIST.md (Implementation Guide)
BLOCKS_QUICK_REFERENCE.md (Visual Guide)
BLOCKS_EXAMPLES.md (Copy-Paste Ready)
Block Config (defines data shape)
↓
Payload Admin UI (editor interface)
↓
Database (stores block data)
↓
API (returns block data)
↓
RenderBlocks (maps type → component)
↓
React Component (renders HTML)
apps/multi-store/src/
├── blocks/ # All block definitions
│ ├── RenderBlocks.tsx # Dynamic component router
│ ├── CallToAction/
│ ├── Banner/
│ ├── ShopBlocks/ # Shop-specific blocks
│ │ ├── ShopHero/
│ │ ├── ShopFilters/
│ │ ├── ShopProductGrid/
│ │ └── ShopSearch/
│ ├── ProductBlocks/ # Product-specific blocks
│ └── [30+ more blocks]
│
├── collections/
│ ├── contentTabField.ts # Shared content blocks (Pages + Products)
│ ├── Pages/
│ │ └── config.ts # Uses contentTabField
│ └── Products/
│ └── config.ts # Uses contentTabField
│
└── globals/
└── Shop/
└── config.ts # Custom shop blocks
MyBlock/
├── config.ts
│ └── export const MyBlock: Block = {
│ slug: "my-block" ← Unique ID
│ interfaceName: "Props" ← Type name
│ fields: [/* data schema */] ← What editor inputs
│ }
│
└── Component.tsx
└── export const MyBlockComponent = (props) => {
return <html>...</html>
}
contentTabField
contentTabField
| Category | Blocks | Purpose |
|---|---|---|
| Content | Banner, CTA, Content, Hero variants | Text & rich content |
| Layout | Carousel, Grid, Features, Pricing | Structured layouts |
| Shop | ShopHero, Filters, ProductGrid, Search | E-commerce specific |
| Products | Details, Gallery, RichText, Related | Product pages |
| Overlays | Cookie, Offer, AIChatOverlay, Timer | Modal/floating content |
| Shared | 20+ from @repo/payload-blocks | Reusable across projects |
config.ts with all fieldsComponent.tsx with rendering logicRenderBlocks.tsxJust tell me:
Block Name: ________
Purpose: ________
Fields needed: ________
Collections: Pages / Shop / Products / Custom
Special features: ________
Example:
Block Name: Testimonials Grid
Purpose: Display customer testimonials in a grid layout
Fields: title, testimonials (array with author/text/rating), columns (2/3/4)
Collections: Pages
Special features: Star rating display, conditional columns based on screen size
Then I'll create the complete implementation! 🚀
BLOCKS_QUICK_REFERENCE.mdBLOCKS_SYSTEM_GUIDE.mdBLOCKS_EXAMPLES.md and follow BLOCKS_CREATION_CHECKLIST.mdBLOCKS_EXAMPLES.mdEvery block has exactly:
config.ts - Defines the shape (what data it stores)Component.tsx - Renders the HTMLThe slug in config becomes the key in blockComponents:
export const MyBlock: Block = {
slug: "my-block", // ← This becomes the key
}
// Maps to:
const blockComponents = {
"my-block": MyBlockComponent, // ← Slug as key
}
Collections say "these blocks are available here":
// In Pages collection:
blocks: [Block1, Block2, Block3] // ← Blocks available for pages
// In Shop Global:
blocks: [ShopBlock1, ShopBlock2] // ← Different blocks for shop
When rendering a page:
const blockType = "my-block" // From database
const Component = blockComponents[blockType] // Look up component
<Component {...blockData} /> // Render it
After creating a block:
bun run gen
# → Generates MyBlockProps interface in payload-types.ts
# → Use it: interface MyBlockComponentProps extends MyBlockProps { }
docs/dev/
├── BLOCKS_SYSTEM_GUIDE.md ← Comprehensive reference (read first)
├── BLOCKS_QUICK_REFERENCE.md ← Visual diagrams & quick lookup
├── BLOCKS_CREATION_CHECKLIST.md ← Step-by-step implementation guide
└── BLOCKS_EXAMPLES.md ← Copy-paste ready examples
The blocks system is:
I've done the research and documentation. I'm ready to create blocks whenever you tell me what you need.
Just give me:
Let's build! 🚀