shadcn/ui Documentation
repository·main·Indexed Apr 17, 2026
https://github.com/shadcn-ui/uiA collection of reusable UI components that developers copy directly into their projects. Includes a CLI tool for initializing projects, adding components, managing registries, and integrating with AI assistants via MCP. Supports Base UI and Radix variants, and provides templates for Astro, Next.js, React Router, TanStack Start, and Vite frameworks.
What's inside shadcn/ui
Introduction to running your own code registry
mainThe
shadcnCLI allows you to run your own code registry to distribute custom components, hooks, pages, configurations, rules, and other files to any project. The registry is framework-agnostic and works with any project type, not limited to React.Key capabilities include:
- Distributing custom components, hooks, pages, and config files
- Securing your registry with authentication
- Configuring registries with namespaces for organized access
- Defining registry items using the
registry.jsonschema - Using examples to guide registry item creation
To get started, follow the setup guide to build your first registry, then explore authentication, namespaces, and examples for advanced configurations.
Overview and Canary Version
mainThis repository is a work-in-progress registry for the
shadcncanary version. It provides components built with React 19 and Tailwind v4. Developers should use this registry if they need access to the latest experimental features or are preparing for the upcoming stable release, rather than the standard stable version of shadcn.Sources:
apps/v4/README.mdInitialize a React + TypeScript + Vite project with shadcn/ui
mainThis template provides a pre-configured Vite project with React, TypeScript, and shadcn/ui. It is ready to use for building UI components with full code ownership. The project is set up with the necessary dependencies and configuration to start adding shadcn components immediately.Install and use shadcn/ui to build a component library
mainshadcn/ui is a collection of beautifully designed, customizable components that you can copy, paste, and extend to build your own component library. It is open source and designed to be modified to fit your specific needs. To get started, visit the official documentation at https://ui.shadcn.com/docs for installation instructions, usage guides, and API references.Understand the shadcn/ui philosophy and core principles
mainshadcn/ui is not a traditional NPM component library you install and import. Instead, it is a system for building your own component library by copying component code directly into your project. This approach gives you full code ownership, allowing you to modify, extend, and customize components to fit your specific design system without workarounds or wrapping.
Key principles:
- Open Code: You own the component code. You can edit it directly (e.g., changing a button's behavior) rather than overriding styles or wrapping components. This also makes the code transparent and AI-readable.
- Composition: All components share a common, composable interface. This predictability helps both developers and AI models understand how to use and combine components.
- Distribution: Components are distributed via a flat-file schema and a CLI tool, supporting cross-framework usage.
- Beautiful Defaults: Components come with carefully chosen default styles that look good out-of-the-box and work together consistently.
- AI-Ready: The open code and consistent API allow AI models to read, understand, and generate new components that integrate with your design system.
Unlike traditional libraries where you might struggle to customize a component, shadcn/ui hands you the actual source code, making it straightforward to adapt to your needs.
Install the Collapsible component manually
mainInstall the Collapsible component manually by adding the required dependency and copying the component source code into your project. You must install
radix-uiseparately and update import paths to match your project setup.npm install radix-uiInstall the Input OTP component via CLI
mainInstall the Input OTP component using the shadcn CLI. This command adds the component code to your project and installs the required
input-otpdependency.npx shadcn@latest add input-otpInstall the Accordion component manually
mainTo install the Accordion component manually, first install the
@base-ui/reactdependency. Then copy the component code into your project atcomponents/ui/accordion.tsxand update the import paths to match your project's alias configuration.npm install @base-ui/reactInstall the Calendar component via CLI
mainInstall the Calendar component using the shadcn CLI. This command adds the component to your project and installs the required dependencies (
react-day-pickeranddate-fns).npx shadcn@latest add calendarEnable RTL support for Kbd
mainTo enable RTL (Right-to-Left) support for the
Kbdcomponent, follow the general RTL configuration guide for shadcn/ui. The component will automatically adapt its layout when RTL is enabled.// See: /docs/rtl for full RTL configuration // Kbd will automatically adapt when RTL is enabledInstall the AlertDialog component via CLI
mainInstall the AlertDialog component using the shadcn CLI. This command adds the component files to your project and installs the required
@base-ui/reactdependency.npx shadcn@latest add alert-dialog