### Install Combobox Component
Source: https://www.9ui.dev/docs/components/combobox
Install the Combobox component using the shadcn-ui CLI.
```bash
npx shadcn@latest add @9ui/combobox
```
--------------------------------
### Dropdown Menu Example
Source: https://www.9ui.dev/docs/components/dropdown-menu
A comprehensive example demonstrating the usage of the Dropdown Menu component with various interactive elements like playback controls, shuffle and repeat options, sorting, and sub-menus. Ensure 'lucide-react' is installed for icons.
```tsx
"use client"
import { useState } from "react"
import {
PauseIcon,
PlayIcon,
SkipBackIcon,
SkipForwardIcon,
} from "lucide-react"
import { Button } from "@/components/ui/button"
import {
DropdownMenu,
DropdownMenuCheckboxItem,
DropdownMenuContent,
DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuRadioGroup,
DropdownMenuRadioItem,
DropdownMenuSeparator,
DropdownMenuShortcut,
DropdownMenuSub,
DropdownMenuSubContent,
DropdownMenuSubTrigger,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
export default function DropdownMenuDemo() {
const [shuffle, setShuffle] = useState(false)
const [repeat, setRepeat] = useState(false)
const [sortBy, setSortBy] = useState("artist")
return (
}
/>
Playback
Play
⌘P
Pause
⇧⌘P
Previous
⌘[
Next
⌘]
Shuffle
Repeat
Enhanced Audio
Sort byArtistRepeatTitleAdd to PlaylistJazzRockPop
)
}
```
--------------------------------
### Install Input OTP Dependencies
Source: https://www.9ui.dev/docs/components/input-otp
Install the necessary 'input-otp' package using npm.
```bash
npm install input-otp
```
--------------------------------
### Install Badge Component
Source: https://www.9ui.dev/docs/components/badge
Use this command to install the Badge component in your project.
```bash
npx shadcn@latest add @9ui/badge
```
--------------------------------
### Install Toast Component
Source: https://www.9ui.dev/docs/components/toast
Run this command in your terminal to install the Toast component package.
```bash
npx shadcn@latest add @9ui/toast
```
--------------------------------
### Install 9ui Dependencies
Source: https://www.9ui.dev/docs/getting-started/installation
Install the core dependencies required for 9ui components using npm. Ensure you have Node.js and npm installed.
```bash
npm install tw-animate-css @base-ui/react tailwind-merge clsx lucide-react class-variance-authority
```
--------------------------------
### Install Textarea Component
Source: https://www.9ui.dev/docs/components/textarea
Use this command to install the Textarea component in your project.
```bash
npx shadcn@latest add @9ui/textarea
```
--------------------------------
### Install Calendar Component
Source: https://www.9ui.dev/docs/components/calendar
Install the Calendar component using the shadcn CLI. Ensure you have react-day-picker installed as a dependency.
```bash
npx shadcn@latest add @9ui/calendar
```
```bash
npm install react-day-picker
```
--------------------------------
### Install Chart Component
Source: https://www.9ui.dev/docs/components/chart
Install the Chart component using the shadcn-ui CLI. Ensure you have the necessary dependencies installed.
```bash
npx shadcn@latest add @9ui/chart
```
--------------------------------
### Install Select Component
Source: https://www.9ui.dev/docs/components/select
Install the Select component using the shadcn-ui CLI. This command adds the necessary package to your project.
```bash
npx shadcn@latest add @9ui/select
```
--------------------------------
### Navigation Menu Component Example
Source: https://www.9ui.dev/docs/components/navigation-menu
A full example of the Navigation Menu component in React, demonstrating nested menus for 'Getting Started' and 'Components', along with a 'Source Code' link.
```tsx
"use client"
import * as React from "react"
import Link from "next/link"
import { Icons } from "@/components/icons"
import {
NavigationMenu,
NavigationMenuContent,
NavigationMenuItem,
NavigationMenuLink,
NavigationMenuList,
NavigationMenuTrigger,
navigationMenuTriggerStyle,
} from "@/components/ui/navigation-menu"
import { cn } from "@/lib/utils"
const components: { title: string; href: string; description: string }[] = [
{
title: "Alert Dialog",
href: "/docs/components/alert-dialog",
description:
"A modal dialog for critical messages or confirmation actions.",
},
{
title: "Preview Card",
href: "/docs/components/preview-card",
description: "Used to display a preview of content when hovered.",
},
{
title: "Emoji Picker",
href: "/docs/components/emoji-picker",
description: "A component that allows users to pick an emoji.",
},
{
title: "Progress",
href: "/docs/components/progress",
description: "Displays a progress bar with an optional label.",
},
{
title: "Tabs",
href: "/docs/components/tabs",
description: "Used to organize content into tabbed navigation.",
},
{
title: "Tooltip",
href: "/docs/components/tooltip",
description: "Used to provide context or hints for elements.",
},
]
const gettingStartedItems = [
{
title: "Introduction",
href: "/docs/getting-started/introduction",
description: "Learn about 9ui.",
},
{
title: "Installation",
href: "/docs/getting-started/installation",
description: "How to install 9ui in your project.",
},
{
title: "Roadmap",
href: "/docs/getting-started/roadmap",
description: "See what we are working on next.",
},
]
export default function NavigationMenuDemo() {
return (
Getting Started
)
}
```
--------------------------------
### Install Input Component
Source: https://www.9ui.dev/docs/components/input
Install the Input component using the shadcn-ui CLI. This command adds the necessary package to your project.
```bash
npx shadcn@latest add @9ui/input
```
--------------------------------
### Install Kbd Component
Source: https://www.9ui.dev/docs/components/kbd
Install the Kbd component using the shadcn-ui CLI. This command adds the necessary files to your project.
```bash
npx shadcn@latest add @9ui/kbd
```
--------------------------------
### Install Tooltip Component
Source: https://www.9ui.dev/docs/components/tooltip
Install the tooltip component using the shadcn-ui CLI. This command adds the necessary files to your project.
```bash
npx shadcn@latest add @9ui/tooltip
```
--------------------------------
### Install Resizable Components
Source: https://www.9ui.dev/docs/components/resizable
Use this command to add the resizable components to your project.
```bash
npx shadcn@latest add @9ui/resizable
```
--------------------------------
### Install Drawer Component
Source: https://www.9ui.dev/docs/components/drawer
Command to install the Drawer component using the shadcn CLI. Ensure you have npx available.
```bash
npx shadcn@latest add @9ui/drawer
```
--------------------------------
### Install Skeleton Component
Source: https://www.9ui.dev/docs/components/skeleton
Use this command to add the Skeleton component to your project. Ensure you have shadcn-ui installed.
```bash
npx shadcn@latest add @9ui/skeleton
```
--------------------------------
### Install Table Component
Source: https://www.9ui.dev/docs/components/table
Use this command to install the Table component in your project. This command should be run in your terminal.
```bash
npx shadcn@latest add @9ui/table
```
--------------------------------
### Install Button Component
Source: https://www.9ui.dev/docs/components/button
Use this command to add the Button component to your project. Ensure you have shadcn-ui installed.
```bash
npx shadcn@latest add @9ui/button
```
--------------------------------
### Basic Select Example
Source: https://www.9ui.dev/docs/components/select
A fundamental example demonstrating how to use the Select component with a list of items. It includes the necessary imports and component structure.
```typescript
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select"
const items = [
{
label: "Select a fruit",
value: null,
},
{
label: "Apple",
value: "apple",
},
{
label: "Banana",
value: "banana",
},
{
label: "Cherry",
value: "cherry",
},
]
export default function SelectDemo() {
return (
)
}
```
--------------------------------
### Install Dialog Component
Source: https://www.9ui.dev/docs/components/dialog
Use this command to add the Dialog component to your project. Ensure you have npx installed.
```bash
npx shadcn@latest add @9ui/dialog
```
--------------------------------
### Install Phone Input Component
Source: https://www.9ui.dev/docs/components/phone-input
Install the Phone Input component using npm. This command adds the necessary package to your project.
```bash
npx shadcn@latest add @9ui/phone-input
```
--------------------------------
### Install Alert Component
Source: https://www.9ui.dev/docs/components/alert
Install the Alert component using the shadcn-ui CLI. This command adds the necessary files to your project.
```bash
npx shadcn@latest add @9ui/alert
```
--------------------------------
### Install Pagination Component
Source: https://www.9ui.dev/docs/components/pagination
Install the Pagination component using the shadcn-ui CLI. This command adds the necessary files to your project.
```bash
npx shadcn@latest add @9ui/pagination
```
--------------------------------
### Full Tabs Component Example
Source: https://www.9ui.dev/docs/components/tabs
A comprehensive example demonstrating the implementation of the Tabs component with login and signup forms.
```tsx
import { Button } from "@/components/ui/button"
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
export default function TabsDemo() {
return (
LoginSign upLoginLogin to your account to continue
Sign upSign up to create an account
)
}
```
--------------------------------
### Install Slider Component
Source: https://www.9ui.dev/docs/components/slider
Use this command to install the Slider component via npm.
```bash
npx shadcn@latest add @9ui/slider
```
--------------------------------
### Install Toolbar Component
Source: https://www.9ui.dev/docs/components/toolbar
Install the Toolbar component using the shadcn-ui CLI. This command adds the necessary files to your project.
```bash
npx shadcn@latest add @9ui/toolbar
```
--------------------------------
### Install Checkbox Component
Source: https://www.9ui.dev/docs/components/checkbox
Use this command to install the checkbox component in your project via the terminal.
```bash
npx shadcn@latest add @9ui/checkbox
```
--------------------------------
### Install Autocomplete Component
Source: https://www.9ui.dev/docs/components/autocomplete
Use this command to add the Autocomplete component to your project.
```bash
npx shadcn@latest add @9ui/autocomplete
```
--------------------------------
### Install Toggle Component
Source: https://www.9ui.dev/docs/components/toggle
Use this command to add the Toggle component to your project.
```bash
npx shadcn@latest add @9ui/toggle
```
--------------------------------
### Install Progress Component
Source: https://www.9ui.dev/docs/components/progress
Install the Progress component using the shadcn CLI. This command adds the necessary package to your project.
```bash
npx shadcn@latest add @9ui/progress
```
--------------------------------
### Install Collapsible Component
Source: https://www.9ui.dev/docs/components/collapsible
Use this command to add the Collapsible component to your project. Ensure you have npx installed.
```bash
npx shadcn@latest add @9ui/collapsible
```
--------------------------------
### Install Aspect Ratio Component
Source: https://www.9ui.dev/docs/components/aspect-ratio
Install the Aspect Ratio component using the shadcn-ui CLI. This command adds the necessary files to your project.
```bash
npx shadcn@latest add @9ui/aspect-ratio
```
--------------------------------
### Install Command Component
Source: https://www.9ui.dev/docs/components/command
Use this command to add the Command component to your project.
```bash
npx shadcn@latest add @9ui/command
```
--------------------------------
### Install Meter Component
Source: https://www.9ui.dev/docs/components/meter
Install the Meter component using the shadcn-ui CLI. This command adds the necessary package to your project.
```bash
npx shadcn@latest add @9ui/meter
```
--------------------------------
### Install Card Component
Source: https://www.9ui.dev/docs/components/card
Install the Card component using the shadcn-ui CLI. This command adds the necessary files to your project.
```bash
npx shadcn@latest add @9ui/card
```
--------------------------------
### Install Menubar Component
Source: https://www.9ui.dev/docs/components/menubar
Use this command to add the Menubar component to your project. This command installs the necessary package via npm.
```bash
npx shadcn@latest add @9ui/menubar
```
--------------------------------
### Install Switch Component
Source: https://www.9ui.dev/docs/components/switch
Use this command to add the Switch component to your project via the shadcn-ui CLI. Ensure you have the CLI installed and configured.
```bash
npx shadcn@latest add @9ui/switch
```
--------------------------------
### Install Tabs Component
Source: https://www.9ui.dev/docs/components/tabs
Install the Tabs component using the shadcn-ui CLI. This command adds the necessary dependencies to your project.
```bash
npx shadcn@latest add @9ui/tabs
```
--------------------------------
### Preview Card Component Example
Source: https://www.9ui.dev/docs/components/preview-card
This is a full example of the Preview Card component in action. It requires client-side rendering and imports necessary components from 9ui.
```tsx
"use client"
import { Icons } from "@/components/icons"
import {
PreviewCard,
PreviewCardContent,
PreviewCardTrigger,
} from "@/components/ui/preview-card"
export default function PreviewCardDemo() {
return (
This is a preview card component from{"}
9ui
.
Beautiful, customizable components built with{"}
Base UI
{"
```
```tsx
and{"}
Tailwind CSS
.
)
}
```
--------------------------------
### Install Dropdown Menu Component
Source: https://www.9ui.dev/docs/components/dropdown-menu
Use this command to add the Dropdown Menu component to your project. Ensure you have the latest version of shadcn-ui installed.
```bash
npx shadcn@latest add @9ui/dropdown-menu
```
--------------------------------
### Install Accordion Component
Source: https://www.9ui.dev/docs/components/accordion
Install the Accordion component using the shadcn-ui CLI. This command adds the necessary package to your project.
```bash
npx shadcn@latest add @9ui/accordion
```
--------------------------------
### Install Carousel Component
Source: https://www.9ui.dev/docs/components/carousel
Install the Carousel component using the shadcn-ui CLI. This command adds the necessary files to your project.
```bash
npx shadcn@latest add @9ui/carousel
```
--------------------------------
### Card Example: With Image
Source: https://www.9ui.dev/docs/components/card
Demonstrates a Card component integrated with an image. This example showcases how to display visual content within the card structure.
```tsx
import Image from "next/image"
import { Button } from "@/components/ui/button"
import {
Card,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
export default function CardWithImageDemo() {
return (
What is 9ui?
Deep dive into the 9ui components and learn how to use them in your
own projects.
)
}
```
--------------------------------
### Initialize Project with Shadcn
Source: https://www.9ui.dev/docs/getting-started/installation
Use this command to quickly set up a new project with 9ui integration. Ensure you have npx installed.
```bash
npx shadcn@latest init https://9ui.dev/r/init.json
```
--------------------------------
### Install Popover Component
Source: https://www.9ui.dev/docs/components/popover
Use this command to add the Popover component to your project.
```bash
npx shadcn@latest add @9ui/popover
```
--------------------------------
### Install Preview Card Component
Source: https://www.9ui.dev/docs/components/preview-card
Use this command to add the Preview Card component to your project using shadcn-ui.
```bash
npx shadcn@latest add @9ui/preview-card
```
--------------------------------
### Dialog Demo Component
Source: https://www.9ui.dev/docs/components/dialog
A complete example of a Dialog component in React, including imports and structure. Use this as a starting point for implementing dialogs in your application.
```tsx
import {
Button
} from "@/components/ui/button"
import {
Dialog,
DialogClose,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog"
export default function DialogDemo() {
return (
)
}
```
--------------------------------
### Meter Component Example
Source: https://www.9ui.dev/docs/components/meter
A complete example demonstrating the Meter component's usage with a value and maximum. It includes a label and a formatted value display.
```tsx
import { Meter, MeterLabel, MeterValue } from "@/components/ui/meter"
export default function MeterDemo() {
return (
)
}
```
--------------------------------
### Context Menu Example
Source: https://www.9ui.dev/docs/components/context-menu
Demonstrates the full implementation of a context menu with various interactive elements and sub-menus. Ensure the 'use client' directive is present for client-side interactivity.
```tsx
"use client"
import {
ContextMenu,
ContextMenuCheckboxItem,
ContextMenuContent,
ContextMenuGroup,
ContextMenuItem,
ContextMenuLabel,
ContextMenuRadioGroup,
ContextMenuRadioItem,
ContextMenuSeparator,
ContextMenuShortcut,
ContextMenuSub,
ContextMenuSubContent,
ContextMenuSubTrigger,
ContextMenuTrigger,
} from "@/components/ui/context-menu"
export default function ContextMenuDemo() {
return (
Right Click Here
Back
⌘[
Forward
⌘]
Reload
⌘RMoreSave AsPrintCastInspectSettingsAlways on TopShow full URLZoom50%100%150%
)
}
```
--------------------------------
### Install Carousel Dependencies
Source: https://www.9ui.dev/docs/components/carousel
Install the core dependencies for the carousel functionality. Ensure these are installed before using the component.
```bash
npm install embla-carousel-react embla-carousel
```
--------------------------------
### Install Sonner
Source: https://www.9ui.dev/docs/components/sonner
Run this command in your terminal to add Sonner to your project.
```bash
npx shadcn@latest add @9ui/sonner
```
--------------------------------
### Menubar Component Example
Source: https://www.9ui.dev/docs/components/menubar
Demonstrates the full implementation of the Menubar component with various menu items, submenus, radio groups, checkboxes, and shortcuts. Ensure all necessary imports are included.
```tsx
import {
Menubar,
MenubarCheckboxItem,
MenubarContent,
MenubarItem,
MenubarMenu,
MenubarRadioGroup,
MenubarRadioItem,
MenubarSeparator,
MenubarShortcut,
MenubarSub,
MenubarSubContent,
MenubarSubTrigger,
MenubarTrigger,
} from "@/components/ui/menubar"
export default function MenubarDemo() {
return (
File
New File
⌘N
New Window
⇧⌘N
Open
⌘O
Open Folder
⇧⌘OOpen Recent
Save
⌘S
Save As
⇧⌘S
Close Window
⌘WEdit
Undo
⌘Z
Redo
⌘Y
Cut
⌘X
Copy
⌘C
Paste
⌘V
Find
⌘F
Replace
⌥⌘FViewAppearanceSystemLightDark
Show/Hide Sidebar
⌃⌥⌘*
Command Palette
⇧⌘PExpand Tabs
Zoom In
⌘+
Zoom Out
⌘-
Reset Zoom
⌘0Show ToolbarShow Status BarHelpGetting StartedReport IssueCheck for UpdatesContact the Team
)
}
```
--------------------------------
### Command Component Example
Source: https://www.9ui.dev/docs/components/command
Demonstrates the full usage of the Command component with various groups and items, including projects, teams, and navigation.
```tsx
import {
ArrowRightIcon,
LayoutGridIcon,
PlusIcon,
UsersIcon,
} from "lucide-react"
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
CommandList,
CommandSeparator,
CommandShortcut,
} from "@/components/ui/command"
import { Kbd } from "@/components/ui/kbd"
export default function CommandDemo() {
return (
No results found.Search projects...⌘PCreate new project...CSearch teams...Create new team...TGo to homeGo to profileGo to settingsGo to billing
)
}
```
--------------------------------
### Initialize MCP for AI Assistance
Source: https://www.9ui.dev/docs/getting-started/installation
Run this command to initialize MCP, which provides AI assistance with full context of the 9ui registry. This requires npx.
```bash
npx shadcn@latest mcp init
```
--------------------------------
### Install cmdk-base Dependency
Source: https://www.9ui.dev/docs/components/command
Install the cmdk-base dependency required for the Command component.
```bash
npm install cmdk-base
```
--------------------------------
### Install Recharts Dependency
Source: https://www.9ui.dev/docs/components/chart
Install the Recharts library, which is a peer dependency for the Chart component.
```bash
npm install recharts
```
--------------------------------
### Install Form Dependencies
Source: https://www.9ui.dev/docs/components/form
Install the necessary npm packages for react-hook-form and Zod integration.
```bash
npm install react-hook-form zod @hookform/resolvers
```
--------------------------------
### Install Number Field Component
Source: https://www.9ui.dev/docs/components/number-field
Use this command to install the Number Field component in your project.
```bash
npx shadcn@latest add @9ui/number-field
```
--------------------------------
### Basic Toggle Group Setup
Source: https://www.9ui.dev/docs/components/toggle-group
Demonstrates the basic structure for a Toggle Group with single selection. Ensure necessary icons and components are imported.
```tsx
import { AlignCenterIcon, AlignLeftIcon, AlignRightIcon } from "lucide-react"
import { Toggle } from "@/components/ui/toggle"
import { ToggleGroup } from "@/components/ui/toggle-group"
export default function ToggleGroupDemo() {
return (
)
}
```
--------------------------------
### Install vaul-base Dependency
Source: https://www.9ui.dev/docs/components/drawer
Install the vaul-base package using npm. This is a required dependency for the Drawer component.
```bash
npm install vaul-base
```
--------------------------------
### Install Input OTP Component
Source: https://www.9ui.dev/docs/components/input-otp
Use this command to add the Input OTP component to your project using shadcn-ui.
```bash
npx shadcn@latest add @9ui/input-otp
```
--------------------------------
### Install Alert Dialog
Source: https://www.9ui.dev/docs/components/alert-dialog
Use this command to add the Alert Dialog component to your project.
```bash
npx shadcn@latest add @9ui/alert-dialog
```
--------------------------------
### Install Form Component
Source: https://www.9ui.dev/docs/components/form
Use this command to add the form component to your project via shadcn-ui.
```bash
npx shadcn@latest add @9ui/form
```
--------------------------------
### Install Context Menu Component
Source: https://www.9ui.dev/docs/components/context-menu
Use this command to add the Context Menu component to your project via the shadcn-ui CLI.
```bash
npx shadcn@latest add @9ui/context-menu
```
--------------------------------
### Install Avatar Component
Source: https://www.9ui.dev/docs/components/avatar
Install the Avatar component using the shadcn-ui CLI. This command adds the necessary package to your project.
```bash
npx shadcn@latest add @9ui/avatar
```
--------------------------------
### Install Navigation Menu Component
Source: https://www.9ui.dev/docs/components/navigation-menu
Use this command to add the Navigation Menu component to your project via the shadcn CLI.
```bash
npx shadcn@latest add @9ui/navigation-menu
```
--------------------------------
### Drawer Example with Feedback Form
Source: https://www.9ui.dev/docs/components/drawer
Demonstrates a complete Drawer component implementation including a feedback form with rating and textarea. Requires 'react', 'lucide-react', and custom components from '@/components/ui'.
```tsx
"use client"
import { useState } from "react"
import { StarIcon } from "lucide-react"
import { Button } from "@/components/ui/button"
import {
Drawer,
DrawerClose,
DrawerContent,
DrawerDescription,
DrawerFooter,
DrawerHeader,
DrawerTitle,
DrawerTrigger,
} from "@/components/ui/drawer"
import { Textarea } from "@/components/ui/textarea"
import { cn } from "@/lib/utils"
export default function DrawerDemo() {
const [rating, setRating] = useState(undefined)
const handleChangeRating = (newRating: number) => {
if (newRating === rating) {
setRating(undefined)
} else {
setRating(newRating)
}
}
return (
}
/>
Provide Your Feedback
We value your feedback. Please rate your experience and leave a
review.
)
}
```
--------------------------------
### Install Breadcrumbs Component
Source: https://www.9ui.dev/docs/components/breadcrumbs
Install the breadcrumbs component using the shadcn-ui CLI. This command adds the necessary files to your project.
```bash
npx shadcn@latest add @9ui/breadcrumbs
```
--------------------------------
### Setup ToastProvider in Layout
Source: https://www.9ui.dev/docs/components/toast
Wrap your main application content with ToastProvider in your root layout file to enable toast functionality.
```tsx
import { ToastProvider } from "@/components/ui/toast"
export default function RootLayout({ children }) {
return (
{children}
)
}
```
--------------------------------
### Basic Combobox Example
Source: https://www.9ui.dev/docs/components/combobox
A basic example of a Combobox component for selecting a fruit from a list. Ensure the `fruits` array is defined.
```typescript
import * as React from "react"
import {
Combobox,
ComboboxContent,
ComboboxEmpty,
ComboboxInput,
ComboboxItem,
ComboboxList,
} from "@/components/ui/combobox"
import { Label } from "@/components/ui/label"
export default function ComboboxDemo() {
return (