Installation
Blocks is built on top of shadcn/ui and requires a React project with Tailwind CSS. Follow these steps to set up your project and start using Blocks.Prerequisites
Before installing Blocks, ensure you have:- Node.js 18+ - Required for running the shadcn CLI and build tools
- React 19+ - Blocks uses React 19 features
- A React project - Next.js, Remix, Vite, or any React framework
- Tailwind CSS - Configured in your project for styling
Step-by-Step Installation
Install shadcn/ui
If you haven’t already set up shadcn/ui in your project, initialize it:This will:
- Create a
components.jsonconfiguration file - Set up your
components/uidirectory - Configure Tailwind CSS with the necessary presets
- Install required dependencies like
class-variance-authority,clsx, andtailwind-merge
Configure the Blocks Registry
Open your
components.json file and add the Blocks registry:The
registries configuration tells shadcn CLI where to fetch block definitions. The {name} placeholder will be replaced with the block ID when you add blocks.Install Base Dependencies
Blocks uses several Radix UI primitives and other dependencies. Install the core packages:Or with other package managers:
Verify Installation
Test that everything is set up correctly by adding your first block:This command will:
- Fetch the block definition from
https://blocks.so/r/login-01.json - Download the component files to your project
- Install any missing dependencies
- Place the component in your components directory
The block will be added to your components directory based on your
components.json aliases configuration.Configuration Options
Registry URL Format
The Blocks registry uses this URL format:{name} is the block ID (e.g., login-01, dialog-05, sidebar-02).
Alternative: Direct Registry URLs
You can also add blocks without configuring the registry by using direct URLs:components.json, but the registry configuration provides a cleaner syntax.
Troubleshooting
Command not found: shadcn
Command not found: shadcn
Use The
npx to run shadcn without installing it globally:@latest ensures you’re using the most recent version of the CLI.Module not found errors
Module not found errors
If you see import errors after adding a block, the block may depend on shadcn/ui components you haven’t installed yet. Add them individually:Or check the error message for the specific component name.
Tailwind styles not working
Tailwind styles not working
Ensure your
tailwind.config.js includes the components directory in the content array:Registry URL not found
Registry URL not found
Double-check that the The
registries configuration in components.json exactly matches:{name} placeholder is required for the shadcn CLI to substitute block IDs.Next Steps
Now that your project is configured, learn how to add and customize blocks:Usage Guide
Learn how to add blocks to your project and customize them