Overview
Adding new blocks to the Blocks registry involves several steps, from creating the component to registering it in the metadata files. This guide walks you through the entire process.We ask that you add blocks to existing categories rather than creating new ones. If you have ideas for a new category, please open an issue to discuss it with the maintainers.
Available Categories
Blocks must be added to one of the existing categories defined incontent/blocks-categories.tsx:
- AI Components - AI-powered components and interfaces
- Command Menu - Command palettes and quick actions
- Dialogs - Modal dialogs and alerts
- File Upload - File upload interfaces and dropzones
- Form Layout - Form layouts and input groups
- Grid List - Grid and list layouts
- Login & Signup - Authentication interfaces
- Onboarding - User onboarding flows
- Sidebar - Sidebar navigation components
- Stats - Statistics and metrics displays
- Tables - Data tables and lists
Step-by-Step Guide
Create the component file
Create your component in the appropriate category directory:For example, to add a new login block:
Export from category index
Add an export for your component in the category’s This makes your component available for import in the registry.
index.ts file:Register metadata
Add metadata for your block in Metadata fields:
content/blocks-metadata.ts:id- Unique identifier for the block (matches filename)category- Category ID fromcategoryIdsconstantname- Display name for the blockiframeHeight- Height for the preview iframe (optional)type- Either"file"or"directory"based on block structure
Map the component
Add your component to the component mapping in This connects your component to its metadata.
content/blocks-components.tsx:Generate the registry
Run the registry generation script to create the JSON files:This will:
- Generate individual JSON files for each block in
public/r/ - Create the main
registry.jsonfile - Validate the registry structure
Block Types
Blocks can be one of two types:File Type
Single-file components that are self-contained:.tsx file.
Directory Type
Multi-file components with additional dependencies or sub-components:File Structure Example
Here’s how a category directory should look:Testing Blocks Locally
Before submitting your block, test it thoroughly:Common Issues
Block not appearing
If your block doesn’t appear after adding it:- Verify the block is exported in the category’s
index.ts - Check that metadata is added to
blocks-metadata.ts - Ensure component mapping exists in
blocks-components.tsx - Run
bun run generate:registryto regenerate the registry - Restart the development server
Registry generation fails
If registry generation fails:- Check for syntax errors in your component
- Verify all imports are correct
- Ensure the category ID is valid
- Run with verbose flag to see detailed errors:
TypeScript errors
Ensure your component:- Uses proper TypeScript types
- Imports components from the correct paths
- Follows the existing code patterns
The registry generation script automatically validates your block structure and will report errors if something is misconfigured.
Next Steps
After adding your block:- Follow the guidelines for code quality
- Review the overview for the pull request process
- Test your block thoroughly before submitting
- Include screenshots in your pull request description