### my-custom-starter-template.json Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/examples.mdx Example of a universal registry item that installs multiple files, demonstrating how to define multiple file targets. ```json { "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "my-custom-starter-template", "type": "registry:item", "dependencies": ["better-auth"], "files": [ { "path": "/path/to/file-01.json", "type": "registry:file", "target": "~/file-01.json", "content": "..." }, { "path": "/path/to/file-02.vue", "type": "registry:file", "target": "~/pages/file-02.vue", "content": "..." } ] } ``` -------------------------------- ### Initialize shadcn/ui Project with CLI Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/changelog/2023-06-new-cli.mdx Run this command to start the interactive setup process for a new shadcn/ui project, which configures the `components.json` file. ```bash npx shadcn@latest init ``` -------------------------------- ### Install Multiple Namespaced Resources Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/namespace.mdx Use this command to install several resources from different namespaces simultaneously, streamlining the setup process. ```bash npx shadcn@latest add @acme/header @lib/auth-utils @ai/chatbot-rules ``` -------------------------------- ### Example Registry File Structure Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/github.mdx Illustrates the directory structure for a registry item that includes configuration, documentation, and setup files. ```txt registry.json config └── vitest.config.ts docs └── testing.md test └── setup.ts ``` -------------------------------- ### Install Vitest Setup Registry Item Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/github.mdx Command to install the "vitest-setup" registry item from the "acme/toolkit" repository. ```bash npx shadcn@latest add acme/toolkit/vitest-setup ``` -------------------------------- ### Example: Add alert-dialog component Source: https://github.com/shadcn-ui/ui/blob/main/packages/shadcn/README.md Example of using the add command to install the 'alert-dialog' component. ```bash npx shadcn add alert-dialog ``` -------------------------------- ### example-style.json Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/examples.mdx JSON configuration to install a block from the shadcn/ui registry and override its primitives with custom ones. ```json { "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "custom-login", "type": "registry:block", "registryDependencies": [ "login-01", "https://example.com/r/button.json", "https://example.com/r/input.json", "https://example.com/r/label.json" ] } ``` -------------------------------- ### example-item.json Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/examples.mdx Example demonstrating the use of the 'devDependencies' field to install packages as development dependencies for a registry item. ```json { "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "custom-item", "type": "registry:item", "devDependencies": ["@types/mdx"], "files": [ { "path": "lib/mdx.ts", "content": "...", "type": "registry:lib" } ] } ``` -------------------------------- ### .eslintrc.json Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/examples.mdx Example of a universal registry item for installing a custom ESLint configuration file. ```json { "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "my-eslint-config", "type": "registry:item", "files": [ { "path": "/path/to/your/registry/default/custom-eslint.json", "type": "registry:file", "target": "~/.eslintrc.json", "content": "..." } ] } ``` -------------------------------- ### Installation Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/components/base/input.mdx Install the Input component using the shadcn CLI. ```bash npx shadcn@latest add input ``` -------------------------------- ### Install from a community registry Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/(root)/new.mdx Install components from any registry URL using the CLI. ```bash npx shadcn@latest add @[registry]/[name] ``` -------------------------------- ### Install Item from GitHub Registry Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/changelog/2026-06-github-registries.mdx Use this command to install an item from any public GitHub repository configured as a shadcn registry. The generic form shows the required path structure, followed by a concrete example. ```bash npx shadcn@latest add // ``` ```bash npx shadcn@latest add acme/toolkit/project-conventions ``` -------------------------------- ### Example Secure Registry Setup for Operators Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/namespace.mdx This configuration illustrates a secure registry setup for operators, including HTTPS and authorization headers with versioning. ```json { "@company": { "url": "https://registry.company.com/v1/{name}.json", "headers": { "Authorization": "Bearer ${COMPANY_TOKEN}", "X-Registry-Version": "1.0" } } } ``` -------------------------------- ### alias-child.json Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/examples.mdx Demonstrates using `files[].target` placeholders to install files under user-configured shadcn directories, resolving from `components.json`. ```json { "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "alias-child", "type": "registry:item", "files": [ { "path": "registry/new-york/alias/target-alias-button.tsx", "type": "registry:ui", "target": "@ui/target-alias-button.tsx", "content": "..." }, { "path": "registry/new-york/alias/target-alias-helper.ts", "type": "registry:lib", "target": "@lib/target-alias-helper.ts", "content": "..." }, { "path": "registry/new-york/alias/prompt-input.tsx", "type": "registry:ui", "target": "@ui/ai/prompt-input.tsx", "content": "..." } ] } ``` -------------------------------- ### Get Component Documentation URLs with shadcn CLI Source: https://github.com/shadcn-ui/ui/blob/main/skills/shadcn/cli.md Outputs resolved URLs for documentation, examples, and API references for specified components. Accepts one or more component names. ```bash npx shadcn@latest docs [options] ``` -------------------------------- ### example.json Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/changelog/2026-05-package-imports-target-aliases.mdx Example of a registry item using target aliases in files[].target to install files under configured shadcn directories. ```json { "files": [ { "path": "registry/default/ai/prompt-input.tsx", "type": "registry:ui", "target": "@ui/ai/prompt-input.tsx" } ] } ``` -------------------------------- ### Installation Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/components/base/skeleton.mdx Install the Skeleton component using the shadcn/ui CLI. ```bash npx shadcn@latest add skeleton ``` -------------------------------- ### Installation Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/components/base/table.mdx Install the Table component using the shadcn CLI. ```bash npx shadcn@latest add table ``` -------------------------------- ### Install dependencies (Manual installation) Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/components/base/sonner.mdx Command to install required dependencies for manual Sonner setup. ```bash npm install sonner next-themes ``` -------------------------------- ### Installation Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/components/base/combobox.mdx Install the Combobox component using the shadcn CLI. ```bash npx shadcn@latest add combobox ``` -------------------------------- ### Installation - Command Line Interface Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/components/base/label.mdx Install the Label component using the shadcn/ui CLI. ```bash npx shadcn@latest add label ``` -------------------------------- ### Installation Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/components/base/navigation-menu.mdx Install the Navigation Menu component using the shadcn/ui CLI. ```bash npx shadcn@latest add navigation-menu ``` -------------------------------- ### Installation via CLI Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/components/base/pagination.mdx Install the Pagination component using the shadcn CLI. ```bash npx shadcn@latest add pagination ``` -------------------------------- ### Install Font Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/rtl/start.mdx Install the Noto Sans Arabic font using Fontsource. ```bash npm install @fontsource-variable/noto-sans-arabic ``` -------------------------------- ### Add all available components Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/(root)/new.mdx Add all available components to your project. ```bash npx shadcn@latest add --all ``` -------------------------------- ### Connect the MCP Server Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/(root)/new.mdx Initialize the shadcn MCP server for your AI assistant. ```bash npx shadcn@latest mcp init ``` -------------------------------- ### example-style.json Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/examples.mdx Custom style from scratch ```json { "$schema": "https://ui.shadcn.com/schema/registry-item.json", "extends": "none", "name": "new-style", "type": "registry:style", "dependencies": ["tailwind-merge", "clsx"], "registryDependencies": [ "utils", "https://example.com/r/button.json", "https://example.com/r/input.json", "https://example.com/r/label.json", "https://example.com/r/select.json" ], "cssVars": { "theme": { "font-sans": "Inter, sans-serif" }, "light": { "main": "#88aaee", "bg": "#dfe5f2", "border": "#000", "text": "#000", "ring": "#000" }, "dark": { "main": "#88aaee", "bg": "#272933", "border": "#000", "text": "#e6e6e6", "ring": "#fff" } } } ``` -------------------------------- ### Add Toaster component (Manual installation) Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/components/base/sonner.mdx Example of adding the Toaster component to your root layout after manual installation. ```tsx import { Toaster } from "@/components/ui/sonner" export default function RootLayout({ children }) { return (
{children}
) } ``` -------------------------------- ### Installation - Command Line Interface Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/components/base/switch.mdx Install the Switch component using the shadcn CLI. ```bash npx shadcn@latest add switch ``` -------------------------------- ### Run Documentation Website Locally Source: https://github.com/shadcn-ui/ui/blob/main/CONTRIBUTING.md Starts the development server for the v4 workspace to view documentation locally. ```bash pnpm --filter=v4 dev ``` -------------------------------- ### Add Toaster component (CLI installation) Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/components/base/sonner.mdx Example of adding the Toaster component to your root layout after CLI installation. ```tsx import { Toaster } from "@/components/ui/sonner" export default function RootLayout({ children }) { return (
{children}
) } ``` -------------------------------- ### Add multiple components Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/(root)/new.mdx Add multiple components at once using the CLI. ```bash npx shadcn@latest add button card input label ``` -------------------------------- ### example-scoped-plugin.json Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/examples.mdx Shows examples of adding scoped npm plugins and local file-based plugins. ```json { "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "scoped-plugins", "type": "registry:component", "css": { "@plugin \"@headlessui/tailwindcss\"": {}, "@plugin \"tailwindcss/plugin\"": {}, "@plugin \"./custom-plugin.js\"": {} } } ``` -------------------------------- ### example-item.json Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/examples.mdx Example of adding environment variables to a registry item using the `envVars` field. ```json { "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "custom-item", "type": "registry:item", "envVars": { "NEXT_PUBLIC_APP_URL": "http://localhost:4000", "DATABASE_URL": "postgresql://postgres:postgres@localhost:5432/postgres", "OPENAI_API_KEY": "" } } ``` -------------------------------- ### .cursor/rules/custom-python.mdc Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/examples.mdx Example of a universal registry item that installs custom Cursor rules for Python, demonstrating an explicit target for files. ```json { "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "python-rules", "type": "registry:item", "files": [ { "path": "/path/to/your/registry/default/custom-python.mdc", "type": "registry:file", "target": "~/.cursor/rules/custom-python.mdc", "content": "..." } ] } ``` -------------------------------- ### Using Component Preview Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/examples/README.md How to use the example in documentation by referencing its name (filename without .tsx). ```tsx ``` -------------------------------- ### View Specific Component Details Examples Source: https://github.com/shadcn-ui/ui/blob/main/skills/shadcn/cli.md Examples demonstrating how to view details for a shadcn component using its name or a full path. ```bash npx shadcn@latest view @shadcn/button ``` ```bash npx shadcn@latest view owner/repo/item ``` -------------------------------- ### example-theme.json Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/examples.mdx Custom theme ```json { "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "custom-theme", "type": "registry:theme", "cssVars": { "light": { "background": "oklch(1 0 0)", "foreground": "oklch(0.141 0.005 285.823)", "primary": "oklch(0.546 0.245 262.881)", "primary-foreground": "oklch(0.97 0.014 254.604)", "ring": "oklch(0.746 0.16 232.661)", "sidebar-primary": "oklch(0.546 0.245 262.881)", "sidebar-primary-foreground": "oklch(0.97 0.014 254.604)", "sidebar-ring": "oklch(0.746 0.16 232.661)" }, "dark": { "background": "oklch(1 0 0)", "foreground": "oklch(0.141 0.005 285.823)", "primary": "oklch(0.707 0.165 254.624)", "primary-foreground": "oklch(0.97 0.014 254.604)", "ring": "oklch(0.707 0.165 254.624)", "sidebar-primary": "oklch(0.707 0.165 254.624)", "sidebar-primary-foreground": "oklch(0.97 0.014 254.604)", "sidebar-ring": "oklch(0.707 0.165 254.624)" } } } ``` -------------------------------- ### Import and Use Card Component (shadcn/create) Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/installation/tanstack.mdx Example of importing and using the Card component in a TanStack Start route file after using shadcn/create. ```tsx import { createFileRoute } from "@tanstack/react-router" import { Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@/components/ui/card" export const Route = createFileRoute("/")({ component: App, }) function App() { return ( Project Overview Track progress and recent activity for your TanStack Start app. Your design system is ready. Start building your next component. ) } ``` -------------------------------- ### Get List of Installed shadcn/ui Components Source: https://github.com/shadcn-ui/ui/blob/main/skills/shadcn/cli.md Run this command to retrieve a list of currently installed shadcn/ui components in your project. This is useful for the smart merge workflow when updating components. ```bash npx shadcn@latest info ``` -------------------------------- ### Initialize shadcn/ui Monorepo Project Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/(root)/monorepo.mdx Use this command to create a new monorepo project with shadcn/ui, setting up `web` and `ui` workspaces with Turborepo. ```bash npx shadcn@latest init --monorepo ``` -------------------------------- ### example-multiple-plugins.json Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/examples.mdx Illustrates adding multiple plugins, noting their automatic grouping and deduplication, along with their npm dependencies. ```json { "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "multiple-plugins", "type": "registry:item", "dependencies": [ "@tailwindcss/typography", "@tailwindcss/forms", "tw-animate-css" ], "css": { "@plugin \"@tailwindcss/typography\"": {}, "@plugin \"@tailwindcss/forms\"": {}, "@plugin \"tw-animate-css\"": {} } } ``` -------------------------------- ### Install Multiple Resources with Override Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/namespace.mdx When installing multiple resources, the last resolved resource with conflicting files will override previous ones. In this example, `login-form.ts` from `@custom/login-form` will override the one from `@acme/auth`. ```bash npx shadcn@latest add @acme/auth @custom/login-form ``` -------------------------------- ### Interactive `init` Command Configuration Prompts Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/changelog/2023-06-new-cli.mdx These are the questions asked during the `init` command execution to configure project settings like style, base color, CSS file location, and import aliases. ```txt Which style would you like to use? › Default Which color would you like to use as base color? › Slate Where is your global CSS file? › › app/globals.css Do you want to use CSS variables for colors? › no / yes Where is your tailwind.config.js located? › tailwind.config.js Configure the import alias for components: › @/components Configure the import alias for utils: › @/lib/utils Are you using React Server Components? › no / yes ``` -------------------------------- ### alias-parent.json Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/registry/examples.mdx Shows how registry dependencies can also utilize target placeholders, with a parent item installing an app component and a hook, and a child item installing a UI component and a helper. ```json { "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "alias-parent", "type": "registry:item", "registryDependencies": ["https://example.com/r/alias-child.json"], "files": [ { "path": "registry/new-york/alias/target-alias-panel.tsx", "type": "registry:component", "target": "@components/target-alias-panel.tsx", "content": "..." }, { "path": "registry/new-york/alias/use-target-alias.ts", "type": "registry:hook", "target": "@hooks/use-target-alias.ts", "content": "..." } ] } ``` -------------------------------- ### Add TooltipProvider to root (CLI) Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/components/base/tooltip.mdx Example of adding TooltipProvider to `app/layout.tsx` for CLI installation. ```tsx import { TooltipProvider } from "@/components/ui/tooltip" export default function RootLayout({ children }) { return ( {children} ) } ``` -------------------------------- ### shadcn init Command Options Source: https://github.com/shadcn-ui/ui/blob/main/apps/v4/content/docs/(root)/cli.mdx Displays the available arguments and options for customizing the `shadcn init` command, including templates, presets, and project setup configurations. ```bash Usage: shadcn init [options] [components...] initialize your project and install dependencies Arguments: components names, url or local path to component Options: -t, --template