Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Build React UIs using shadcn/ui components with Tailwind CSS, Radix primitives, and proper accessibility patterns.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/ui-reference.md
1### Add All shadcn/ui Components using CLI23Source: https://ui.shadcn.com/docs/installation/tanstack45This command installs all available shadcn/ui components into your TanStack Start project using the shadcn/ui CLI. It requires a package manager like pnpm, npm, yarn, or bun.67```shell8pnpm dlx shadcn@latest add --all9```1011--------------------------------1213### Create TanStack Start Project with shadcn/ui1415Source: https://ui.shadcn.com/docs/installation/tanstack1617This command initializes a new TanStack Start project and integrates shadcn/ui, including Tailwind CSS. It requires pnpm, npm, yarn, or bun to run.1819```shell20pnpm create @tanstack/start@latest --tailwind --add-ons shadcn21```2223--------------------------------2425### Custom Block Installation2627Source: https://ui.shadcn.com/docs/registry/examples2829Specifies a custom block to be installed from the shadcn/ui registry. In this example, it installs the 'login-01' block.3031```json32{33"$schema": "https://u"34}35```3637--------------------------------3839### Example: Multiple Registry Setup in components.json4041Source: https://ui.shadcn.com/docs/components-json4243Demonstrates a complex `components.json` configuration with multiple registries, including public, private with authentication, and team-specific resources. This setup allows for flexible installation of components and utilities from diverse sources.4445```json46{47"registries": {48"@shadcn": "https://ui.shadcn.com/r/{name}.json",49"@company-ui": {50"url": "https://registry.company.com/ui/{name}.json",51"headers": {52"Authorization": "Bearer ${COMPANY_TOKEN}"53}54},55"@team": {56"url": "https://team.company.com/{name}.json",57"params": {58"team": "frontend",59"version": "${REGISTRY_VERSION}"60}61}62}63}64```6566--------------------------------6768### Universal Item with Multiple Files (JSON)6970Source: https://ui.shadcn.com/docs/registry/examples7172An example of a universal registry item that installs multiple files, including dependencies. This is useful for starter templates or comprehensive configurations, with explicit `target` paths for each file.7374```json75{76"$schema": "https://ui.shadcn.com/schema/registry-item.json",77"name": "my-custom-start-template",78"type": "registry:item",79"dependencies": [80"better-auth"81],82"files": [83{84"path": "/path/to/file-01.json",85"type": "registry:file",86"target": "~/file-01.json",87"content": "..."88},89{90"path": "/path/to/file-02.vue",91"type": "registry:file",92"target": "~/pages/file-02.vue",93"content": "..."94}95]96}97```9899--------------------------------100101### Create Gatsby Project using npm102103Source: https://ui.shadcn.com/docs/installation/gatsby104105Initializes a new Gatsby project using the npm command. This command is the starting point for setting up a new Gatsby application.106107```bash108npm init gatsby109```110111--------------------------------112113### Create React Project with Vite (TypeScript)114115Source: https://ui.shadcn.com/docs/installation/vite116117Command to create a new React project using Vite with the TypeScript template. This is the initial step for setting up the project.118119```bash120pnpm create vite@latest121--template react-ts122```123124--------------------------------125126### Install Component from Private Registry127128Source: https://ui.shadcn.com/docs/components-json129130Command-line instruction to install a component from a private registry using its alias. This example, `@private/button`, demonstrates fetching resources from a protected registry defined in `components.json`.131132```bash133npx shadcn@latest add @private/button134```135136--------------------------------137138### Install Component from Configured Registry139140Source: https://ui.shadcn.com/docs/components-json141142Command-line instruction to install a component using a configured registry alias. The `@v0/dashboard` syntax specifies the registry and the resource name, leveraging the `components.json` setup.143144```bash145npx shadcn@latest add @v0/dashboard146```147148--------------------------------149150### Install Tailwind CSS151152Source: https://ui.shadcn.com/docs/installation/remix153154Commands to install Tailwind CSS and Autoprefixer as development dependencies in a Remix project using pnpm, npm, or yarn.155156```bash157pnpm add -D tailwindcss@latest autoprefixer@latest158```159160--------------------------------161162### Universal Item for ESLint Configuration (JSON)163164Source: https://ui.shadcn.com/docs/registry/examples165166This example shows a universal registry item for installing a custom ESLint configuration. It uses an explicit `target` to place the `.eslintrc.json` file in the user's home directory, ensuring framework independence.167168```json169{170"$schema": "https://ui.shadcn.com/schema/registry-item.json",171"name": "my-eslint-config",172"type": "registry:item",173"files": [174{175"path": "/path/to/your/registry/default/custom-eslint.json",176"type": "registry:file",177"target": "~/.eslintrc.json",178"content": "..."179}180]181}182```183184--------------------------------185186### Install Switch Component (Manual)187188Source: https://ui.shadcn.com/docs/components/switch189190Manual installation instructions for the Switch component, providing alternative methods using pnpm, npm, or yarn. This approach is useful if the CLI method is not preferred or feasible.191192```bash193pnpm add switch194npm install switch195yarn add switch196```197198--------------------------------199200### Installing shadcn/ui Spinner Component201202Source: https://ui.shadcn.com/docs/components/spinner203204Shows how to add the Spinner component to your project using the shadcn-ui CLI. This command-line installation method simplifies dependency management and setup.205206```bash207pnpm dlx shadcn@latest add spinner208```209210--------------------------------211212### Install Switch Component (CLI)213214Source: https://ui.shadcn.com/docs/components/switch215216Instructions for installing the Switch component using the shadcn-ui CLI. This is the recommended method for adding components to your project. Ensure you have the shadcn-ui CLI installed and configured.217218```bash219pnpm dlx shadcn@latest add switch220```221222--------------------------------223224### shadcn/ui Select Component Installation (CLI)225226Source: https://ui.shadcn.com/docs/components/select227228Instructions for installing the shadcn/ui Select component using the pnpm, npm, or yarn package managers. This command-line interface method simplifies the process of adding the component to your project. Ensure you have the shadcn/ui CLI installed globally.229230```bash231pnpm dlx shadcn@latest add select232npx shadcn@latest add select233yarn dlx shadcn@latest add select234```235236--------------------------------237238### Installing Components from Namespaced Registries239240Source: https://ui.shadcn.com/docs/changelog241242Demonstrates how to install components using the shadcn CLI from different registered namespaces. This enables decentralized component distribution and management.243244```shell245pnpm dlx shadcn add @acme/button @internal/auth-system246```247248--------------------------------249250### Custom Style from Scratch251252Source: https://ui.shadcn.com/docs/registry/examples253254Creates a custom style from scratch without extending shadcn/ui. It installs specific npm packages and registry items, and defines new CSS variables for theme colors.255256```json257{258"$schema": "https://ui.shadcn.com/schema/registry-item.json",259"extends": "none",260"name": "new-style",261"type": "registry:style",262"dependencies": [263"tailwind-merge",264"clsx"265],266"registryDependencies": [267"utils",268"https://example.com/r/button.json",269"https://example.com/r/input.json",270"https://example.com/r/label.json",271"https://example.com/r/select.json"272],273"cssVars": {274"theme": {275"font-sans": "Inter, sans-serif"276},277"light": {278"main": "#88aaee",279"bg": "#dfe5f2",280"border": "#000",281"text": "#000",282"ring": "#000"283},284"dark": {285"main": "#88aaee",286"bg": "#272933",287"border": "#000",288"text": "#e6e6e6",289"ring": "#fff"290}291}292}293```294295--------------------------------296297### Import and Use Button Component in React298299Source: https://ui.shadcn.com/docs/installation/vite300301Example of importing the 'Button' component from shadcn/ui and using it within a React component. Assumes the Button component has been added via the CLI.302303```typescript304import { Button } from "@/components/ui/button"305306function App() {307return (308Click me309)310}311312export default App313```314315--------------------------------316317### Add Dependencies to Project (npm, pnpm, yarn, bun)318319Source: https://ui.shadcn.com/docs/installation/manual320321Installs the required dependencies for shadcn/ui using package managers. Ensure Tailwind CSS is already set up in your project.322323```bash324pnpm add class-variance-authority clsx tailwind-merge lucide-react tw-animate-css325```326327--------------------------------328329### shadcn/ui Tooltip Installation (CLI)330331Source: https://ui.shadcn.com/docs/components/tooltip332333This command installs the shadcn/ui Tooltip component using the shadcn CLI. This is the recommended method for adding components to your project, ensuring proper dependency management.334335```bash336pnpm dlx shadcn@latest add tooltip337```338339--------------------------------340341### Install Multiple Resources from Different Registries342343Source: https://ui.shadcn.com/docs/components-json344345Command-line instruction to install multiple resources from various configured registries simultaneously. This showcases the flexibility of installing components like `@acme/header` and `@internal/auth-utils` in one go.346347```bash348npx shadcn@latest add @acme/header @internal/auth-utils349```350351--------------------------------352353### shadcn/ui Alert Component Import Example354355Source: https://ui.shadcn.com/docs/components/alert356357Example of how to import the Alert, AlertDescription, and AlertTitle components from shadcn/ui after installation. This allows you to use them in your React components.358359```jsx360import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"361```362363--------------------------------364365### Initialize shadcn/ui Project with CLI366367Source: https://ui.shadcn.com/docs/cli368369Initializes your project with shadcn/ui, installing necessary dependencies and configuring the project. This command sets up the `cn` utility and CSS variables.370371```bash372pnpm dlx shadcn@latest init373```374375--------------------------------376377### shadcn/ui CLI Installation Commands378379Source: https://ui.shadcn.com/docs/cli380381Shows the commands for installing shadcn/ui dependencies using different package managers (PNPM, NPM, Yarn, Bun).382383```bash384pnpm dlx shadcn@latest init385```386387```bash388npm dlx shadcn@latest init389```390391```bash392yarn dlx shadcn@latest init393```394395```bash396bun dlx shadcn@latest init397```398399--------------------------------400401### shadcn/ui Empty Component Installation (CLI)402403Source: https://ui.shadcn.com/docs/components/empty404405Shows how to install the Empty component using the shadcn/ui CLI. This involves running a specific command to add the component to your project.406407```bash408pnpm dlx shadcn@latest add empty409```410411--------------------------------412413### Add Tailwind CSS and Vite Plugin414415Source: https://ui.shadcn.com/docs/installation/vite416417Installs Tailwind CSS and its Vite plugin. These are necessary for styling components with Tailwind utility classes.418419```bash420pnpm add -D tailwindcss postcss autoprefixer421pnpm add -D @tailwindcss/vite422```423424--------------------------------425426### Import and Use 'Button' Component in React427428Source: https://ui.shadcn.com/docs/installation/tanstack429430Demonstrates how to import and use the 'Button' component from shadcn/ui within a React component in a TanStack Start application. Assumes the 'Button' component has been added via the CLI.431432```jsx433import { Button } from "@/components/ui/button"434435function App() {436return (437Click me438)439}440```441442--------------------------------443444### shadcn/ui Alert Component Installation (CLI)445446Source: https://ui.shadcn.com/docs/components/alert447448Instructions for installing the Alert component using the shadcn/ui CLI. This command adds the necessary dependencies and component files to your project.449450```bash451pnpm dlx shadcn@latest add alert452```453454--------------------------------455456### Universal Item for Python Rules (JSON)457458Source: https://ui.shadcn.com/docs/registry/examples459460An example of a universal registry item designed to install custom Python rules for the Cursor editor. It specifies an explicit target path for the rule file, making it framework-agnostic.461462```json463{464"$schema": "https://ui.shadcn.com/schema/registry-item.json",465"name": "python-rules",466"type": "registry:item",467"files": [468{469"path": "/path/to/your/registry/default/custom-python.mdc",470"type": "registry:file",471"target": "~/.cursor/rules/custom-python.mdc",472"content": "..."473}474]475}476```477478--------------------------------479480### Calendar Installation (CLI)481482Source: https://ui.shadcn.com/docs/components/calendar483484Provides commands for installing the Calendar component using different package managers like pnpm, npm, yarn, and bun. This is a prerequisite for using the component in your project.485486```bash487pnpm dlx shadcn@latest add calendar488```489490--------------------------------491492### Dropdown Menu Basic Usage (JavaScript/React)493494Source: https://ui.shadcn.com/docs/components/dropdown-menu495496This snippet shows the minimal setup for a dropdown menu component. It requires importing the necessary components from shadcn/ui and defining a trigger and content. This is a foundational example for integrating dropdown menus.497498```javascript499import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"500501```502503```javascript504OpenMy Account505Profile506⇧⌘P507Billing508⌘B509Settings510⌘S511Keyboard shortcuts512⌘K513Team514515Invite users516517New Team...518⌘+T519GitHub520521Support522523API524525Log out526⇧⌘Q527528```529530--------------------------------531532### Install Progress Component using CLI533534Source: https://ui.shadcn.com/docs/components/progress535536Command to add the Progress component to your project using the shadcn-ui CLI. This is the recommended way to install components.537538```bash539pnpm dlx shadcn@latest add progress540```541542--------------------------------543544### Separator Component Installation (CLI)545546Source: https://ui.shadcn.com/docs/components/separator547548Shows the command to install the Separator component using the shadcn-ui CLI. This is the recommended method for adding components.549550```bash551pnpm dlx shadcn@latest add separator552```553554--------------------------------555556### Add CSS Import with URL Syntax557558Source: https://ui.shadcn.com/docs/registry/examples559560This example demonstrates importing CSS files using the `url()` syntax, including importing from external sources like Google Fonts and local files.561562```json563{564"$schema": "https://ui.shadcn.com/schema/registry-item.json",565"name": "font-import",566"type": "registry:item",567"css": {568"@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap")": {},569"@import url('./local-styles.css')": {}570}571}572```573574--------------------------------575576### React Card Component Example (shadcn/ui)577578Source: https://ui.shadcn.com/docs/components/card579580This code snippet demonstrates how to use the Card component from shadcn/ui in a React application. It includes examples for header, title, description, content, footer, and action elements. Ensure you have the 'card' component installed via the shadcn/ui CLI or manually imported.581582```jsx583import { Button } from "@/components/ui/button"584import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/ui/card"585import { Input } from "@/components/ui/input"586import { Label } from "@/components/ui/label"587588export function CardDemo() {589return (590Login to your accountEnter your email below to login to your account591592Name593594Framework595596CancelDeploy597)598}599```600601--------------------------------602603### Install shadcn/ui Toggle Component604605Source: https://ui.shadcn.com/docs/components/toggle606607Instructions for installing the shadcn/ui Toggle component using pnpm. This command adds the necessary package and dependencies to your project.608609```bash610pnpm dlx shadcn@latest add toggle611```612613--------------------------------614615### Create a Simple Component (TypeScript/React)616617Source: https://ui.shadcn.com/docs/registry/getting-started618619An example of a basic component file, `hello-world.tsx`, intended to be part of a registry. This component uses a Button from `@/components/ui/button`. It should be placed within a structured directory like `registry/[NAME]/[COMPONENT_NAME]/`.620621```tsx622import { Button } from "@/components/ui/button"623624export function HelloWorld() {625return (626Hello World627)628}629```630631--------------------------------632633### shadcn/ui Alert Dialog Installation634635Source: https://ui.shadcn.com/docs/components/alert-dialog636637Instructions for installing the Alert Dialog component using the shadcn-ui CLI. This command adds the necessary component files to your project, allowing you to import and use them.638639```bash640pnpm dlx shadcn@latest add alert-dialog641```642643--------------------------------644645### Install Remote Component using URL (CLI)646647Source: https://ui.shadcn.com/docs/changelog648649Installs a remote component by providing its registry URL to the shadcn CLI. This allows for easy integration of components from external sources. It requires the shadcn CLI to be installed.650651```bash652npx shadcn add https://acme.com/registry/navbar.json653```654655--------------------------------656657### Add Functional CSS Utilities658659Source: https://ui.shadcn.com/docs/registry/examples660661This example demonstrates functional CSS utilities using a wildcard. The 'tab-*' utility allows for dynamic application of 'tab-size' based on the value provided.662663```json664{665"$schema": "https://ui.shadcn.com/schema/registry-item.json",666"name": "custom-component",667"type": "registry:component",668"css": {669"@utility tab-*": {670"tab-size": "var(--tab-size-)"671}672}673}674```675676--------------------------------677678### Install shadcn/ui Registry Item via CLI679680Source: https://ui.shadcn.com/docs/registry/getting-started681682Installs a registry item using the shadcn CLI by providing the URL of the registry item. This command allows developers to easily add components from a remote registry to their project.683684```Shell685pnpm dlx shadcn@latest add http://localhost:3000/r/hello-world.json686```687688--------------------------------689690### shadcn/ui Drawer Component Usage Example691692Source: https://ui.shadcn.com/docs/components/drawer693694Provides a basic import statement for using the Drawer component and its associated sub-components from shadcn/ui. This snippet is intended for developers who have installed the component and need to integrate it into their React application.695696```javascript697import { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, } from "@/components/ui/drawer"698699```700701--------------------------------702703### Toggle Group Component Documentation704705Source: https://ui.shadcn.com/docs/components/toggle-group706707This section details the Toggle Group component, its installation, usage, and various examples demonstrating its functionality and appearance.708709```APIDOC710## Toggle Group Component711712### Description713A set of two-state buttons that can be toggled on or off. Provides "single" and "multiple" selection modes.714715### Installation716Use the shadcn-ui CLI to add the component to your project:717```bash718pnpm dlx shadcn@latest add toggle-group719```720721### Usage722Import the necessary components and use them in your React application.723724```javascript725import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";726727function MyToggleGroup() {728return (729730A731732B733734C735736);737}738```739740### Examples741742#### Outline743```javascript744import { Bold, Italic, Underline } from "lucide-react";745import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";746747export function ToggleGroupOutline() {748return (749750);751}752```753754#### Single755```javascript756import { Bold, Italic, Underline } from "lucide-react";757import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";758759export function ToggleGroupSingle() {760return (761762);763}764```765766#### Small767```javascript768import { Bold, Italic, Underline } from "lucide-react";769import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";770771export function ToggleGroupSmall() {772return (773774);775}776```777778#### Large779```javascript780import { Bold, Italic, Underline } from "lucide-react";781import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";782783export function ToggleGroupLarge() {784return (785786);787}788```789790#### Disabled791```javascript792import { Bold, Italic, Underline } from "lucide-react";793import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";794795export function ToggleGroupDisabled() {796return (797798);799}800```801802#### Spacing803Use `spacing={2}` to add spacing between toggle group items.804```javascript805import { BookmarkIcon, HeartIcon, StarIcon } from "lucide-react";806import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";807808export function ToggleGroupSpacing() {809return (810811);812}813```814815### API Reference816817#### ToggleGroup818The main component that wraps toggle group items.819820| Prop | Type | Default |821|------------|-------------------------------------|-------------|822| `type` | `"single" | "multiple"` | `"single"` |823| `variant` | `"default" | "outline"` | `"default"` |824| `size` | `"default" | "sm" | "lg"` | `"default"` |825| `spacing` | `number` | `0` |826| `className`| `string` | `''` |827828#### ToggleGroupItem829Individual toggle items within a toggle group. Remember to add an `aria-label` to each item for accessibility.830831| Prop | Type | Default |832|------------|----------|-----------|833| `value` | `string` | Required |834| `className`| `string` | `''` |835```836837--------------------------------838839### Use shadcn/ui Button Component in Remix840841Source: https://ui.shadcn.com/docs/installation/remix842843Example of importing and using the shadcn/ui Button component within a Remix route component. Demonstrates basic component integration.844845```typescript846import { Button } from "~/components/ui/button"847848export default function Home() {849return (850Click me851)852}853```854855--------------------------------856857### Override Primitives with a Block858859Source: https://ui.shadcn.com/docs/registry/examples860861Demonstrates how to define a custom login block that overrides existing primitives like 'button', 'input', and 'label' with remote versions. This allows for customization during installation.862863```json864{865"$schema": "https://ui.shadcn.com/schema/registry-item.json",866"name": "custom-login",867"type": "registry:block",868"registryDependencies": [869"login-01",870"https://example.com/r/button.json",871"https://example.com/r/input.json",872"https://example.com/r/label.json"873]874}875```876877--------------------------------878879### Initialize Project with shadcn CLI880881Source: https://ui.shadcn.com/docs/changelog882883Initializes a new project with shadcn/ui components. The command automatically detects the project's framework and can even set up a new Next.js application. It is a convenient way to start integrating shadcn/ui.884885```bash886npx shadcn init887pnpm dlx shadcn init sidebar-01 login-01888```889890--------------------------------891892### shadcn CLI Commands893894Source: https://ui.shadcn.com/docs/changelog895896Demonstrates the usage of the shadcn CLI for managing UI components. The commands shown are 'init' for project setup and 'add' for incorporating new components, along with an experimental 'diff' command. These are essential for integrating and managing shadcn/ui within a project.897898```bash899npx shadcn-ui@latest init900npx shadcn-ui@latest add901npx shadcn-ui@latest diff (experimental)902```903904--------------------------------905906### Install shadcn/ui Tabs Component907908Source: https://ui.shadcn.com/docs/components/tabs909910Instructions for installing the Tabs component using pnpm and the shadcn-ui CLI. This ensures the component is correctly added to your project's dependencies and configuration.911912```bash913pnpm dlx shadcn@latest add tabs914```915916--------------------------------917918### Install shadcn/ui Badge Component (CLI)919920Source: https://ui.shadcn.com/docs/components/badge921922Command-line instructions for adding the shadcn/ui Badge component to your project using pnpm. This command fetches and installs the necessary component files.923924```bash925pnpm dlx shadcn@latest add badge926```927928--------------------------------929930### Define a Login Block931932Source: https://ui.shadcn.com/docs/registry/examples933934This example shows how to define a 'login-01' block, specifying its type, description, dependencies, and the files it comprises. The 'page.tsx' and 'login-form.tsx' are included as part of the block.935936```json937{938"$schema": "https://ui.shadcn.com/schema/registry-item.json",939"name": "login-01",940"type": "registry:block",941"description": "A simple login form.",942"registryDependencies": [943"button",944"card",945"input",946"label"947],948"files": [949{950"path": "blocks/login-01/page.tsx",951"content": "import { LoginForm } ...",952"type": "registry:page",953"target": "app/login/page.tsx"954},955{956"path": "blocks/login-01/components/login-form.tsx",957"content": "...",958"type": "registry:component"959}960]961}962```963964--------------------------------965966### Menubar Component Installation (pnpm)967968Source: https://ui.shadcn.com/docs/components/menubar969970Instructions for installing the Menubar component from shadcn/ui using the pnpm package manager. This command-line interface (CLI) command fetches and adds the necessary component files to your project.971972```bash973pnpm dlx shadcn@latest add menubar974```975976--------------------------------977978### shadcn/ui Card Component - Installation979980Source: https://ui.shadcn.com/docs/components/card981982Instructions for installing the Card component in your project using the shadcn/ui CLI. This command automates the process of adding the necessary files to your components directory.983984```bash985pnpm dlx shadcn@latest add card986```987988--------------------------------989990### Custom Theme Example991992Source: https://ui.shadcn.com/docs/registry/examples993994Defines a custom theme with specific color variables for both light and dark modes. This allows for a unique color palette across the application.995996```json997{998"$schema": "https://ui.shadcn.com/schema/registry-item.json",999"name": "custom-theme",1000"type": "registry:theme",1001"cssVars": {1002"light": {1003"background": "oklch(1 0 0)",1004"foreground": "oklch(0.141 0.005 285.823)",1005"primary": "oklch(0.546 0.245 262.881)",1006"primary-foreground": "oklch(0.97 0.014 254.604)",1007"ring": "oklch(0.746 0.16 232.661)",1008"sidebar-primary": "oklch(0.546 0.245 262.881)",1009"sidebar-primary-foreground": "oklch(0.97 0.014 254.604)",1010"sidebar-ring": "oklch(0.746 0.16 232.661)"1011},1012"dark": {1013"background": "oklch(1 0 0)",1014"foreground": "oklch(0.141 0.005 285.823)",1015"primary": "oklch(0.707 0.165 254.624)",1016"primary-foreground": "oklch(0.97 0.014 254.604)",1017"ring": "oklch(0.707 0.165 254.624)",1018"sidebar-primary": "oklch(0.707 0.165 254.624)",1019"sidebar-primary-foreground": "oklch(0.97 0.014 254.604)",1020"sidebar-ring": "oklch(0.707 0.165 254.624)"1021}1022}1023}1024```10251026--------------------------------10271028### Install Form Component - CLI10291030Source: https://ui.shadcn.com/docs/components/form10311032Command to add the Form component to your project using the shadcn-ui CLI. This command installs the necessary dependencies and component files.10331034```bash1035pnpm dlx shadcn@latest add form1036```10371038--------------------------------10391040### Navigation Menu Installation (CLI)10411042Source: https://ui.shadcn.com/docs/components/navigation-menu10431044Provides instructions for adding the Navigation Menu component to your project using the shadcn/ui CLI with pnpm, npm, or yarn package managers.10451046```bash1047pnpm dlx shadcn@latest add navigation-menu1048```10491050--------------------------------10511052### shadcn/ui Popover Installation Commands10531054Source: https://ui.shadcn.com/docs/components/popover10551056Provides commands for installing the shadcn/ui Popover component. It includes instructions for pnpm, npm, and yarn package managers, as well as a command to add the Popover component using the shadcn CLI.10571058```bash1059pnpm1060npm1061yarn1062bun1063```10641065```bash1066pnpm dlx shadcn@latest add popover1067```10681069--------------------------------10701071### Install Calendar Blocks using shadcn-ui CLI10721073Source: https://ui.shadcn.com/docs/components/calendar10741075Instructions to install the latest version of the calendar blocks using the shadcn-ui CLI. This command fetches and adds the necessary calendar components to your project.10761077```bash1078pnpm dlx shadcn@latest add calendar-021079```10801081--------------------------------10821083### Initialize Project from Local File using shadcn CLI10841085Source: https://ui.shadcn.com/docs/changelog10861087This command initializes a project using a local JSON file as a template. It's useful for zero-setup workflows and testing registry items locally.10881089```bash1090npx shadcn init ./template.json1091```10921093--------------------------------10941095### Avatar Component Installation10961097Source: https://ui.shadcn.com/docs/components/avatar10981099Provides instructions for installing the Avatar component using the shadcn/ui CLI. This typically involves running a command like 'pnpm dlx shadcn@latest add avatar' after setting up the project.11001101```bash1102pnpm dlx shadcn@latest add avatar1103```11041105--------------------------------11061107### shadcn/ui Slider Component Installation11081109Source: https://ui.shadcn.com/docs/components/slider11101111Instructions for installing the shadcn/ui Slider component. This includes methods using pnpm, npm, yarn, and bun, as well as a command-line instruction to add the slider dependency using the shadcn CLI.11121113```bash1114pnpm dlx shadcn@latest add slider1115```11161117--------------------------------11181119### Install shadcn/ui Button Component11201121Source: https://ui.shadcn.com/docs/components/button11221123Instructions for installing the shadcn/ui Button component using package managers like pnpm, npm, or yarn. It also includes the command to add the button component to your project.11241125```bash1126pnpm dlx shadcn@latest add button1127```11281129--------------------------------11301131### Install Sidebar Component using PNPM11321133Source: https://ui.shadcn.com/docs/components/sidebar11341135Installs the 'sidebar.tsx' component using the pnpm package manager. This is the recommended method for adding the component to your project.11361137```bash1138pnpm dlx shadcn@latest add sidebar1139```11401141--------------------------------11421143### Custom Style Extending shadcn/ui11441145Source: https://ui.shadcn.com/docs/registry/examples11461147Defines a custom style that extends shadcn/ui, installing specific dependencies and components. It also sets custom CSS variables for fonts and a brand color in both light and dark modes.11481149```json1150{1151"$schema": "https://ui.shadcn.com/schema/registry-item.json",1152"name": "example-style",1153"type": "registry:style",1154"dependencies": [1155"@tabler/icons-react"1156],1157"registryDependencies": [1158"login-01",1159"calendar",1160"https://example.com/r/editor.json"1161],1162"cssVars": {1163"theme": {1164"font-sans": "Inter, sans-serif"1165},1166"light": {1167"brand": "20 14.3% 4.1%"1168},1169"dark": {1170"brand": "20 14.3% 4.1%"1171}1172}1173}1174```11751176--------------------------------11771178### Install shadcn/ui Table Component (CLI)11791180Source: https://ui.shadcn.com/docs/components/table11811182This command installs the Table component and its dependencies into your shadcn/ui project using the pnpm package manager. Ensure you have shadcn/ui CLI set up.11831184```bash1185pnpm dlx shadcn@latest add table1186```11871188--------------------------------11891190### Install Textarea Component with shadcn/ui11911192Source: https://ui.shadcn.com/docs/components/textarea11931194Instructions for installing the Textarea component using different package managers (pnpm, npm, yarn, bun). This is a prerequisite for using the Textarea component in your project.11951196```bash1197pnpm dlx shadcn@latest add textarea1198```11991200--------------------------------12011202### Create Remix Project12031204Source: https://ui.shadcn.com/docs/installation/remix12051206Command to create a new Remix project using pnpm, npm, or yarn. Ensures a fresh project structure for integration.12071208```bash1209pnpm dlx create-remix@latest my-app1210```12111212--------------------------------12131214### Sheet Component Installation (CLI)12151216Source: https://ui.shadcn.com/docs/components/sheet12171218Provides instructions for installing the Sheet component using the shadcn-ui CLI. This command-line approach simplifies the process of adding the component to your project, ensuring all necessary dependencies are handled.12191220```bash1221pnpm dlx shadcn@latest add sheet1222```12231224--------------------------------12251226### SidebarHeader Component Example12271228Source: https://ui.shadcn.com/docs/components/sidebar12291230Shows how to incorporate the SidebarHeader component to add a sticky header. The example includes a dropdown menu for workspace selection.12311232```typescript1233import { SidebarHeader } from "@/components/ui/sidebar"12341235export function AppSidebar() {1236return (123712381239124012411242Acme Inc.1243Acme Corp.124412451246)1247}1248```12491250--------------------------------12511252### shadcn/ui Drawer Component Installation Command12531254Source: https://ui.shadcn.com/docs/components/drawer12551256Shows the command-line interface (CLI) command to install the Drawer component into a shadcn/ui project. This command uses `pnpm dlx` to execute the `shadcn@latest add drawer` command, ensuring the latest version is added.12571258```bash1259pnpm dlx shadcn@latest add drawer12601261```12621263--------------------------------12641265### Add CSS Import with Media Queries12661267Source: https://ui.shadcn.com/docs/registry/examples12681269This configuration shows how to use CSS imports with media queries, allowing for conditional loading of styles based on print or screen size.12701271```json1272{1273"$schema": "https://ui.shadcn.com/schema/registry-item.json",1274"name": "responsive-import",1275"type": "registry:item",1276"css": {1277"@import "print-styles.css" print": {},1278"@import url("mobile.css") screen and (max-width: 768px)": {}1279}1280}1281```12821283--------------------------------12841285### SidebarFooter Component Example12861287Source: https://ui.shadcn.com/docs/components/sidebar12881289Demonstrates the use of the SidebarFooter component for adding a sticky footer. This example includes user account and billing links, and a sign-out option.12901291```typescript1292import { SidebarFooter } from "@/components/ui/sidebar"12931294export function AppSidebar() {1295return (129612971298CN129913011302More optionsAccountBillingSettingsSign out1303)1304}1305```13061307--------------------------------13081309### shadcn/ui Dialog Component Installation (CLI)13101311Source: https://ui.shadcn.com/docs/components/dialog13121313Provides the command to install the Dialog component using the shadcn/ui CLI with pnpm. This command adds the necessary files and dependencies for the Dialog component to your project. It's a prerequisite for using the component in your application.13141315```bash1316pnpm dlx shadcn@latest add dialog1317```13181319--------------------------------13201321### shadcn CLI init Command Usage13221323Source: https://ui.shadcn.com/docs/cli13241325Illustrates the usage of the `shadcn init` command, including its arguments for specifying component names, URLs, or local paths, and available options like `--template`. This command is crucial for setting up the project's components and configuration.13261327```bash1328Usage: shadcn init [options] [components...]13291330initialize your project and install dependencies13311332Arguments:1333components name, url or local path to component13341335Options:1336-t, --template1337```13381339--------------------------------13401341### Install shadcn/ui Accordion Component13421343Source: https://ui.shadcn.com/docs/components/accordion13441345Provides commands for installing the Accordion component using different package managers (pnpm, yarn, bun). It also shows the command to add the component using the shadcn-ui CLI.13461347```bash1348pnpm dlx shadcn@latest add accordion1349```13501351--------------------------------13521353### SidebarMenuAction - DropdownMenu Example13541355Source: https://ui.shadcn.com/docs/components/sidebar13561357An example of integrating a DropdownMenu with the SidebarMenuAction component. This allows for contextual actions or sub-options.13581359```javascript1360[Home](#)1361Edit Project1362Delete Project1363```13641365--------------------------------13661367### shadcn/ui Checkbox Installation13681369Source: https://ui.shadcn.com/docs/components/checkbox13701371Provides instructions for installing the Checkbox component using different package managers (pnpm, npm, yarn, bun). It also includes the command to add the component using the shadcn-ui CLI.13721373```bash1374pnpm dlx shadcn@latest add checkbox1375```13761377--------------------------------13781379### Install Hover Card Component using pnpm13801381Source: https://ui.shadcn.com/docs/components/hover-card13821383Command to install the Hover Card component and its dependencies into your project using pnpm and the shadcn-ui CLI.13841385```bash1386pnpm dlx shadcn@latest add hover-card1387```13881389--------------------------------13901391### Create React Router Project13921393Source: https://ui.shadcn.com/docs/installation/react-router13941395This command initializes a new React Router project using pnpm. It's the first step in setting up your application before integrating shadcn/ui.13961397```bash1398pnpm dlx create-react-router@latest my-app1399```14001401--------------------------------14021403### Create Astro Project with Tailwind CSS14041405Source: https://ui.shadcn.com/docs/installation/astro14061407Command to create a new Astro project with Tailwind CSS, React integration, package installation, and Git initialization.14081409```bash1410pnpm dlx create-astro@latest astro-app --template with-tailwindcss --install --add react --git1411```14121413--------------------------------14141415### Express.js Example for Registry Authentication14161417Source: https://ui.shadcn.com/docs/registry/authentication14181419Example of an Express.js route handler for registry authentication, checking the Authorization header for a Bearer token.14201421```APIDOC1422## Express.js Example14231424### Description1425This Express.js example demonstrates a basic route handler for authenticating requests to your component registry. It checks the `Authorization` header for a Bearer token.14261427### Method1428GET14291430### Endpoint1431`/registry/:name.json`14321433### Parameters1434#### Path Parameters1435- **name** (string) - Required - The name of the component to retrieve.14361437#### Query Parameters1438N/A14391440#### Request Body1441N/A14421443### Request Example1444N/A (GET request)14451446### Response1447#### Success Response (200)1448- **component** (object) - The requested component data.14491450#### Error Responses1451- **401 Unauthorized**: If the provided token is invalid.1452- **404 Not Found**: If the component is not found.14531454### Code Example1455```javascript1456app.get("/registry/:name.json", (req, res) => {1457const token = req.headers.authorization?.replace("Bearer ", "")14581459if (!isValidToken(token)) {1460return res.status(401).json({ error: "Unauthorized" })1461}14621463const component = getComponent(req.params.name)1464if (!component) {1465return res.status(404).json({ error: "Component not found" })1466}14671468res.json(component)1469})14701471function isValidToken(token) {1472// Add your token validation logic here.1473// Example: return token === process.env.VALID_TOKEN;1474return true; // Placeholder1475}14761477function getComponent(componentName) {1478// Replace with your actual logic to fetch the component.1479// Example: return { name: componentName, data: "component data" };1480return null; // Placeholder1481}1482```1483```14841485--------------------------------14861487### shadcn/ui Context Menu Installation (CLI)14881489Source: https://ui.shadcn.com/docs/components/context-menu14901491Instructions for adding the shadcn/ui Context Menu component to your project using the command-line interface. This command will automatically download and update the necessary dependencies for the component.14921493```bash1494pnpm dlx shadcn@latest add context-menu1495```14961497--------------------------------14981499### Add Complex CSS Utility15001501Source: https://ui.shadcn.com/docs/registry/examples15021503This example defines a more complex CSS utility called 'scrollbar-hidden'. It targets the scrollbar pseudo-elements to hide them.15041505```json1506{1507"$schema": "https://ui.shadcn.com/schema/registry-item.json",1508"name": "custom-component",1509"type": "registry:component",1510"css": {1511"@utility scrollbar-hidden": {1512"scrollbar-hidden": {1513"&::-webkit-scrollbar": {1514"display": "none"1515}1516}1517}1518}1519}1520```15211522--------------------------------15231524### shadcn/ui Label Component Installation15251526Source: https://ui.shadcn.com/docs/components/label15271528Provides instructions for installing the Label component into a shadcn/ui project using different package managers like pnpm, npm, yarn, and bun. It also shows the command to add the component using the shadcn CLI.15291530```bash1531pnpm dlx shadcn@latest add label1532```15331534--------------------------------15351536### Install Aspect Ratio Component using pnpm15371538Source: https://ui.shadcn.com/docs/components/aspect-ratio15391540Command to install the Aspect Ratio component using the pnpm package manager. This command adds the component to your project, making it available for use.15411542```bash1543pnpm dlx shadcn@latest add aspect-ratio1544```15451546--------------------------------15471548### React ButtonGroup Installation using pnpm15491550Source: https://ui.shadcn.com/docs/components/button-group15511552Provides the command to install the 'button-group' component from shadcn/ui using the pnpm package manager. This command downloads and integrates the necessary files into your project.15531554```bash1555pnpm dlx shadcn@latest add button-group1556```15571558--------------------------------15591560### Switch Component Usage Example (React)15611562Source: https://ui.shadcn.com/docs/components/switch15631564This code snippet demonstrates how to use the Switch component in a React application. It requires the Label and Switch components from '@/components/ui/label' and '@/components/ui/switch' respectively. The example shows a basic implementation with a label and the switch itself.15651566```jsx1567import { Label } from "@/components/ui/label"1568import { Switch } from "@/components/ui/switch"15691570export function SwitchDemo() {1571return (157215731574Airplane Mode15751576)1577}1578```