From f00a94d9e57a7810b8d90d4d68fbec3b9970334f Mon Sep 17 00:00:00 2001 From: shadcn Date: Tue, 7 Apr 2026 15:23:27 +0400 Subject: [PATCH] docs: add composition section --- apps/v4/app/globals.css | 27 ++++++ .../docs/components/base/accordion.mdx | 14 +++ .../docs/components/base/alert-dialog.mdx | 17 ++++ .../v4/content/docs/components/base/alert.mdx | 12 +++ .../content/docs/components/base/avatar.mdx | 26 ++++++ .../docs/components/base/breadcrumb.mdx | 17 ++++ .../docs/components/base/button-group.mdx | 11 +++ apps/v4/content/docs/components/base/card.mdx | 14 +++ .../content/docs/components/base/carousel.mdx | 13 +++ .../docs/components/base/collapsible.mdx | 10 +++ .../content/docs/components/base/combobox.mdx | 56 ++++++++++++ .../content/docs/components/base/command.mdx | 18 ++++ .../docs/components/base/context-menu.mdx | 31 +++++++ .../docs/components/base/date-picker.mdx | 11 +++ .../content/docs/components/base/dialog.mdx | 14 +++ .../content/docs/components/base/drawer.mdx | 14 +++ .../docs/components/base/dropdown-menu.mdx | 32 +++++++ .../v4/content/docs/components/base/empty.mdx | 13 +++ .../v4/content/docs/components/base/field.mdx | 50 +++++++++++ .../docs/components/base/hover-card.mdx | 10 +++ .../docs/components/base/input-group.mdx | 12 +++ .../docs/components/base/input-otp.mdx | 21 +++++ apps/v4/content/docs/components/base/item.mdx | 16 ++++ apps/v4/content/docs/components/base/kbd.mdx | 11 +++ .../content/docs/components/base/menubar.mdx | 40 +++++++++ .../docs/components/base/native-select.mdx | 28 ++++++ .../docs/components/base/navigation-menu.mdx | 17 ++++ .../docs/components/base/pagination.mdx | 17 ++++ .../content/docs/components/base/popover.mdx | 10 +++ .../content/docs/components/base/progress.mdx | 27 ++++++ .../docs/components/base/radio-group.mdx | 10 +++ .../docs/components/base/resizable.mdx | 11 +++ .../docs/components/base/scroll-area.mdx | 9 ++ .../content/docs/components/base/select.mdx | 20 +++++ .../v4/content/docs/components/base/sheet.mdx | 14 +++ .../content/docs/components/base/sidebar.mdx | 87 +++++++++++++------ .../v4/content/docs/components/base/table.mdx | 27 ++++++ apps/v4/content/docs/components/base/tabs.mdx | 13 +++ .../docs/components/base/toggle-group.mdx | 10 +++ .../content/docs/components/base/tooltip.mdx | 10 +++ .../docs/components/radix/accordion.mdx | 14 +++ .../docs/components/radix/alert-dialog.mdx | 17 ++++ .../content/docs/components/radix/alert.mdx | 12 +++ .../content/docs/components/radix/avatar.mdx | 26 ++++++ .../docs/components/radix/breadcrumb.mdx | 17 ++++ .../docs/components/radix/button-group.mdx | 11 +++ .../v4/content/docs/components/radix/card.mdx | 14 +++ .../docs/components/radix/carousel.mdx | 13 +++ .../docs/components/radix/collapsible.mdx | 10 +++ .../docs/components/radix/combobox.mdx | 56 ++++++++++++ .../content/docs/components/radix/command.mdx | 18 ++++ .../docs/components/radix/context-menu.mdx | 31 +++++++ .../docs/components/radix/date-picker.mdx | 11 +++ .../content/docs/components/radix/dialog.mdx | 14 +++ .../content/docs/components/radix/drawer.mdx | 14 +++ .../docs/components/radix/dropdown-menu.mdx | 32 +++++++ .../content/docs/components/radix/empty.mdx | 13 +++ .../content/docs/components/radix/field.mdx | 50 +++++++++++ .../docs/components/radix/hover-card.mdx | 10 +++ .../docs/components/radix/input-group.mdx | 12 +++ .../docs/components/radix/input-otp.mdx | 21 +++++ .../v4/content/docs/components/radix/item.mdx | 16 ++++ apps/v4/content/docs/components/radix/kbd.mdx | 11 +++ .../content/docs/components/radix/menubar.mdx | 40 +++++++++ .../docs/components/radix/native-select.mdx | 28 ++++++ .../docs/components/radix/navigation-menu.mdx | 17 ++++ .../docs/components/radix/pagination.mdx | 17 ++++ .../content/docs/components/radix/popover.mdx | 10 +++ .../docs/components/radix/radio-group.mdx | 10 +++ .../docs/components/radix/resizable.mdx | 11 +++ .../docs/components/radix/scroll-area.mdx | 9 ++ .../content/docs/components/radix/select.mdx | 20 +++++ .../content/docs/components/radix/sheet.mdx | 14 +++ .../content/docs/components/radix/sidebar.mdx | 87 +++++++++++++------ .../content/docs/components/radix/table.mdx | 27 ++++++ .../v4/content/docs/components/radix/tabs.mdx | 13 +++ .../docs/components/radix/toggle-group.mdx | 10 +++ .../content/docs/components/radix/tooltip.mdx | 10 +++ 78 files changed, 1534 insertions(+), 52 deletions(-) diff --git a/apps/v4/app/globals.css b/apps/v4/app/globals.css index 219e78ed5..7b2725aa4 100644 --- a/apps/v4/app/globals.css +++ b/apps/v4/app/globals.css @@ -337,6 +337,33 @@ display: inline-block; } + /* + * ```text composition trees use box-drawing characters; per-line padding makes + * vertical connectors look broken. rehype-pretty-code sets `data-language` on + * `pre`/`code` (not `language-*` classes). It also sets `code { display: grid }`, + * which can add visible row separation — reset to a normal pre stack for text. + */ + [data-rehype-pretty-code-figure] pre[data-language="text"] code, + [data-rehype-pretty-code-figure] pre[data-language="plaintext"] code, + [data-slot="docs"] pre[data-language="text"] code, + [data-slot="docs"] pre[data-language="plaintext"] code { + display: block !important; + white-space: pre; + } + + [data-rehype-pretty-code-figure] pre[data-language="text"] [data-line], + [data-rehype-pretty-code-figure] pre[data-language="plaintext"] [data-line], + [data-rehype-pretty-code-figure] code[data-language="text"] [data-line], + [data-rehype-pretty-code-figure] code[data-language="plaintext"] [data-line], + [data-slot="docs"] pre[data-language="text"] [data-line], + [data-slot="docs"] pre[data-language="plaintext"] [data-line] { + padding-top: 0; + padding-bottom: 0; + min-height: unset; + line-height: 1; + display: block; + } + [data-line] span { color: var(--shiki-light); diff --git a/apps/v4/content/docs/components/base/accordion.mdx b/apps/v4/content/docs/components/base/accordion.mdx index 900722e27..04f71c4f8 100644 --- a/apps/v4/content/docs/components/base/accordion.mdx +++ b/apps/v4/content/docs/components/base/accordion.mdx @@ -80,6 +80,20 @@ import { ``` +## Composition + +Use the following composition to build an `Accordion`: + +```text +Accordion +├── AccordionItem +│ ├── AccordionTrigger +│ └── AccordionContent +└── AccordionItem + ├── AccordionTrigger + └── AccordionContent +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/base/alert-dialog.mdx b/apps/v4/content/docs/components/base/alert-dialog.mdx index 1bdb39334..0095c52ac 100644 --- a/apps/v4/content/docs/components/base/alert-dialog.mdx +++ b/apps/v4/content/docs/components/base/alert-dialog.mdx @@ -94,6 +94,23 @@ import { ``` +## Composition + +Use the following composition to build an `AlertDialog`: + +```text +AlertDialog +├── AlertDialogTrigger +└── AlertDialogContent + ├── AlertDialogHeader + │ ├── AlertDialogMedia + │ ├── AlertDialogTitle + │ └── AlertDialogDescription + └── AlertDialogFooter + ├── AlertDialogCancel + └── AlertDialogAction +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/base/alert.mdx b/apps/v4/content/docs/components/base/alert.mdx index 924e6a6cc..2ada5e584 100644 --- a/apps/v4/content/docs/components/base/alert.mdx +++ b/apps/v4/content/docs/components/base/alert.mdx @@ -67,6 +67,18 @@ import { ``` +## Composition + +Use the following composition to build an `Alert`: + +```text +Alert +├── Icon +├── AlertTitle +├── AlertDescription +└── AlertAction +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/base/avatar.mdx b/apps/v4/content/docs/components/base/avatar.mdx index 7005036e9..5d52ebcd5 100644 --- a/apps/v4/content/docs/components/base/avatar.mdx +++ b/apps/v4/content/docs/components/base/avatar.mdx @@ -69,6 +69,32 @@ import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" ``` +## Composition + +Use the following composition to build an `Avatar`: + +```text +Avatar +├── AvatarImage +├── AvatarFallback +└── AvatarBadge +``` + +Use the following composition to build an `AvatarGroup`: + +```text +AvatarGroup +├── Avatar +│ ├── AvatarImage +│ ├── AvatarFallback +│ └── AvatarBadge +├── Avatar +│ ├── AvatarImage +│ ├── AvatarFallback +│ └── AvatarBadge +└── AvatarGroupCount +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/base/breadcrumb.mdx b/apps/v4/content/docs/components/base/breadcrumb.mdx index 2de58ab85..7b340c3f1 100644 --- a/apps/v4/content/docs/components/base/breadcrumb.mdx +++ b/apps/v4/content/docs/components/base/breadcrumb.mdx @@ -80,6 +80,23 @@ import { ``` +## Composition + +Use the following composition to build a `Breadcrumb`: + +```text +Breadcrumb +└── BreadcrumbList + ├── BreadcrumbItem + │ └── BreadcrumbLink + ├── BreadcrumbSeparator + ├── BreadcrumbItem + │ └── BreadcrumbLink + ├── BreadcrumbSeparator + └── BreadcrumbItem + └── BreadcrumbPage +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/base/button-group.mdx b/apps/v4/content/docs/components/base/button-group.mdx index aa2dfb98e..230528599 100644 --- a/apps/v4/content/docs/components/base/button-group.mdx +++ b/apps/v4/content/docs/components/base/button-group.mdx @@ -66,6 +66,17 @@ import { ``` +## Composition + +Use the following composition to build a `ButtonGroup`: + +```text +ButtonGroup +├── Button or Input +├── ButtonGroupSeparator +└── ButtonGroupText +``` + ## Accessibility - The `ButtonGroup` component has the `role` attribute set to `group`. diff --git a/apps/v4/content/docs/components/base/card.mdx b/apps/v4/content/docs/components/base/card.mdx index ef582164b..df4e53131 100644 --- a/apps/v4/content/docs/components/base/card.mdx +++ b/apps/v4/content/docs/components/base/card.mdx @@ -77,6 +77,20 @@ import { ``` +## Composition + +Use the following composition to build a `Card`: + +```text +Card +├── CardHeader +│ ├── CardTitle +│ ├── CardDescription +│ └── CardAction +├── CardContent +└── CardFooter +``` + ## Examples ### Size diff --git a/apps/v4/content/docs/components/base/carousel.mdx b/apps/v4/content/docs/components/base/carousel.mdx index a9a77c3b0..d45bc7346 100644 --- a/apps/v4/content/docs/components/base/carousel.mdx +++ b/apps/v4/content/docs/components/base/carousel.mdx @@ -85,6 +85,19 @@ import { ``` +## Composition + +Use the following composition to build a `Carousel`: + +```text +Carousel +├── CarouselContent +│ ├── CarouselItem +│ └── CarouselItem +├── CarouselPrevious +└── CarouselNext +``` + ## Examples ### Sizes diff --git a/apps/v4/content/docs/components/base/collapsible.mdx b/apps/v4/content/docs/components/base/collapsible.mdx index 649ff0933..290970989 100644 --- a/apps/v4/content/docs/components/base/collapsible.mdx +++ b/apps/v4/content/docs/components/base/collapsible.mdx @@ -73,6 +73,16 @@ import { ``` +## Composition + +Use the following composition to build a `Collapsible`: + +```text +Collapsible +├── CollapsibleTrigger +└── CollapsibleContent +``` + ## Controlled State Use the `open` and `onOpenChange` props to control the state. diff --git a/apps/v4/content/docs/components/base/combobox.mdx b/apps/v4/content/docs/components/base/combobox.mdx index 1371b2916..65dd991c5 100644 --- a/apps/v4/content/docs/components/base/combobox.mdx +++ b/apps/v4/content/docs/components/base/combobox.mdx @@ -90,6 +90,62 @@ export function ExampleCombobox() { } ``` +## Composition + +### Simple + +A single-line input and a flat list (see [Basic](#basic)). + +```text +Combobox +├── ComboboxInput +└── ComboboxContent + ├── ComboboxEmpty + └── ComboboxList + ├── ComboboxItem + └── ComboboxItem +``` + +### With chips + +Multi-select with `multiple`, chips, and a chips input (see [Multiple](#multiple)). + +```text +Combobox +├── ComboboxChips +│ ├── ComboboxValue +│ │ └── ComboboxChip +│ └── ComboboxChipsInput +└── ComboboxContent + ├── ComboboxEmpty + └── ComboboxList + ├── ComboboxItem + └── ComboboxItem +``` + +### With groups and collection + +Nested items per group using `ComboboxCollection` inside each `ComboboxGroup`, with a separator between groups (see [Groups](#groups)). + +```text +Combobox +├── ComboboxInput +└── ComboboxContent + ├── ComboboxEmpty + └── ComboboxList + ├── ComboboxGroup + │ ├── ComboboxLabel + │ └── ComboboxCollection + │ ├── ComboboxItem + │ └── ComboboxItem + ├── ComboboxSeparator + └── ComboboxGroup + ├── ComboboxLabel + └── ComboboxCollection + ├── ComboboxItem + └── ComboboxItem +``` + ## Custom Items Use `itemToStringValue` when your items are objects. diff --git a/apps/v4/content/docs/components/base/command.mdx b/apps/v4/content/docs/components/base/command.mdx index 17c7a06ec..98ddf15ba 100644 --- a/apps/v4/content/docs/components/base/command.mdx +++ b/apps/v4/content/docs/components/base/command.mdx @@ -96,6 +96,24 @@ import { ``` +## Composition + +Use the following composition to build a `Command`: + +```text +Command +├── CommandInput +└── CommandList + ├── CommandEmpty + ├── CommandGroup + │ ├── CommandItem + │ └── CommandItem + ├── CommandSeparator + └── CommandGroup + ├── CommandItem + └── CommandItem +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/base/context-menu.mdx b/apps/v4/content/docs/components/base/context-menu.mdx index e5176174f..1b32398fb 100644 --- a/apps/v4/content/docs/components/base/context-menu.mdx +++ b/apps/v4/content/docs/components/base/context-menu.mdx @@ -79,6 +79,37 @@ import { ``` +## Composition + +Use the following composition to build a `ContextMenu`: + +```text +ContextMenu +├── ContextMenuTrigger +└── ContextMenuContent + ├── ContextMenuGroup + │ ├── ContextMenuLabel + │ ├── ContextMenuItem + │ └── ContextMenuItem + ├── ContextMenuSeparator + ├── ContextMenuGroup + │ ├── ContextMenuLabel + │ ├── ContextMenuCheckboxItem + │ └── ContextMenuCheckboxItem + ├── ContextMenuSeparator + ├── ContextMenuGroup + │ ├── ContextMenuLabel + │ └── ContextMenuRadioGroup + │ ├── ContextMenuRadioItem + │ └── ContextMenuRadioItem + └── ContextMenuSub + ├── ContextMenuSubTrigger + └── ContextMenuSubContent + └── ContextMenuGroup + ├── ContextMenuItem + └── ContextMenuItem +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/base/date-picker.mdx b/apps/v4/content/docs/components/base/date-picker.mdx index 47aa77ca1..f93e89795 100644 --- a/apps/v4/content/docs/components/base/date-picker.mdx +++ b/apps/v4/content/docs/components/base/date-picker.mdx @@ -58,6 +58,17 @@ export function DatePickerDemo() { See the [React DayPicker](https://react-day-picker.js.org) documentation for more information. +## Composition + +A date picker is built from `Popover` and `Calendar` (there is no `DatePicker` root component): + +```text +Popover +├── PopoverTrigger +└── PopoverContent + └── Calendar +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/base/dialog.mdx b/apps/v4/content/docs/components/base/dialog.mdx index 427da7fc6..8ab859d4a 100644 --- a/apps/v4/content/docs/components/base/dialog.mdx +++ b/apps/v4/content/docs/components/base/dialog.mdx @@ -85,6 +85,20 @@ import { ``` +## Composition + +Use the following composition to build a `Dialog`: + +```text +Dialog +├── DialogTrigger +└── DialogContent + ├── DialogHeader + │ ├── DialogTitle + │ └── DialogDescription + └── DialogFooter +``` + ## Examples ### Custom Close Button diff --git a/apps/v4/content/docs/components/base/drawer.mdx b/apps/v4/content/docs/components/base/drawer.mdx index 762642e17..0b46bcbb0 100644 --- a/apps/v4/content/docs/components/base/drawer.mdx +++ b/apps/v4/content/docs/components/base/drawer.mdx @@ -88,6 +88,20 @@ import { ``` +## Composition + +Use the following composition to build a `Drawer`: + +```text +Drawer +├── DrawerTrigger +└── DrawerContent + ├── DrawerHeader + │ ├── DrawerTitle + │ └── DrawerDescription + └── DrawerFooter +``` + ## Examples ### Scrollable Content diff --git a/apps/v4/content/docs/components/base/dropdown-menu.mdx b/apps/v4/content/docs/components/base/dropdown-menu.mdx index 3913e0518..72756bcda 100644 --- a/apps/v4/content/docs/components/base/dropdown-menu.mdx +++ b/apps/v4/content/docs/components/base/dropdown-menu.mdx @@ -92,6 +92,38 @@ import { ``` +## Composition + +Use the following composition to build a `DropdownMenu`: + +```text +DropdownMenu +├── DropdownMenuTrigger +└── DropdownMenuContent + ├── DropdownMenuGroup + │ ├── DropdownMenuLabel + │ ├── DropdownMenuItem + │ └── DropdownMenuItem + ├── DropdownMenuSeparator + ├── DropdownMenuGroup + │ ├── DropdownMenuLabel + │ ├── DropdownMenuCheckboxItem + │ └── DropdownMenuCheckboxItem + ├── DropdownMenuSeparator + ├── DropdownMenuGroup + │ ├── DropdownMenuLabel + │ └── DropdownMenuRadioGroup + │ ├── DropdownMenuRadioItem + │ └── DropdownMenuRadioItem + └── DropdownMenuSub + ├── DropdownMenuSubTrigger + └── DropdownMenuSubContent + └── DropdownMenuGroup + ├── DropdownMenuLabel + ├── DropdownMenuItem + └── DropdownMenuItem +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/base/empty.mdx b/apps/v4/content/docs/components/base/empty.mdx index 2ecdfaf39..cbb63199e 100644 --- a/apps/v4/content/docs/components/base/empty.mdx +++ b/apps/v4/content/docs/components/base/empty.mdx @@ -75,6 +75,19 @@ import { ``` +## Composition + +Use the following composition to build an `Empty` state: + +```text +Empty +├── EmptyHeader +│ ├── EmptyMedia +│ ├── EmptyTitle +│ └── EmptyDescription +└── EmptyContent +``` + ## Examples ### Outline diff --git a/apps/v4/content/docs/components/base/field.mdx b/apps/v4/content/docs/components/base/field.mdx index d0116f04d..1f06ccda7 100644 --- a/apps/v4/content/docs/components/base/field.mdx +++ b/apps/v4/content/docs/components/base/field.mdx @@ -87,6 +87,56 @@ import { ``` +## Composition + +### Field + +A single control with label, helper text, and validation. + +```text +Field +├── FieldLabel +├── Input / Textarea / Switch / Select +├── FieldDescription +└── FieldError +``` + +### FieldGroup + +Related fields in one group. Use `FieldSeparator` between sections when needed. + +```text +FieldGroup +├── Field +│ ├── FieldLabel +│ ├── Input / Textarea / Switch / Select +│ ├── FieldDescription +│ └── FieldError +├── FieldSeparator +└── Field + ├── FieldLabel + └── Input / Textarea / Switch / Select +``` + +### FieldSet + +Semantic grouping with a legend and description, usually containing a `FieldGroup`. + +```text +FieldSet +├── FieldLegend +├── FieldDescription +└── FieldGroup + ├── Field + │ ├── FieldLabel + │ ├── Input / Textarea / Switch / Select + │ ├── FieldDescription + │ └── FieldError + └── Field + ├── FieldLabel + └── Input / Textarea / Switch / Select +``` + ## Anatomy The `Field` family is designed for composing accessible forms. A typical field is structured as follows: diff --git a/apps/v4/content/docs/components/base/hover-card.mdx b/apps/v4/content/docs/components/base/hover-card.mdx index 7705af75e..5be492c69 100644 --- a/apps/v4/content/docs/components/base/hover-card.mdx +++ b/apps/v4/content/docs/components/base/hover-card.mdx @@ -75,6 +75,16 @@ import { ``` +## Composition + +Use the following composition to build a `HoverCard`: + +```text +HoverCard +├── HoverCardTrigger +└── HoverCardContent +``` + ## Trigger Delays Use `delay` and `closeDelay` on the trigger to control when the card opens and diff --git a/apps/v4/content/docs/components/base/input-group.mdx b/apps/v4/content/docs/components/base/input-group.mdx index a781b50c4..a972738a9 100644 --- a/apps/v4/content/docs/components/base/input-group.mdx +++ b/apps/v4/content/docs/components/base/input-group.mdx @@ -71,6 +71,18 @@ import { ``` +## Composition + +Use the following composition to build an `InputGroup`: + +```text +InputGroup +├── InputGroupInput or InputGroupTextarea +├── InputGroupAddon +├── InputGroupButton +└── InputGroupText +``` + ## Align Use the `align` prop on `InputGroupAddon` to position the addon relative to the input. diff --git a/apps/v4/content/docs/components/base/input-otp.mdx b/apps/v4/content/docs/components/base/input-otp.mdx index 3b2344142..86c64ac88 100644 --- a/apps/v4/content/docs/components/base/input-otp.mdx +++ b/apps/v4/content/docs/components/base/input-otp.mdx @@ -82,6 +82,27 @@ import { ``` +## Composition + +Use the following composition to build an `InputOTP`: + +```text +InputOTP +├── InputOTPGroup +│ ├── InputOTPSlot +│ ├── InputOTPSlot +│ └── InputOTPSlot +├── InputOTPSeparator +├── InputOTPGroup +│ ├── InputOTPSlot +│ ├── InputOTPSlot +│ └── InputOTPSlot +├── InputOTPSeparator +└── InputOTPGroup + ├── InputOTPSlot + └── InputOTPSlot +``` + ## Pattern Use the `pattern` prop to define a custom pattern for the OTP input. diff --git a/apps/v4/content/docs/components/base/item.mdx b/apps/v4/content/docs/components/base/item.mdx index a9b17e50c..db68c469d 100644 --- a/apps/v4/content/docs/components/base/item.mdx +++ b/apps/v4/content/docs/components/base/item.mdx @@ -73,6 +73,22 @@ import { ``` +## Composition + +Use the following composition to build an `Item`: + +```text +ItemGroup +└── Item + ├── ItemHeader + ├── ItemMedia + ├── ItemContent + │ ├── ItemTitle + │ └── ItemDescription + ├── ItemActions + └── ItemFooter +``` + ## Item vs Field Use `Field` if you need to display a form input such as a checkbox, input, radio, or select. diff --git a/apps/v4/content/docs/components/base/kbd.mdx b/apps/v4/content/docs/components/base/kbd.mdx index ee52f6511..98e517ecd 100644 --- a/apps/v4/content/docs/components/base/kbd.mdx +++ b/apps/v4/content/docs/components/base/kbd.mdx @@ -53,6 +53,17 @@ import { Kbd } from "@/components/ui/kbd" Ctrl ``` +## Composition + +Use the following composition to build `Kbd` and `KbdGroup`: + +```text +Kbd +KbdGroup +├── Kbd +└── Kbd +``` + ## Examples ### Group diff --git a/apps/v4/content/docs/components/base/menubar.mdx b/apps/v4/content/docs/components/base/menubar.mdx index d81470267..709e0ce93 100644 --- a/apps/v4/content/docs/components/base/menubar.mdx +++ b/apps/v4/content/docs/components/base/menubar.mdx @@ -88,6 +88,46 @@ import { ``` +## Composition + +Use the following composition to build a `Menubar`: + +```text +Menubar +├── MenubarMenu +│ ├── MenubarTrigger +│ └── MenubarContent +│ ├── MenubarGroup +│ │ ├── MenubarLabel +│ │ ├── MenubarItem +│ │ └── MenubarItem +│ ├── MenubarSeparator +│ ├── MenubarGroup +│ │ ├── MenubarLabel +│ │ ├── MenubarCheckboxItem +│ │ └── MenubarCheckboxItem +│ ├── MenubarSeparator +│ ├── MenubarGroup +│ │ ├── MenubarLabel +│ │ └── MenubarRadioGroup +│ │ ├── MenubarRadioItem +│ │ └── MenubarRadioItem +│ └── MenubarSub +│ ├── MenubarSubTrigger +│ └── MenubarSubContent +│ └── MenubarGroup +│ ├── MenubarLabel +│ ├── MenubarItem +│ └── MenubarItem +└── MenubarMenu + ├── MenubarTrigger + └── MenubarContent + └── MenubarGroup + ├── MenubarLabel + ├── MenubarItem + └── MenubarItem +``` + ## Examples ### Checkbox diff --git a/apps/v4/content/docs/components/base/native-select.mdx b/apps/v4/content/docs/components/base/native-select.mdx index d644eebd8..5197d1a71 100644 --- a/apps/v4/content/docs/components/base/native-select.mdx +++ b/apps/v4/content/docs/components/base/native-select.mdx @@ -70,6 +70,34 @@ import { ``` +## Composition + +### Simple + +Options placed directly under `NativeSelect` (no `NativeSelectOptGroup`). + +```text +NativeSelect +├── NativeSelectOption +├── NativeSelectOption +├── NativeSelectOption +└── NativeSelectOption +``` + +### With groups + +Use `NativeSelectOptGroup` to organize options into categories. + +```text +NativeSelect +├── NativeSelectOptGroup +│ ├── NativeSelectOption +│ └── NativeSelectOption +└── NativeSelectOptGroup + ├── NativeSelectOption + └── NativeSelectOption +``` + ## Examples ### Groups diff --git a/apps/v4/content/docs/components/base/navigation-menu.mdx b/apps/v4/content/docs/components/base/navigation-menu.mdx index b998b1e29..f2a8f03d2 100644 --- a/apps/v4/content/docs/components/base/navigation-menu.mdx +++ b/apps/v4/content/docs/components/base/navigation-menu.mdx @@ -82,6 +82,23 @@ import { ``` +## Composition + +Use the following composition to build a `NavigationMenu`: + +```text +NavigationMenu +├── NavigationMenuList +│ ├── NavigationMenuItem +│ │ ├── NavigationMenuTrigger +│ │ └── NavigationMenuContent +│ │ ├── NavigationMenuLink +│ │ └── NavigationMenuLink +│ └── NavigationMenuItem +│ └── NavigationMenuLink +└── NavigationMenuIndicator +``` + ## Link Component Use the `render` prop to compose a custom link component such as Next.js `Link`. diff --git a/apps/v4/content/docs/components/base/pagination.mdx b/apps/v4/content/docs/components/base/pagination.mdx index 39a3aea64..dd3f01990 100644 --- a/apps/v4/content/docs/components/base/pagination.mdx +++ b/apps/v4/content/docs/components/base/pagination.mdx @@ -84,6 +84,23 @@ import { ``` +## Composition + +Use the following composition to build a `Pagination`: + +```text +Pagination +└── PaginationContent + ├── PaginationItem + │ └── PaginationPrevious + ├── PaginationItem + │ └── PaginationLink + ├── PaginationItem + │ └── PaginationEllipsis + └── PaginationItem + └── PaginationNext +``` + ## Examples ### Simple diff --git a/apps/v4/content/docs/components/base/popover.mdx b/apps/v4/content/docs/components/base/popover.mdx index c03e7805f..140950ffb 100644 --- a/apps/v4/content/docs/components/base/popover.mdx +++ b/apps/v4/content/docs/components/base/popover.mdx @@ -79,6 +79,16 @@ import { ``` +## Composition + +Use the following composition to build a `Popover`: + +```text +Popover +├── PopoverTrigger +└── PopoverContent +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/base/progress.mdx b/apps/v4/content/docs/components/base/progress.mdx index 4e683af40..b7cff3b7e 100644 --- a/apps/v4/content/docs/components/base/progress.mdx +++ b/apps/v4/content/docs/components/base/progress.mdx @@ -62,6 +62,33 @@ import { Progress } from "@/components/ui/progress" ``` +## Composition + +### With label and value + +Use `ProgressLabel` and `ProgressValue` to add a label and value display. + +```tsx showLineNumbers +import { + Progress, + ProgressLabel, + ProgressValue, +} from "@/components/ui/progress" + + + Upload progress + + +``` + +```text +Progress +├── ProgressLabel +├── ProgressValue +└── ProgressTrack + └── ProgressIndicator +``` + ## Examples ### Label diff --git a/apps/v4/content/docs/components/base/radio-group.mdx b/apps/v4/content/docs/components/base/radio-group.mdx index c45dada58..0a9f99caa 100644 --- a/apps/v4/content/docs/components/base/radio-group.mdx +++ b/apps/v4/content/docs/components/base/radio-group.mdx @@ -72,6 +72,16 @@ import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group" ``` +## Composition + +Use the following composition to build a `RadioGroup`: + +```text +RadioGroup +├── RadioGroupItem +└── RadioGroupItem +``` + ## Examples ### Description diff --git a/apps/v4/content/docs/components/base/resizable.mdx b/apps/v4/content/docs/components/base/resizable.mdx index 7c9065388..46b446a55 100644 --- a/apps/v4/content/docs/components/base/resizable.mdx +++ b/apps/v4/content/docs/components/base/resizable.mdx @@ -78,6 +78,17 @@ import { ``` +## Composition + +Use the following composition to build a `ResizablePanelGroup`: + +```text +ResizablePanelGroup +├── ResizablePanel +├── ResizableHandle +└── ResizablePanel +``` + ## Examples ### Vertical diff --git a/apps/v4/content/docs/components/base/scroll-area.mdx b/apps/v4/content/docs/components/base/scroll-area.mdx index 3d961ff9a..76db6ebca 100644 --- a/apps/v4/content/docs/components/base/scroll-area.mdx +++ b/apps/v4/content/docs/components/base/scroll-area.mdx @@ -68,6 +68,15 @@ import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area" ``` +## Composition + +Use the following composition to build a `ScrollArea`: + +```text +ScrollArea +└── ScrollBar +``` + ## Examples ### Horizontal diff --git a/apps/v4/content/docs/components/base/select.mdx b/apps/v4/content/docs/components/base/select.mdx index 53e0c848a..8d087179a 100644 --- a/apps/v4/content/docs/components/base/select.mdx +++ b/apps/v4/content/docs/components/base/select.mdx @@ -89,6 +89,26 @@ const items = [ ``` +## Composition + +Use the following composition to build a `Select`: + +```text +Select +├── SelectTrigger +│ └── SelectValue +└── SelectContent + ├── SelectGroup + │ ├── SelectLabel + │ ├── SelectItem + │ └── SelectItem + ├── SelectSeparator + └── SelectGroup + ├── SelectLabel + ├── SelectItem + └── SelectItem +``` + ## Examples ### Align Item With Trigger diff --git a/apps/v4/content/docs/components/base/sheet.mdx b/apps/v4/content/docs/components/base/sheet.mdx index 426063a58..e0fb7a09a 100644 --- a/apps/v4/content/docs/components/base/sheet.mdx +++ b/apps/v4/content/docs/components/base/sheet.mdx @@ -79,6 +79,20 @@ import { ``` +## Composition + +Use the following composition to build a `Sheet`: + +```text +Sheet +├── SheetTrigger +└── SheetContent + ├── SheetHeader + │ ├── SheetTitle + │ └── SheetDescription + └── SheetFooter +``` + ## Examples ### Side diff --git a/apps/v4/content/docs/components/base/sidebar.mdx b/apps/v4/content/docs/components/base/sidebar.mdx index f89a3479c..4c7e08706 100644 --- a/apps/v4/content/docs/components/base/sidebar.mdx +++ b/apps/v4/content/docs/components/base/sidebar.mdx @@ -55,32 +55,6 @@ npx shadcn@latest add sidebar -## Structure - -A `Sidebar` component is composed of the following parts: - -- `SidebarProvider` - Handles collapsible state. -- `Sidebar` - The sidebar container. -- `SidebarHeader` and `SidebarFooter` - Sticky at the top and bottom of the sidebar. -- `SidebarContent` - Scrollable content. -- `SidebarGroup` - Section within the `SidebarContent`. -- `SidebarTrigger` - Trigger for the `Sidebar`. - -Sidebar Structure -Sidebar Structure - ## Usage ```tsx showLineNumbers title="app/layout.tsx" @@ -123,6 +97,67 @@ export function AppSidebar() { } ``` +## Composition + +Use the following composition to build a `Sidebar` layout: + +```text +SidebarProvider +├── Sidebar +│ ├── SidebarHeader +│ ├── SidebarContent +│ │ ├── SidebarGroup +│ │ │ ├── SidebarGroupLabel +│ │ │ ├── SidebarGroupAction +│ │ │ ├── SidebarGroupContent +│ │ │ └── SidebarMenu +│ │ │ ├── SidebarMenuItem +│ │ │ │ ├── SidebarMenuButton +│ │ │ │ ├── SidebarMenuAction +│ │ │ │ └── SidebarMenuBadge +│ │ │ └── SidebarMenuItem +│ │ │ ├── SidebarMenuButton +│ │ │ └── SidebarMenuSub +│ │ │ ├── SidebarMenuSubItem +│ │ │ └── SidebarMenuSubItem +│ │ └── SidebarGroup +│ │ └── SidebarMenu +│ │ ├── SidebarMenuItem +│ │ └── SidebarMenuItem +│ ├── SidebarFooter +│ └── SidebarRail +├── SidebarInset +└── SidebarTrigger +``` + +## Structure + +- **SidebarProvider** — Handles collapsible state and provides sidebar context to child components. +- **Sidebar** — The main collapsible sidebar panel. +- **SidebarHeader** — Sticky at the top; use for branding, titles, or workspace switchers. +- **SidebarFooter** — Sticky at the bottom; use for user menus, settings, or actions. +- **SidebarContent** — Scrollable region between the header and footer. +- **SidebarGroup** — Groups related navigation with optional label, action, and content areas. +- **SidebarMenu** / **SidebarMenuItem** — Menu structure for links, badges, actions, and nested submenus. +- **SidebarRail** — Resize handle for adjusting sidebar width when applicable. +- **SidebarInset** — Wraps main content when using the `inset` variant. +- **SidebarTrigger** — Control that toggles the sidebar open or collapsed. + +Sidebar Structure +Sidebar Structure + ## SidebarProvider The `SidebarProvider` component is used to provide the sidebar context to the `Sidebar` component. You should always wrap your application in a `SidebarProvider` component. diff --git a/apps/v4/content/docs/components/base/table.mdx b/apps/v4/content/docs/components/base/table.mdx index dea24857e..ea8ae5d32 100644 --- a/apps/v4/content/docs/components/base/table.mdx +++ b/apps/v4/content/docs/components/base/table.mdx @@ -83,6 +83,33 @@ import { ``` +## Composition + +Use the following composition to build a `Table`: + +```text +Table +├── TableCaption +├── TableHeader +│ └── TableRow +│ ├── TableHead +│ ├── TableHead +│ ├── TableHead +│ └── TableHead +├── TableBody +│ ├── TableRow +│ │ ├── TableCell +│ │ ├── TableCell +│ │ ├── TableCell +│ │ └── TableCell +│ └── TableRow +│ ├── TableCell +│ ├── TableCell +│ ├── TableCell +│ └── TableCell +└── TableFooter +``` + ## Examples ### Footer diff --git a/apps/v4/content/docs/components/base/tabs.mdx b/apps/v4/content/docs/components/base/tabs.mdx index b3c42a4ec..cef05662f 100644 --- a/apps/v4/content/docs/components/base/tabs.mdx +++ b/apps/v4/content/docs/components/base/tabs.mdx @@ -73,6 +73,19 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" ``` +## Composition + +Use the following composition to build `Tabs`: + +```text +Tabs +├── TabsList +│ ├── TabsTrigger +│ └── TabsTrigger +├── TabsContent +└── TabsContent +``` + ## Examples ### Line diff --git a/apps/v4/content/docs/components/base/toggle-group.mdx b/apps/v4/content/docs/components/base/toggle-group.mdx index 17ed5aebb..1e232f5c4 100644 --- a/apps/v4/content/docs/components/base/toggle-group.mdx +++ b/apps/v4/content/docs/components/base/toggle-group.mdx @@ -66,6 +66,16 @@ import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group" ``` +## Composition + +Use the following composition to build a `ToggleGroup`: + +```text +ToggleGroup +├── ToggleGroupItem +└── ToggleGroupItem +``` + ## Examples ### Outline diff --git a/apps/v4/content/docs/components/base/tooltip.mdx b/apps/v4/content/docs/components/base/tooltip.mdx index 8d1ff4f56..365dec685 100644 --- a/apps/v4/content/docs/components/base/tooltip.mdx +++ b/apps/v4/content/docs/components/base/tooltip.mdx @@ -109,6 +109,16 @@ import { ``` +## Composition + +Use the following composition to build a `Tooltip`: + +```text +Tooltip +├── TooltipTrigger +└── TooltipContent +``` + ## Examples ### Side diff --git a/apps/v4/content/docs/components/radix/accordion.mdx b/apps/v4/content/docs/components/radix/accordion.mdx index 72d0b6fc3..9d43fc37f 100644 --- a/apps/v4/content/docs/components/radix/accordion.mdx +++ b/apps/v4/content/docs/components/radix/accordion.mdx @@ -80,6 +80,20 @@ import { ``` +## Composition + +Use the following composition to build an `Accordion`: + +```text +Accordion +├── AccordionItem +│ ├── AccordionTrigger +│ └── AccordionContent +└── AccordionItem + ├── AccordionTrigger + └── AccordionContent +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/radix/alert-dialog.mdx b/apps/v4/content/docs/components/radix/alert-dialog.mdx index 425aa9493..38c9c130e 100644 --- a/apps/v4/content/docs/components/radix/alert-dialog.mdx +++ b/apps/v4/content/docs/components/radix/alert-dialog.mdx @@ -94,6 +94,23 @@ import { ``` +## Composition + +Use the following composition to build an `AlertDialog`: + +```text +AlertDialog +├── AlertDialogTrigger +└── AlertDialogContent + ├── AlertDialogHeader + │ ├── AlertDialogMedia + │ ├── AlertDialogTitle + │ └── AlertDialogDescription + └── AlertDialogFooter + ├── AlertDialogCancel + └── AlertDialogAction +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/radix/alert.mdx b/apps/v4/content/docs/components/radix/alert.mdx index 3c65fdbd9..84ea308db 100644 --- a/apps/v4/content/docs/components/radix/alert.mdx +++ b/apps/v4/content/docs/components/radix/alert.mdx @@ -71,6 +71,18 @@ import { ``` +## Composition + +Use the following composition to build an `Alert`: + +```text +Alert +├── Icon +├── AlertTitle +├── AlertDescription +└── AlertAction +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/radix/avatar.mdx b/apps/v4/content/docs/components/radix/avatar.mdx index ef8652b19..ac77ec847 100644 --- a/apps/v4/content/docs/components/radix/avatar.mdx +++ b/apps/v4/content/docs/components/radix/avatar.mdx @@ -65,6 +65,32 @@ import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" ``` +## Composition + +Use the following composition to build an `Avatar`: + +```text +Avatar +├── AvatarImage +├── AvatarFallback +└── AvatarBadge +``` + +Use the following composition to build an `AvatarGroup`: + +```text +AvatarGroup +├── Avatar +│ ├── AvatarImage +│ ├── AvatarFallback +│ └── AvatarBadge +├── Avatar +│ ├── AvatarImage +│ ├── AvatarFallback +│ └── AvatarBadge +└── AvatarGroupCount +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/radix/breadcrumb.mdx b/apps/v4/content/docs/components/radix/breadcrumb.mdx index 114c2aaf4..a252ecb96 100644 --- a/apps/v4/content/docs/components/radix/breadcrumb.mdx +++ b/apps/v4/content/docs/components/radix/breadcrumb.mdx @@ -74,6 +74,23 @@ import { ``` +## Composition + +Use the following composition to build a `Breadcrumb`: + +```text +Breadcrumb +└── BreadcrumbList + ├── BreadcrumbItem + │ └── BreadcrumbLink + ├── BreadcrumbSeparator + ├── BreadcrumbItem + │ └── BreadcrumbLink + ├── BreadcrumbSeparator + └── BreadcrumbItem + └── BreadcrumbPage +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/radix/button-group.mdx b/apps/v4/content/docs/components/radix/button-group.mdx index a6d009137..35ede376c 100644 --- a/apps/v4/content/docs/components/radix/button-group.mdx +++ b/apps/v4/content/docs/components/radix/button-group.mdx @@ -66,6 +66,17 @@ import { ``` +## Composition + +Use the following composition to build a `ButtonGroup`: + +```text +ButtonGroup +├── Button or Input +├── ButtonGroupSeparator +└── ButtonGroupText +``` + ## Accessibility - The `ButtonGroup` component has the `role` attribute set to `group`. diff --git a/apps/v4/content/docs/components/radix/card.mdx b/apps/v4/content/docs/components/radix/card.mdx index 865694d6f..79d3e5f51 100644 --- a/apps/v4/content/docs/components/radix/card.mdx +++ b/apps/v4/content/docs/components/radix/card.mdx @@ -77,6 +77,20 @@ import { ``` +## Composition + +Use the following composition to build a `Card`: + +```text +Card +├── CardHeader +│ ├── CardTitle +│ ├── CardDescription +│ └── CardAction +├── CardContent +└── CardFooter +``` + ## Examples ### Size diff --git a/apps/v4/content/docs/components/radix/carousel.mdx b/apps/v4/content/docs/components/radix/carousel.mdx index 85aaf522a..c622b25ac 100644 --- a/apps/v4/content/docs/components/radix/carousel.mdx +++ b/apps/v4/content/docs/components/radix/carousel.mdx @@ -85,6 +85,19 @@ import { ``` +## Composition + +Use the following composition to build a `Carousel`: + +```text +Carousel +├── CarouselContent +│ ├── CarouselItem +│ └── CarouselItem +├── CarouselPrevious +└── CarouselNext +``` + ## Examples ### Sizes diff --git a/apps/v4/content/docs/components/radix/collapsible.mdx b/apps/v4/content/docs/components/radix/collapsible.mdx index 2571e312c..0aeb9646f 100644 --- a/apps/v4/content/docs/components/radix/collapsible.mdx +++ b/apps/v4/content/docs/components/radix/collapsible.mdx @@ -77,6 +77,16 @@ import { ``` +## Composition + +Use the following composition to build a `Collapsible`: + +```text +Collapsible +├── CollapsibleTrigger +└── CollapsibleContent +``` + ## Controlled State Use the `open` and `onOpenChange` props to control the state. diff --git a/apps/v4/content/docs/components/radix/combobox.mdx b/apps/v4/content/docs/components/radix/combobox.mdx index 6170162a2..6ef706e6d 100644 --- a/apps/v4/content/docs/components/radix/combobox.mdx +++ b/apps/v4/content/docs/components/radix/combobox.mdx @@ -90,6 +90,62 @@ export function ExampleCombobox() { } ``` +## Composition + +### Simple + +A single-line input and a flat list (see [Basic](#basic)). + +```text +Combobox +├── ComboboxInput +└── ComboboxContent + ├── ComboboxEmpty + └── ComboboxList + ├── ComboboxItem + └── ComboboxItem +``` + +### With chips + +Multi-select with `multiple`, chips, and a chips input (see [Multiple](#multiple)). + +```text +Combobox +├── ComboboxChips +│ ├── ComboboxValue +│ │ └── ComboboxChip +│ └── ComboboxChipsInput +└── ComboboxContent + ├── ComboboxEmpty + └── ComboboxList + ├── ComboboxItem + └── ComboboxItem +``` + +### With groups and collection + +Nested items per group using `ComboboxCollection` inside each `ComboboxGroup`, with a separator between groups (see [Groups](#groups)). + +```text +Combobox +├── ComboboxInput +└── ComboboxContent + ├── ComboboxEmpty + └── ComboboxList + ├── ComboboxGroup + │ ├── ComboboxLabel + │ └── ComboboxCollection + │ ├── ComboboxItem + │ └── ComboboxItem + ├── ComboboxSeparator + └── ComboboxGroup + ├── ComboboxLabel + └── ComboboxCollection + ├── ComboboxItem + └── ComboboxItem +``` + ## Custom Items Use `itemToStringValue` when your items are objects. diff --git a/apps/v4/content/docs/components/radix/command.mdx b/apps/v4/content/docs/components/radix/command.mdx index 3f1e46eb6..d465e906c 100644 --- a/apps/v4/content/docs/components/radix/command.mdx +++ b/apps/v4/content/docs/components/radix/command.mdx @@ -96,6 +96,24 @@ import { ``` +## Composition + +Use the following composition to build a `Command`: + +```text +Command +├── CommandInput +└── CommandList + ├── CommandEmpty + ├── CommandGroup + │ ├── CommandItem + │ └── CommandItem + ├── CommandSeparator + └── CommandGroup + ├── CommandItem + └── CommandItem +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/radix/context-menu.mdx b/apps/v4/content/docs/components/radix/context-menu.mdx index 3022d286f..e41b495f0 100644 --- a/apps/v4/content/docs/components/radix/context-menu.mdx +++ b/apps/v4/content/docs/components/radix/context-menu.mdx @@ -79,6 +79,37 @@ import { ``` +## Composition + +Use the following composition to build a `ContextMenu`: + +```text +ContextMenu +├── ContextMenuTrigger +└── ContextMenuContent + ├── ContextMenuGroup + │ ├── ContextMenuLabel + │ ├── ContextMenuItem + │ └── ContextMenuItem + ├── ContextMenuSeparator + ├── ContextMenuGroup + │ ├── ContextMenuLabel + │ ├── ContextMenuCheckboxItem + │ └── ContextMenuCheckboxItem + ├── ContextMenuSeparator + ├── ContextMenuGroup + │ ├── ContextMenuLabel + │ └── ContextMenuRadioGroup + │ ├── ContextMenuRadioItem + │ └── ContextMenuRadioItem + └── ContextMenuSub + ├── ContextMenuSubTrigger + └── ContextMenuSubContent + └── ContextMenuGroup + ├── ContextMenuItem + └── ContextMenuItem +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/radix/date-picker.mdx b/apps/v4/content/docs/components/radix/date-picker.mdx index 20ac0cc5f..380ec99e2 100644 --- a/apps/v4/content/docs/components/radix/date-picker.mdx +++ b/apps/v4/content/docs/components/radix/date-picker.mdx @@ -56,6 +56,17 @@ export function DatePickerDemo() { See the [React DayPicker](https://react-day-picker.js.org) documentation for more information. +## Composition + +A date picker is built from `Popover` and `Calendar` (there is no `DatePicker` root component): + +```text +Popover +├── PopoverTrigger +└── PopoverContent + └── Calendar +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/radix/dialog.mdx b/apps/v4/content/docs/components/radix/dialog.mdx index 032834b76..e9fcc2532 100644 --- a/apps/v4/content/docs/components/radix/dialog.mdx +++ b/apps/v4/content/docs/components/radix/dialog.mdx @@ -85,6 +85,20 @@ import { ``` +## Composition + +Use the following composition to build a `Dialog`: + +```text +Dialog +├── DialogTrigger +└── DialogContent + ├── DialogHeader + │ ├── DialogTitle + │ └── DialogDescription + └── DialogFooter +``` + ## Examples ### Custom Close Button diff --git a/apps/v4/content/docs/components/radix/drawer.mdx b/apps/v4/content/docs/components/radix/drawer.mdx index 3f50d10f1..b70f39079 100644 --- a/apps/v4/content/docs/components/radix/drawer.mdx +++ b/apps/v4/content/docs/components/radix/drawer.mdx @@ -88,6 +88,20 @@ import { ``` +## Composition + +Use the following composition to build a `Drawer`: + +```text +Drawer +├── DrawerTrigger +└── DrawerContent + ├── DrawerHeader + │ ├── DrawerTitle + │ └── DrawerDescription + └── DrawerFooter +``` + ## Examples ### Scrollable Content diff --git a/apps/v4/content/docs/components/radix/dropdown-menu.mdx b/apps/v4/content/docs/components/radix/dropdown-menu.mdx index 44e0d2cf7..693f6cdb7 100644 --- a/apps/v4/content/docs/components/radix/dropdown-menu.mdx +++ b/apps/v4/content/docs/components/radix/dropdown-menu.mdx @@ -92,6 +92,38 @@ import { ``` +## Composition + +Use the following composition to build a `DropdownMenu`: + +```text +DropdownMenu +├── DropdownMenuTrigger +└── DropdownMenuContent + ├── DropdownMenuGroup + │ ├── DropdownMenuLabel + │ ├── DropdownMenuItem + │ └── DropdownMenuItem + ├── DropdownMenuSeparator + ├── DropdownMenuGroup + │ ├── DropdownMenuLabel + │ ├── DropdownMenuCheckboxItem + │ └── DropdownMenuCheckboxItem + ├── DropdownMenuSeparator + ├── DropdownMenuGroup + │ ├── DropdownMenuLabel + │ └── DropdownMenuRadioGroup + │ ├── DropdownMenuRadioItem + │ └── DropdownMenuRadioItem + └── DropdownMenuSub + ├── DropdownMenuSubTrigger + └── DropdownMenuSubContent + └── DropdownMenuGroup + ├── DropdownMenuLabel + ├── DropdownMenuItem + └── DropdownMenuItem +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/radix/empty.mdx b/apps/v4/content/docs/components/radix/empty.mdx index 89a01bb5f..b509ccec6 100644 --- a/apps/v4/content/docs/components/radix/empty.mdx +++ b/apps/v4/content/docs/components/radix/empty.mdx @@ -75,6 +75,19 @@ import { ``` +## Composition + +Use the following composition to build an `Empty` state: + +```text +Empty +├── EmptyHeader +│ ├── EmptyMedia +│ ├── EmptyTitle +│ └── EmptyDescription +└── EmptyContent +``` + ## Examples ### Outline diff --git a/apps/v4/content/docs/components/radix/field.mdx b/apps/v4/content/docs/components/radix/field.mdx index 856c8eeb6..8671533e6 100644 --- a/apps/v4/content/docs/components/radix/field.mdx +++ b/apps/v4/content/docs/components/radix/field.mdx @@ -87,6 +87,56 @@ import { ``` +## Composition + +### Field + +A single control with label, helper text, and validation. + +```text +Field +├── FieldLabel +├── Input / Textarea / Switch / Select +├── FieldDescription +└── FieldError +``` + +### FieldGroup + +Related fields in one group. Use `FieldSeparator` between sections when needed. + +```text +FieldGroup +├── Field +│ ├── FieldLabel +│ ├── Input / Textarea / Switch / Select +│ ├── FieldDescription +│ └── FieldError +├── FieldSeparator +└── Field + ├── FieldLabel + └── Input / Textarea / Switch / Select +``` + +### FieldSet + +Semantic grouping with a legend and description, usually containing a `FieldGroup`. + +```text +FieldSet +├── FieldLegend +├── FieldDescription +└── FieldGroup + ├── Field + │ ├── FieldLabel + │ ├── Input / Textarea / Switch / Select + │ ├── FieldDescription + │ └── FieldError + └── Field + ├── FieldLabel + └── Input / Textarea / Switch / Select +``` + ## Anatomy The `Field` family is designed for composing accessible forms. A typical field is structured as follows: diff --git a/apps/v4/content/docs/components/radix/hover-card.mdx b/apps/v4/content/docs/components/radix/hover-card.mdx index fe8e4f7ba..6104265c0 100644 --- a/apps/v4/content/docs/components/radix/hover-card.mdx +++ b/apps/v4/content/docs/components/radix/hover-card.mdx @@ -75,6 +75,16 @@ import { ``` +## Composition + +Use the following composition to build a `HoverCard`: + +```text +HoverCard +├── HoverCardTrigger +└── HoverCardContent +``` + ## Trigger Delays Use `openDelay` and `closeDelay` on the `HoverCard` to control when the card opens and diff --git a/apps/v4/content/docs/components/radix/input-group.mdx b/apps/v4/content/docs/components/radix/input-group.mdx index 1b27dffbd..cdf820763 100644 --- a/apps/v4/content/docs/components/radix/input-group.mdx +++ b/apps/v4/content/docs/components/radix/input-group.mdx @@ -71,6 +71,18 @@ import { ``` +## Composition + +Use the following composition to build an `InputGroup`: + +```text +InputGroup +├── InputGroupInput or InputGroupTextarea +├── InputGroupAddon +├── InputGroupButton +└── InputGroupText +``` + ## Align Use the `align` prop on `InputGroupAddon` to position the addon relative to the input. diff --git a/apps/v4/content/docs/components/radix/input-otp.mdx b/apps/v4/content/docs/components/radix/input-otp.mdx index ef25bb6a8..792f051c6 100644 --- a/apps/v4/content/docs/components/radix/input-otp.mdx +++ b/apps/v4/content/docs/components/radix/input-otp.mdx @@ -82,6 +82,27 @@ import { ``` +## Composition + +Use the following composition to build an `InputOTP`: + +```text +InputOTP +├── InputOTPGroup +│ ├── InputOTPSlot +│ ├── InputOTPSlot +│ └── InputOTPSlot +├── InputOTPSeparator +├── InputOTPGroup +│ ├── InputOTPSlot +│ ├── InputOTPSlot +│ └── InputOTPSlot +├── InputOTPSeparator +└── InputOTPGroup + ├── InputOTPSlot + └── InputOTPSlot +``` + ## Pattern Use the `pattern` prop to define a custom pattern for the OTP input. diff --git a/apps/v4/content/docs/components/radix/item.mdx b/apps/v4/content/docs/components/radix/item.mdx index f0d8939ab..9765d2836 100644 --- a/apps/v4/content/docs/components/radix/item.mdx +++ b/apps/v4/content/docs/components/radix/item.mdx @@ -73,6 +73,22 @@ import { ``` +## Composition + +Use the following composition to build an `Item`: + +```text +ItemGroup +└── Item + ├── ItemHeader + ├── ItemMedia + ├── ItemContent + │ ├── ItemTitle + │ └── ItemDescription + ├── ItemActions + └── ItemFooter +``` + ## Item vs Field Use `Field` if you need to display a form input such as a checkbox, input, radio, or select. diff --git a/apps/v4/content/docs/components/radix/kbd.mdx b/apps/v4/content/docs/components/radix/kbd.mdx index a4a408a39..4423b4d88 100644 --- a/apps/v4/content/docs/components/radix/kbd.mdx +++ b/apps/v4/content/docs/components/radix/kbd.mdx @@ -53,6 +53,17 @@ import { Kbd } from "@/components/ui/kbd" Ctrl ``` +## Composition + +Use the following composition to build `Kbd` and `KbdGroup`: + +```text +Kbd +KbdGroup +├── Kbd +└── Kbd +``` + ## Examples ### Group diff --git a/apps/v4/content/docs/components/radix/menubar.mdx b/apps/v4/content/docs/components/radix/menubar.mdx index e6f34b3e9..ed42aeed4 100644 --- a/apps/v4/content/docs/components/radix/menubar.mdx +++ b/apps/v4/content/docs/components/radix/menubar.mdx @@ -88,6 +88,46 @@ import { ``` +## Composition + +Use the following composition to build a `Menubar`: + +```text +Menubar +├── MenubarMenu +│ ├── MenubarTrigger +│ └── MenubarContent +│ ├── MenubarGroup +│ │ ├── MenubarLabel +│ │ ├── MenubarItem +│ │ └── MenubarItem +│ ├── MenubarSeparator +│ ├── MenubarGroup +│ │ ├── MenubarLabel +│ │ ├── MenubarCheckboxItem +│ │ └── MenubarCheckboxItem +│ ├── MenubarSeparator +│ ├── MenubarGroup +│ │ ├── MenubarLabel +│ │ └── MenubarRadioGroup +│ │ ├── MenubarRadioItem +│ │ └── MenubarRadioItem +│ └── MenubarSub +│ ├── MenubarSubTrigger +│ └── MenubarSubContent +│ └── MenubarGroup +│ ├── MenubarLabel +│ ├── MenubarItem +│ └── MenubarItem +└── MenubarMenu + ├── MenubarTrigger + └── MenubarContent + └── MenubarGroup + ├── MenubarLabel + ├── MenubarItem + └── MenubarItem +``` + ## Examples ### Checkbox diff --git a/apps/v4/content/docs/components/radix/native-select.mdx b/apps/v4/content/docs/components/radix/native-select.mdx index 3b16d3e7d..0e257afc8 100644 --- a/apps/v4/content/docs/components/radix/native-select.mdx +++ b/apps/v4/content/docs/components/radix/native-select.mdx @@ -70,6 +70,34 @@ import { ``` +## Composition + +### Simple + +Options placed directly under `NativeSelect` (no `NativeSelectOptGroup`). + +```text +NativeSelect +├── NativeSelectOption +├── NativeSelectOption +├── NativeSelectOption +└── NativeSelectOption +``` + +### With groups + +Use `NativeSelectOptGroup` to organize options into categories. + +```text +NativeSelect +├── NativeSelectOptGroup +│ ├── NativeSelectOption +│ └── NativeSelectOption +└── NativeSelectOptGroup + ├── NativeSelectOption + └── NativeSelectOption +``` + ## Examples ### Groups diff --git a/apps/v4/content/docs/components/radix/navigation-menu.mdx b/apps/v4/content/docs/components/radix/navigation-menu.mdx index 455b21f3f..90ab6c36a 100644 --- a/apps/v4/content/docs/components/radix/navigation-menu.mdx +++ b/apps/v4/content/docs/components/radix/navigation-menu.mdx @@ -82,6 +82,23 @@ import { ``` +## Composition + +Use the following composition to build a `NavigationMenu`: + +```text +NavigationMenu +├── NavigationMenuList +│ ├── NavigationMenuItem +│ │ ├── NavigationMenuTrigger +│ │ └── NavigationMenuContent +│ │ ├── NavigationMenuLink +│ │ └── NavigationMenuLink +│ └── NavigationMenuItem +│ └── NavigationMenuLink +└── NavigationMenuIndicator +``` + ## Link Component Use the `asChild` prop to compose a custom link component such as Next.js `Link`. diff --git a/apps/v4/content/docs/components/radix/pagination.mdx b/apps/v4/content/docs/components/radix/pagination.mdx index e109d411e..0c29a4f30 100644 --- a/apps/v4/content/docs/components/radix/pagination.mdx +++ b/apps/v4/content/docs/components/radix/pagination.mdx @@ -84,6 +84,23 @@ import { ``` +## Composition + +Use the following composition to build a `Pagination`: + +```text +Pagination +└── PaginationContent + ├── PaginationItem + │ └── PaginationPrevious + ├── PaginationItem + │ └── PaginationLink + ├── PaginationItem + │ └── PaginationEllipsis + └── PaginationItem + └── PaginationNext +``` + ## Examples ### Simple diff --git a/apps/v4/content/docs/components/radix/popover.mdx b/apps/v4/content/docs/components/radix/popover.mdx index 7636e1a79..ce72a8b22 100644 --- a/apps/v4/content/docs/components/radix/popover.mdx +++ b/apps/v4/content/docs/components/radix/popover.mdx @@ -79,6 +79,16 @@ import { ``` +## Composition + +Use the following composition to build a `Popover`: + +```text +Popover +├── PopoverTrigger +└── PopoverContent +``` + ## Examples ### Basic diff --git a/apps/v4/content/docs/components/radix/radio-group.mdx b/apps/v4/content/docs/components/radix/radio-group.mdx index 154a1eb4d..64e5f7f0c 100644 --- a/apps/v4/content/docs/components/radix/radio-group.mdx +++ b/apps/v4/content/docs/components/radix/radio-group.mdx @@ -72,6 +72,16 @@ import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group" ``` +## Composition + +Use the following composition to build a `RadioGroup`: + +```text +RadioGroup +├── RadioGroupItem +└── RadioGroupItem +``` + ## Examples ### Description diff --git a/apps/v4/content/docs/components/radix/resizable.mdx b/apps/v4/content/docs/components/radix/resizable.mdx index 78ffa0978..ecb33dc3d 100644 --- a/apps/v4/content/docs/components/radix/resizable.mdx +++ b/apps/v4/content/docs/components/radix/resizable.mdx @@ -78,6 +78,17 @@ import { ``` +## Composition + +Use the following composition to build a `ResizablePanelGroup`: + +```text +ResizablePanelGroup +├── ResizablePanel +├── ResizableHandle +└── ResizablePanel +``` + ## Examples ### Vertical diff --git a/apps/v4/content/docs/components/radix/scroll-area.mdx b/apps/v4/content/docs/components/radix/scroll-area.mdx index 93be2c044..f97517170 100644 --- a/apps/v4/content/docs/components/radix/scroll-area.mdx +++ b/apps/v4/content/docs/components/radix/scroll-area.mdx @@ -68,6 +68,15 @@ import { ScrollArea, ScrollBar } from "@/components/ui/scroll-area" ``` +## Composition + +Use the following composition to build a `ScrollArea`: + +```text +ScrollArea +└── ScrollBar +``` + ## Examples ### Horizontal diff --git a/apps/v4/content/docs/components/radix/select.mdx b/apps/v4/content/docs/components/radix/select.mdx index 073faf5b3..ec80a0f5d 100644 --- a/apps/v4/content/docs/components/radix/select.mdx +++ b/apps/v4/content/docs/components/radix/select.mdx @@ -81,6 +81,26 @@ import { ``` +## Composition + +Use the following composition to build a `Select`: + +```text +Select +├── SelectTrigger +│ └── SelectValue +└── SelectContent + ├── SelectGroup + │ ├── SelectLabel + │ ├── SelectItem + │ └── SelectItem + ├── SelectSeparator + └── SelectGroup + ├── SelectLabel + ├── SelectItem + └── SelectItem +``` + ## Examples ### Align Item With Trigger diff --git a/apps/v4/content/docs/components/radix/sheet.mdx b/apps/v4/content/docs/components/radix/sheet.mdx index 6ae74c649..590099b1e 100644 --- a/apps/v4/content/docs/components/radix/sheet.mdx +++ b/apps/v4/content/docs/components/radix/sheet.mdx @@ -79,6 +79,20 @@ import { ``` +## Composition + +Use the following composition to build a `Sheet`: + +```text +Sheet +├── SheetTrigger +└── SheetContent + ├── SheetHeader + │ ├── SheetTitle + │ └── SheetDescription + └── SheetFooter +``` + ## Examples ### Side diff --git a/apps/v4/content/docs/components/radix/sidebar.mdx b/apps/v4/content/docs/components/radix/sidebar.mdx index 9f5eef773..3676a84c1 100644 --- a/apps/v4/content/docs/components/radix/sidebar.mdx +++ b/apps/v4/content/docs/components/radix/sidebar.mdx @@ -55,32 +55,6 @@ npx shadcn@latest add sidebar -## Structure - -A `Sidebar` component is composed of the following parts: - -- `SidebarProvider` - Handles collapsible state. -- `Sidebar` - The sidebar container. -- `SidebarHeader` and `SidebarFooter` - Sticky at the top and bottom of the sidebar. -- `SidebarContent` - Scrollable content. -- `SidebarGroup` - Section within the `SidebarContent`. -- `SidebarTrigger` - Trigger for the `Sidebar`. - -Sidebar Structure -Sidebar Structure - ## Usage ```tsx showLineNumbers title="app/layout.tsx" @@ -123,6 +97,67 @@ export function AppSidebar() { } ``` +## Composition + +Use the following composition to build a `Sidebar` layout: + +```text +SidebarProvider +├── Sidebar +│ ├── SidebarHeader +│ ├── SidebarContent +│ │ ├── SidebarGroup +│ │ │ ├── SidebarGroupLabel +│ │ │ ├── SidebarGroupAction +│ │ │ ├── SidebarGroupContent +│ │ │ └── SidebarMenu +│ │ │ ├── SidebarMenuItem +│ │ │ │ ├── SidebarMenuButton +│ │ │ │ ├── SidebarMenuAction +│ │ │ │ └── SidebarMenuBadge +│ │ │ └── SidebarMenuItem +│ │ │ ├── SidebarMenuButton +│ │ │ └── SidebarMenuSub +│ │ │ ├── SidebarMenuSubItem +│ │ │ └── SidebarMenuSubItem +│ │ └── SidebarGroup +│ │ └── SidebarMenu +│ │ ├── SidebarMenuItem +│ │ └── SidebarMenuItem +│ ├── SidebarFooter +│ └── SidebarRail +├── SidebarInset +└── SidebarTrigger +``` + +## Structure + +- **SidebarProvider** — Handles collapsible state and provides sidebar context to child components. +- **Sidebar** — The main collapsible sidebar panel. +- **SidebarHeader** — Sticky at the top; use for branding, titles, or workspace switchers. +- **SidebarFooter** — Sticky at the bottom; use for user menus, settings, or actions. +- **SidebarContent** — Scrollable region between the header and footer. +- **SidebarGroup** — Groups related navigation with optional label, action, and content areas. +- **SidebarMenu** / **SidebarMenuItem** — Menu structure for links, badges, actions, and nested submenus. +- **SidebarRail** — Resize handle for adjusting sidebar width when applicable. +- **SidebarInset** — Wraps main content when using the `inset` variant. +- **SidebarTrigger** — Control that toggles the sidebar open or collapsed. + +Sidebar Structure +Sidebar Structure + ## SidebarProvider The `SidebarProvider` component is used to provide the sidebar context to the `Sidebar` component. You should always wrap your application in a `SidebarProvider` component. diff --git a/apps/v4/content/docs/components/radix/table.mdx b/apps/v4/content/docs/components/radix/table.mdx index e97a61981..523310291 100644 --- a/apps/v4/content/docs/components/radix/table.mdx +++ b/apps/v4/content/docs/components/radix/table.mdx @@ -83,6 +83,33 @@ import { ``` +## Composition + +Use the following composition to build a `Table`: + +```text +Table +├── TableCaption +├── TableHeader +│ └── TableRow +│ ├── TableHead +│ ├── TableHead +│ ├── TableHead +│ └── TableHead +├── TableBody +│ ├── TableRow +│ │ ├── TableCell +│ │ ├── TableCell +│ │ ├── TableCell +│ │ └── TableCell +│ └── TableRow +│ ├── TableCell +│ ├── TableCell +│ ├── TableCell +│ └── TableCell +└── TableFooter +``` + ## Examples ### Footer diff --git a/apps/v4/content/docs/components/radix/tabs.mdx b/apps/v4/content/docs/components/radix/tabs.mdx index 6c666dcea..087658e80 100644 --- a/apps/v4/content/docs/components/radix/tabs.mdx +++ b/apps/v4/content/docs/components/radix/tabs.mdx @@ -73,6 +73,19 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" ``` +## Composition + +Use the following composition to build `Tabs`: + +```text +Tabs +├── TabsList +│ ├── TabsTrigger +│ └── TabsTrigger +├── TabsContent +└── TabsContent +``` + ## Examples ### Line diff --git a/apps/v4/content/docs/components/radix/toggle-group.mdx b/apps/v4/content/docs/components/radix/toggle-group.mdx index 4e7892734..f3f86db9f 100644 --- a/apps/v4/content/docs/components/radix/toggle-group.mdx +++ b/apps/v4/content/docs/components/radix/toggle-group.mdx @@ -66,6 +66,16 @@ import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group" ``` +## Composition + +Use the following composition to build a `ToggleGroup`: + +```text +ToggleGroup +├── ToggleGroupItem +└── ToggleGroupItem +``` + ## Examples ### Outline diff --git a/apps/v4/content/docs/components/radix/tooltip.mdx b/apps/v4/content/docs/components/radix/tooltip.mdx index 7eaa10c4a..570a73106 100644 --- a/apps/v4/content/docs/components/radix/tooltip.mdx +++ b/apps/v4/content/docs/components/radix/tooltip.mdx @@ -109,6 +109,16 @@ import { ``` +## Composition + +Use the following composition to build a `Tooltip`: + +```text +Tooltip +├── TooltipTrigger +└── TooltipContent +``` + ## Examples ### Side