This document provides an overview of the development workflow for contributing to the shadcn/ui project. It covers environment setup, monorepo development practices, registry build pipelines, and the release process.
For detailed commit conventions and component contribution guidelines, see Contributing Guidelines. For in-depth information about release workflows and changesets, see Release Process.
This page documents the practical workflow for developing and contributing to shadcn/ui. It covers:
pnpm monorepo structure.For information about the monorepo structure itself, see Monorepo Structure. For build system details, see Build and Release System.
The project requires the following tools:
| Tool | Purpose |
|---|---|
| pnpm | Package manager and workspace management CONTRIBUTING.md13 |
| Turborepo | Build system and task orchestration CONTRIBUTING.md14 |
| changesets | Release and changelog management CONTRIBUTING.md15 |
Sources: CONTRIBUTING.md13-15
The standard fork-and-clone workflow applies:
Workflow Steps:
https://github.com/shadcn-ui/ui CONTRIBUTING.md45-47git clone https://github.com/your-username/ui.git CONTRIBUTING.md49-53git checkout -b my-new-branch CONTRIBUTING.md61-65pnpm install CONTRIBUTING.md67-71Sources: CONTRIBUTING.md43-71 README.md11-13
The repository is a monorepo using pnpm workspaces with the following key directories:
apps/
└── v4/ # Next.js documentation website & Registry source
├── app/ # Next.js app directory
├── components/ # Website React components
├── content/ # MDX documentation files
└── registry/ # Component registry source code
packages/
└── shadcn/ # The shadcn CLI package
Sources: CONTRIBUTING.md17-41
The monorepo uses workspace-scoped commands via the pnpm --filter syntax CONTRIBUTING.md73-75:
Note: On a fresh clone, you must run pnpm --filter=v4 registry:build --style all once before starting the dev server, as generated styles are not checked into git CONTRIBUTING.md85-89
Sources: CONTRIBUTING.md73-94
To ensure the CLI correctly interacts with the registry and transforms code, follow this two-terminal workflow:
Workflow:
pnpm dev CONTRIBUTING.md97-99 This starts the v4 application which serves the local registry.pnpm shadcn CONTRIBUTING.md104-105 This ensures it points to your local registry.-c flag to target an external test application: pnpm shadcn <init | add> -c ~/Desktop/my-app CONTRIBUTING.md107-115Sources: CONTRIBUTING.md91-118
The v4 registry uses a pipeline defined in apps/v4/scripts/build-registry.mts apps/v4/scripts/build-registry.mts28-35
registry/bases/base and registry/bases/radix apps/v4/scripts/build-registry.mts31-32registry/styles/style-*.css apps/v4/scripts/build-registry.mts34new-york-v4 is authored directly and committed apps/v4/registry/README.md16-18The registry:build script handles the transformation of authored base components into style-specific variants (e.g., base-nova, radix-sera) apps/v4/scripts/build-registry.mts68-75
Modification Requirements:
apps/v4/content/docs must be updated CONTRIBUTING.md146pnpm registry:build to update artifacts CONTRIBUTING.md147For local iteration, use targeted flags:
--style <name>: Rebuilds local styles/<style>/ui apps/v4/scripts/build-registry.mts157--registry <name>: Rebuilds installable public/r/styles/<style> apps/v4/scripts/build-registry.mts158--examples: Rebuilds examples/__index__.tsx apps/v4/scripts/build-registry.mts155Sources: apps/v4/scripts/build-registry.mts27-161 CONTRIBUTING.md130-159 apps/v4/registry/README.md1-101
The project uses Vitest for testing CONTRIBUTING.md203
pnpm test from the root runs all tests CONTRIBUTING.md207shadcn package should include tests in packages/shadcn CONTRIBUTING.md197-200Sources: CONTRIBUTING.md195-210
Release management is automated via GitHub Actions and changesets.
push to main. It builds packages (shadcn, @shadcn/react, @shadcn/helpers) and creates a version PR or publishes to NPM using changesets/action@v1 .github/workflows/release.yml120-174release: beta or release: rc .github/workflows/release.yml17-18 This publishes a snapshot version to NPM .github/workflows/release.yml105-107For detailed information, see Release Process.
Sources: .github/workflows/release.yml1-178 .github/workflows/prerelease-comment.yml1-95
Refresh this wiki
This wiki was recently refreshed. Please wait 2 days to refresh again.