@neynar/ui 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/accordion.d.ts +1 -25
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +240 -46
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert.d.ts +73 -11
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/aspect-ratio.d.ts +44 -10
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui/avatar.d.ts +117 -33
- package/dist/components/ui/avatar.d.ts.map +1 -1
- package/dist/components/ui/badge.d.ts +50 -71
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.d.ts +231 -49
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/button.d.ts +189 -71
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/calendar.d.ts +197 -40
- package/dist/components/ui/calendar.d.ts.map +1 -1
- package/dist/components/ui/card.d.ts +7 -22
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/carousel.d.ts +369 -99
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/chart.d.ts.map +1 -1
- package/dist/components/ui/checkbox.d.ts +110 -38
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/collapsible.d.ts +246 -61
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/combobox.d.ts +207 -159
- package/dist/components/ui/combobox.d.ts.map +1 -1
- package/dist/components/ui/command.d.ts +336 -67
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/container.d.ts +159 -64
- package/dist/components/ui/container.d.ts.map +1 -1
- package/dist/components/ui/context-menu.d.ts +321 -39
- package/dist/components/ui/context-menu.d.ts.map +1 -1
- package/dist/components/ui/date-picker.d.ts +113 -86
- package/dist/components/ui/date-picker.d.ts.map +1 -1
- package/dist/components/ui/dialog.d.ts +106 -25
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/drawer.d.ts +388 -59
- package/dist/components/ui/drawer.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts +521 -74
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/empty-state.d.ts +148 -76
- package/dist/components/ui/empty-state.d.ts.map +1 -1
- package/dist/components/ui/hover-card.d.ts +253 -34
- package/dist/components/ui/hover-card.d.ts.map +1 -1
- package/dist/components/ui/input.d.ts +143 -44
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/label.d.ts +0 -8
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/menubar.d.ts +288 -46
- package/dist/components/ui/menubar.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu.d.ts +444 -127
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/pagination.d.ts +342 -66
- package/dist/components/ui/pagination.d.ts.map +1 -1
- package/dist/components/ui/popover.d.ts +0 -8
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/progress.d.ts +88 -30
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/radio-group.d.ts +189 -45
- package/dist/components/ui/radio-group.d.ts.map +1 -1
- package/dist/components/ui/resizable.d.ts +178 -62
- package/dist/components/ui/resizable.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.d.ts +180 -21
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/select.d.ts +382 -60
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/separator.d.ts +52 -39
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/sheet.d.ts +144 -27
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sidebar.d.ts +81 -31
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/components/ui/skeleton.d.ts +94 -32
- package/dist/components/ui/skeleton.d.ts.map +1 -1
- package/dist/components/ui/slider.d.ts +37 -31
- package/dist/components/ui/slider.d.ts.map +1 -1
- package/dist/components/ui/sonner.d.ts +280 -46
- package/dist/components/ui/sonner.d.ts.map +1 -1
- package/dist/components/ui/stack.d.ts +289 -148
- package/dist/components/ui/stack.d.ts.map +1 -1
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts +1 -2
- package/dist/components/ui/stories/aspect-ratio.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/container.stories.d.ts +2 -3
- package/dist/components/ui/stories/container.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/empty-state.stories.d.ts +2 -2
- package/dist/components/ui/stories/scroll-area.stories.d.ts +1 -2
- package/dist/components/ui/stories/scroll-area.stories.d.ts.map +1 -1
- package/dist/components/ui/stories/stack.stories.d.ts +1 -1
- package/dist/components/ui/stories/text-field.stories.d.ts +7 -1
- package/dist/components/ui/stories/text-field.stories.d.ts.map +1 -1
- package/dist/components/ui/switch.d.ts +44 -38
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/table.d.ts +33 -0
- package/dist/components/ui/table.d.ts.map +1 -1
- package/dist/components/ui/tabs.d.ts +4 -22
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/text-field.d.ts +170 -84
- package/dist/components/ui/text-field.d.ts.map +1 -1
- package/dist/components/ui/textarea.d.ts +106 -29
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/components/ui/theme-toggle.d.ts +190 -65
- package/dist/components/ui/theme-toggle.d.ts.map +1 -1
- package/dist/components/ui/theme.d.ts +107 -23
- package/dist/components/ui/theme.d.ts.map +1 -1
- package/dist/components/ui/toggle-group.d.ts +143 -67
- package/dist/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/components/ui/toggle.d.ts +118 -30
- package/dist/components/ui/toggle.d.ts.map +1 -1
- package/dist/components/ui/tooltip.d.ts +152 -28
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/typography.d.ts +452 -134
- package/dist/components/ui/typography.d.ts.map +1 -1
- package/dist/index.js +9388 -8281
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/llms.txt +173 -3
- package/package.json +5 -2
- package/src/components/ui/accordion.tsx +112 -27
- package/src/components/ui/alert-dialog.tsx +401 -46
- package/src/components/ui/alert.tsx +114 -11
- package/src/components/ui/aspect-ratio.tsx +69 -14
- package/src/components/ui/avatar.tsx +179 -33
- package/src/components/ui/badge.tsx +74 -75
- package/src/components/ui/breadcrumb.tsx +335 -50
- package/src/components/ui/button.tsx +198 -90
- package/src/components/ui/calendar.tsx +867 -43
- package/src/components/ui/card.tsx +140 -33
- package/src/components/ui/carousel.tsx +529 -98
- package/src/components/ui/chart.tsx +222 -1
- package/src/components/ui/checkbox.tsx +176 -38
- package/src/components/ui/collapsible.tsx +321 -67
- package/src/components/ui/combobox.tsx +284 -83
- package/src/components/ui/command.tsx +527 -67
- package/src/components/ui/container.tsx +217 -65
- package/src/components/ui/context-menu.tsx +716 -51
- package/src/components/ui/date-picker.tsx +228 -38
- package/src/components/ui/dialog.tsx +270 -33
- package/src/components/ui/drawer.tsx +546 -67
- package/src/components/ui/dropdown-menu.tsx +657 -74
- package/src/components/ui/empty-state.tsx +241 -82
- package/src/components/ui/hover-card.tsx +328 -39
- package/src/components/ui/input.tsx +207 -44
- package/src/components/ui/label.tsx +98 -8
- package/src/components/ui/menubar.tsx +587 -54
- package/src/components/ui/navigation-menu.tsx +557 -128
- package/src/components/ui/pagination.tsx +561 -79
- package/src/components/ui/popover.tsx +119 -8
- package/src/components/ui/progress.tsx +131 -29
- package/src/components/ui/radio-group.tsx +260 -51
- package/src/components/ui/resizable.tsx +289 -63
- package/src/components/ui/scroll-area.tsx +377 -66
- package/src/components/ui/select.tsx +545 -60
- package/src/components/ui/separator.tsx +146 -40
- package/src/components/ui/sheet.tsx +348 -31
- package/src/components/ui/sidebar.tsx +471 -29
- package/src/components/ui/skeleton.tsx +114 -32
- package/src/components/ui/slider.tsx +77 -31
- package/src/components/ui/sonner.tsx +574 -46
- package/src/components/ui/stack.tsx +423 -101
- package/src/components/ui/switch.tsx +78 -39
- package/src/components/ui/table.tsx +170 -4
- package/src/components/ui/tabs.tsx +108 -22
- package/src/components/ui/text-field.tsx +226 -81
- package/src/components/ui/textarea.tsx +180 -29
- package/src/components/ui/theme-toggle.tsx +313 -65
- package/src/components/ui/theme.tsx +117 -23
- package/src/components/ui/toggle-group.tsx +280 -69
- package/src/components/ui/toggle.tsx +124 -35
- package/src/components/ui/tooltip.tsx +239 -29
- package/src/components/ui/typography.tsx +1115 -165
|
@@ -4,15 +4,306 @@ import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "@/lib/utils";
|
|
6
6
|
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// DOCUMENTATION-ONLY PROP TYPES (Internal - not exported)
|
|
9
|
+
// These types are for documentation generation and should not replace Radix inferred types
|
|
10
|
+
// ============================================================================
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Props for Menubar component (Documentation only - NOT used in component implementation)
|
|
14
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
15
|
+
*/
|
|
16
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
17
|
+
type MenubarDocsProps = {
|
|
18
|
+
/** Additional CSS classes to apply to the menubar container */
|
|
19
|
+
className?: string;
|
|
20
|
+
/** The value of the menu that should be open when initially rendered. Use when you do not need to control the state */
|
|
21
|
+
defaultValue?: string;
|
|
22
|
+
/** The controlled value of the menu to open. Should be used in conjunction with onValueChange */
|
|
23
|
+
value?: string;
|
|
24
|
+
/** Event handler called when the value changes */
|
|
25
|
+
onValueChange?: (value: string) => void;
|
|
26
|
+
/** The reading direction of the menubar. If omitted, inherits globally from DirectionProvider or assumes LTR */
|
|
27
|
+
dir?: "ltr" | "rtl";
|
|
28
|
+
/** Whether keyboard navigation should loop from last item to first, and vice versa @default false */
|
|
29
|
+
loop?: boolean;
|
|
30
|
+
} & React.ComponentProps<typeof MenubarPrimitive.Root>;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Props for MenubarMenu component (Documentation only - NOT used in component implementation)
|
|
34
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
35
|
+
*/
|
|
36
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
37
|
+
type MenubarMenuDocsProps = {
|
|
38
|
+
/** The unique value of the menu */
|
|
39
|
+
value?: string;
|
|
40
|
+
} & React.ComponentProps<typeof MenubarPrimitive.Menu>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Props for MenubarGroup component (Documentation only - NOT used in component implementation)
|
|
44
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
45
|
+
*/
|
|
46
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
47
|
+
type MenubarGroupDocsProps = React.ComponentProps<
|
|
48
|
+
typeof MenubarPrimitive.Group
|
|
49
|
+
>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Props for MenubarPortal component (Documentation only - NOT used in component implementation)
|
|
53
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
54
|
+
*/
|
|
55
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
56
|
+
type MenubarPortalDocsProps = {
|
|
57
|
+
/** Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries */
|
|
58
|
+
forceMount?: true;
|
|
59
|
+
/** Specify a container element to portal the content into @default document.body */
|
|
60
|
+
container?: HTMLElement;
|
|
61
|
+
} & React.ComponentProps<typeof MenubarPrimitive.Portal>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Props for MenubarRadioGroup component (Documentation only - NOT used in component implementation)
|
|
65
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
66
|
+
*/
|
|
67
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
68
|
+
type MenubarRadioGroupDocsProps = {
|
|
69
|
+
/** The controlled value of the radio item to check. Should be used in conjunction with onValueChange */
|
|
70
|
+
value?: string;
|
|
71
|
+
/** Event handler called when the value changes */
|
|
72
|
+
onValueChange?: (value: string) => void;
|
|
73
|
+
} & React.ComponentProps<typeof MenubarPrimitive.RadioGroup>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Props for MenubarTrigger component (Documentation only - NOT used in component implementation)
|
|
77
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
78
|
+
*/
|
|
79
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
80
|
+
type MenubarTriggerDocsProps = {
|
|
81
|
+
/** Additional CSS classes to apply to the trigger button */
|
|
82
|
+
className?: string;
|
|
83
|
+
/** Change the default rendered element for the one passed as a child, merging their props and behavior */
|
|
84
|
+
asChild?: boolean;
|
|
85
|
+
} & React.ComponentProps<typeof MenubarPrimitive.Trigger>;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Props for MenubarContent component (Documentation only - NOT used in component implementation)
|
|
89
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
90
|
+
*/
|
|
91
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
92
|
+
type MenubarContentDocsProps = {
|
|
93
|
+
/** Additional CSS classes to apply to the content container */
|
|
94
|
+
className?: string;
|
|
95
|
+
/** The preferred alignment against the trigger. May change when collisions occur @default "start" */
|
|
96
|
+
align?: "start" | "center" | "end";
|
|
97
|
+
/** An offset in pixels from the "start" or "end" alignment options @default -4 */
|
|
98
|
+
alignOffset?: number;
|
|
99
|
+
/** The distance in pixels from the trigger @default 8 */
|
|
100
|
+
sideOffset?: number;
|
|
101
|
+
/** The preferred side of the trigger to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled @default "bottom" */
|
|
102
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
103
|
+
/** When true, overrides the side and align preferences to prevent collisions with viewport edges @default true */
|
|
104
|
+
avoidCollisions?: boolean;
|
|
105
|
+
/** The element used as the collision boundary. By default this is the viewport, though you can provide additional element(s) to be included in this check */
|
|
106
|
+
collisionBoundary?: Element | null | Array<Element | null>;
|
|
107
|
+
/** The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners @default 5 */
|
|
108
|
+
arrowPadding?: number;
|
|
109
|
+
/** The sticky behavior on the align axis. "partial" will keep the content in bounds as long as the trigger is at least partially in bounds whilst "always" will keep the content in bounds regardless @default "partial" */
|
|
110
|
+
sticky?: "partial" | "always";
|
|
111
|
+
/** Whether to hide the content when the trigger becomes fully occluded @default false */
|
|
112
|
+
hideWhenDetached?: boolean;
|
|
113
|
+
/** When true, keyboard navigation will loop from last item to first, and vice versa @default false */
|
|
114
|
+
loop?: boolean;
|
|
115
|
+
/** Event handler called when the escape key is down. Can be prevented by calling event.preventDefault */
|
|
116
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
117
|
+
/** Event handler called when the a pointerdown event happens outside of the component. Can be prevented by calling event.preventDefault */
|
|
118
|
+
onPointerDownOutside?: (
|
|
119
|
+
event: CustomEvent<{ originalEvent: PointerEvent }>,
|
|
120
|
+
) => void;
|
|
121
|
+
/** Event handler called when focus moves outside of the component. Can be prevented by calling event.preventDefault */
|
|
122
|
+
onFocusOutside?: (event: CustomEvent<{ originalEvent: FocusEvent }>) => void;
|
|
123
|
+
/** Event handler called when an interaction happens outside the component. Specifically, when a pointerdown event happens outside or focus moves outside of it. Can be prevented by calling event.preventDefault */
|
|
124
|
+
onInteractOutside?: (
|
|
125
|
+
event: CustomEvent<{ originalEvent: PointerEvent | FocusEvent }>,
|
|
126
|
+
) => void;
|
|
127
|
+
/** Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries */
|
|
128
|
+
forceMount?: true;
|
|
129
|
+
} & React.ComponentProps<typeof MenubarPrimitive.Content>;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Props for MenubarItem component (Documentation only - NOT used in component implementation)
|
|
133
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
134
|
+
*/
|
|
135
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
136
|
+
type MenubarItemDocsProps = {
|
|
137
|
+
/** Additional CSS classes to apply to the menu item */
|
|
138
|
+
className?: string;
|
|
139
|
+
/** Whether to add left padding for alignment with items that have icons */
|
|
140
|
+
inset?: boolean;
|
|
141
|
+
/** Visual variant of the menu item */
|
|
142
|
+
variant?: "default" | "destructive";
|
|
143
|
+
/** When true, prevents the user from interacting with the item */
|
|
144
|
+
disabled?: boolean;
|
|
145
|
+
/** Event handler called when the user selects an item (via mouse or keyboard). Calling event.preventDefault in this handler will prevent the menu from closing when selecting that item */
|
|
146
|
+
onSelect?: (event: Event) => void;
|
|
147
|
+
/** Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside */
|
|
148
|
+
textValue?: string;
|
|
149
|
+
} & React.ComponentProps<typeof MenubarPrimitive.Item>;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Props for MenubarCheckboxItem component (Documentation only - NOT used in component implementation)
|
|
153
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
154
|
+
*/
|
|
155
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
156
|
+
type MenubarCheckboxItemDocsProps = {
|
|
157
|
+
/** Additional CSS classes to apply to the checkbox item */
|
|
158
|
+
className?: string;
|
|
159
|
+
/** The controlled checked state of the item. Must be used in conjunction with onCheckedChange */
|
|
160
|
+
checked?: boolean | "indeterminate";
|
|
161
|
+
/** Event handler called when the checked state changes */
|
|
162
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
163
|
+
/** When true, prevents the user from interacting with the item */
|
|
164
|
+
disabled?: boolean;
|
|
165
|
+
/** Event handler called when the user selects an item (via mouse or keyboard). Calling event.preventDefault in this handler will prevent the menu from closing when selecting that item */
|
|
166
|
+
onSelect?: (event: Event) => void;
|
|
167
|
+
/** Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside */
|
|
168
|
+
textValue?: string;
|
|
169
|
+
} & Omit<
|
|
170
|
+
React.ComponentProps<typeof MenubarPrimitive.CheckboxItem>,
|
|
171
|
+
"checked" | "onCheckedChange"
|
|
172
|
+
>;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Props for MenubarRadioItem component (Documentation only - NOT used in component implementation)
|
|
176
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
177
|
+
*/
|
|
178
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
179
|
+
type MenubarRadioItemDocsProps = {
|
|
180
|
+
/** Additional CSS classes to apply to the radio item */
|
|
181
|
+
className?: string;
|
|
182
|
+
/** The unique value of the item */
|
|
183
|
+
value: string;
|
|
184
|
+
/** When true, prevents the user from interacting with the item */
|
|
185
|
+
disabled?: boolean;
|
|
186
|
+
/** Event handler called when the user selects an item (via mouse or keyboard). Calling event.preventDefault in this handler will prevent the menu from closing when selecting that item */
|
|
187
|
+
onSelect?: (event: Event) => void;
|
|
188
|
+
/** Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside */
|
|
189
|
+
textValue?: string;
|
|
190
|
+
} & React.ComponentProps<typeof MenubarPrimitive.RadioItem>;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Props for MenubarLabel component (Documentation only - NOT used in component implementation)
|
|
194
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
195
|
+
*/
|
|
196
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
197
|
+
type MenubarLabelDocsProps = {
|
|
198
|
+
/** Additional CSS classes to apply to the label */
|
|
199
|
+
className?: string;
|
|
200
|
+
/** Whether to add left padding for alignment with items that have icons */
|
|
201
|
+
inset?: boolean;
|
|
202
|
+
} & React.ComponentProps<typeof MenubarPrimitive.Label>;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Props for MenubarSeparator component (Documentation only - NOT used in component implementation)
|
|
206
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
207
|
+
*/
|
|
208
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
209
|
+
type MenubarSeparatorDocsProps = {
|
|
210
|
+
/** Additional CSS classes to apply to the separator */
|
|
211
|
+
className?: string;
|
|
212
|
+
} & React.ComponentProps<typeof MenubarPrimitive.Separator>;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Props for MenubarShortcut component (Documentation only - NOT used in component implementation)
|
|
216
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
217
|
+
*/
|
|
218
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
219
|
+
type MenubarShortcutDocsProps = {
|
|
220
|
+
/** Additional CSS classes to apply to the shortcut text */
|
|
221
|
+
className?: string;
|
|
222
|
+
} & React.ComponentProps<"span">;
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Props for MenubarSub component (Documentation only - NOT used in component implementation)
|
|
226
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
227
|
+
*/
|
|
228
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
229
|
+
type MenubarSubDocsProps = {
|
|
230
|
+
/** The controlled open state of the sub menu. Must be used in conjunction with onOpenChange */
|
|
231
|
+
open?: boolean;
|
|
232
|
+
/** The open state of the submenu when it is initially rendered. Use when you do not need to control its open state */
|
|
233
|
+
defaultOpen?: boolean;
|
|
234
|
+
/** Event handler called when the open state of the submenu changes */
|
|
235
|
+
onOpenChange?: (open: boolean) => void;
|
|
236
|
+
} & React.ComponentProps<typeof MenubarPrimitive.Sub>;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Props for MenubarSubTrigger component (Documentation only - NOT used in component implementation)
|
|
240
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
241
|
+
*/
|
|
242
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
243
|
+
type MenubarSubTriggerDocsProps = {
|
|
244
|
+
/** Additional CSS classes to apply to the sub-trigger */
|
|
245
|
+
className?: string;
|
|
246
|
+
/** Whether to add left padding for alignment with items that have icons */
|
|
247
|
+
inset?: boolean;
|
|
248
|
+
/** When true, prevents the user from interacting with the item */
|
|
249
|
+
disabled?: boolean;
|
|
250
|
+
/** Optional text used for typeahead purposes. By default the typeahead behavior will use the .textContent of the item. Use this when the content is complex, or you have non-textual content inside */
|
|
251
|
+
textValue?: string;
|
|
252
|
+
} & React.ComponentProps<typeof MenubarPrimitive.SubTrigger>;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Props for MenubarSubContent component (Documentation only - NOT used in component implementation)
|
|
256
|
+
* These types are for documentation generation and should not replace Radix inferred types
|
|
257
|
+
*/
|
|
258
|
+
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
259
|
+
type MenubarSubContentDocsProps = {
|
|
260
|
+
/** Additional CSS classes to apply to the sub-content container */
|
|
261
|
+
className?: string;
|
|
262
|
+
/** The preferred alignment against the trigger. May change when collisions occur @default "start" */
|
|
263
|
+
align?: "start" | "center" | "end";
|
|
264
|
+
/** An offset in pixels from the "start" or "end" alignment options @default 0 */
|
|
265
|
+
alignOffset?: number;
|
|
266
|
+
/** The distance in pixels from the trigger @default 0 */
|
|
267
|
+
sideOffset?: number;
|
|
268
|
+
/** The preferred side of the trigger to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled @default "right" */
|
|
269
|
+
side?: "top" | "right" | "bottom" | "left";
|
|
270
|
+
/** When true, overrides the side and align preferences to prevent collisions with viewport edges @default true */
|
|
271
|
+
avoidCollisions?: boolean;
|
|
272
|
+
/** The element used as the collision boundary. By default this is the viewport, though you can provide additional element(s) to be included in this check */
|
|
273
|
+
collisionBoundary?: Element | null | Array<Element | null>;
|
|
274
|
+
/** The padding between the arrow and the edges of the content. If your content has border-radius, this will prevent it from overflowing the corners @default 5 */
|
|
275
|
+
arrowPadding?: number;
|
|
276
|
+
/** The sticky behavior on the align axis. "partial" will keep the content in bounds as long as the trigger is at least partially in bounds whilst "always" will keep the content in bounds regardless @default "partial" */
|
|
277
|
+
sticky?: "partial" | "always";
|
|
278
|
+
/** Whether to hide the content when the trigger becomes fully occluded @default false */
|
|
279
|
+
hideWhenDetached?: boolean;
|
|
280
|
+
/** When true, keyboard navigation will loop from last item to first, and vice versa @default false */
|
|
281
|
+
loop?: boolean;
|
|
282
|
+
/** Event handler called when the escape key is down. Can be prevented by calling event.preventDefault */
|
|
283
|
+
onEscapeKeyDown?: (event: KeyboardEvent) => void;
|
|
284
|
+
/** Event handler called when the a pointerdown event happens outside of the component. Can be prevented by calling event.preventDefault */
|
|
285
|
+
onPointerDownOutside?: (
|
|
286
|
+
event: CustomEvent<{ originalEvent: PointerEvent }>,
|
|
287
|
+
) => void;
|
|
288
|
+
/** Event handler called when focus moves outside of the component. Can be prevented by calling event.preventDefault */
|
|
289
|
+
onFocusOutside?: (event: CustomEvent<{ originalEvent: FocusEvent }>) => void;
|
|
290
|
+
/** Event handler called when an interaction happens outside the component. Specifically, when a pointerdown event happens outside or focus moves outside of it. Can be prevented by calling event.preventDefault */
|
|
291
|
+
onInteractOutside?: (
|
|
292
|
+
event: CustomEvent<{ originalEvent: PointerEvent | FocusEvent }>,
|
|
293
|
+
) => void;
|
|
294
|
+
/** Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries */
|
|
295
|
+
forceMount?: true;
|
|
296
|
+
} & React.ComponentProps<typeof MenubarPrimitive.SubContent>;
|
|
297
|
+
|
|
7
298
|
/**
|
|
8
299
|
* A visually persistent menu common in desktop applications that provides access to a consistent set of commands.
|
|
9
|
-
*
|
|
300
|
+
*
|
|
10
301
|
* Menubar provides a horizontal navigation structure similar to desktop application menus
|
|
11
302
|
* like those found in VS Code, Figma, or native applications. Each menu contains dropdown
|
|
12
303
|
* content with actions, checkboxes, radio groups, and nested submenus.
|
|
13
|
-
*
|
|
304
|
+
*
|
|
14
305
|
* Built on top of Radix UI Menubar primitive with full keyboard navigation and accessibility support.
|
|
15
|
-
*
|
|
306
|
+
*
|
|
16
307
|
* @example
|
|
17
308
|
* ```tsx
|
|
18
309
|
* // Basic application menubar
|
|
@@ -35,7 +326,7 @@ import { cn } from "@/lib/utils";
|
|
|
35
326
|
* </MenubarMenu>
|
|
36
327
|
* </Menubar>
|
|
37
328
|
* ```
|
|
38
|
-
*
|
|
329
|
+
*
|
|
39
330
|
* @example
|
|
40
331
|
* ```tsx
|
|
41
332
|
* // With checkboxes and submenus
|
|
@@ -58,7 +349,7 @@ import { cn } from "@/lib/utils";
|
|
|
58
349
|
* </MenubarMenu>
|
|
59
350
|
* </Menubar>
|
|
60
351
|
* ```
|
|
61
|
-
*
|
|
352
|
+
*
|
|
62
353
|
* @example
|
|
63
354
|
* ```tsx
|
|
64
355
|
* // With radio groups for exclusive selections
|
|
@@ -75,7 +366,7 @@ import { cn } from "@/lib/utils";
|
|
|
75
366
|
* </MenubarMenu>
|
|
76
367
|
* </Menubar>
|
|
77
368
|
* ```
|
|
78
|
-
*
|
|
369
|
+
*
|
|
79
370
|
* @accessibility
|
|
80
371
|
* - Follows WAI-ARIA menubar pattern
|
|
81
372
|
* - Left/Right arrow keys navigate between menu triggers
|
|
@@ -85,16 +376,35 @@ import { cn } from "@/lib/utils";
|
|
|
85
376
|
* - Tab moves focus to next focusable element outside menubar
|
|
86
377
|
* - Full keyboard navigation with arrow keys, Enter, and Escape
|
|
87
378
|
* - Screen reader support with proper ARIA labels and roles
|
|
88
|
-
*
|
|
379
|
+
*
|
|
89
380
|
* @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/menubar/} ARIA Menubar Pattern
|
|
90
381
|
* @see {@link https://ui.shadcn.com/docs/components/menubar} shadcn/ui Menubar Documentation
|
|
91
382
|
* @since 1.0.0
|
|
92
383
|
*/
|
|
93
384
|
/**
|
|
94
385
|
* Root container for the menubar component.
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
386
|
+
*
|
|
387
|
+
* Creates a persistent horizontal menu bar that provides access to application commands.
|
|
388
|
+
* Supports keyboard navigation, controlled and uncontrolled states, and directional reading.
|
|
389
|
+
*
|
|
390
|
+
* @param className - Additional CSS classes to apply to the menubar container
|
|
391
|
+
* @param defaultValue - The value of the menu that should be open when initially rendered. Use when you do not need to control the state
|
|
392
|
+
* @param value - The controlled value of the menu to open. Should be used in conjunction with onValueChange
|
|
393
|
+
* @param onValueChange - Event handler called when the value changes
|
|
394
|
+
* @param dir - The reading direction of the menubar. If omitted, inherits globally from DirectionProvider or assumes LTR
|
|
395
|
+
* @param loop - Whether keyboard navigation should loop from last item to first, and vice versa
|
|
396
|
+
* @param props - Additional props from Radix UI Menubar Root
|
|
397
|
+
*
|
|
398
|
+
* @example
|
|
399
|
+
* ```tsx
|
|
400
|
+
* // Controlled menubar
|
|
401
|
+
* <Menubar value={activeMenu} onValueChange={setActiveMenu}>
|
|
402
|
+
* <MenubarMenu value="file">
|
|
403
|
+
* <MenubarTrigger>File</MenubarTrigger>
|
|
404
|
+
* <MenubarContent>...</MenubarContent>
|
|
405
|
+
* </MenubarMenu>
|
|
406
|
+
* </Menubar>
|
|
407
|
+
* ```
|
|
98
408
|
*/
|
|
99
409
|
function Menubar({
|
|
100
410
|
className,
|
|
@@ -116,9 +426,18 @@ function Menubar({
|
|
|
116
426
|
* Container for a single menu within the menubar.
|
|
117
427
|
*
|
|
118
428
|
* Each MenubarMenu represents one dropdown menu that can be triggered
|
|
119
|
-
* by its corresponding MenubarTrigger.
|
|
429
|
+
* by its corresponding MenubarTrigger. Must be used within a Menubar root.
|
|
430
|
+
*
|
|
431
|
+
* @param value - The unique value of the menu for controlled state management
|
|
432
|
+
* @param props - Additional props from Radix UI Menubar Menu
|
|
120
433
|
*
|
|
121
|
-
* @
|
|
434
|
+
* @example
|
|
435
|
+
* ```tsx
|
|
436
|
+
* <MenubarMenu value="edit">
|
|
437
|
+
* <MenubarTrigger>Edit</MenubarTrigger>
|
|
438
|
+
* <MenubarContent>...</MenubarContent>
|
|
439
|
+
* </MenubarMenu>
|
|
440
|
+
* ```
|
|
122
441
|
*/
|
|
123
442
|
function MenubarMenu({
|
|
124
443
|
...props
|
|
@@ -130,9 +449,25 @@ function MenubarMenu({
|
|
|
130
449
|
* Groups related menu items together within MenubarContent.
|
|
131
450
|
*
|
|
132
451
|
* Used to create logical groupings of menu items, often separated
|
|
133
|
-
* by MenubarSeparator components.
|
|
452
|
+
* by MenubarSeparator components. Helps organize complex menus.
|
|
134
453
|
*
|
|
135
454
|
* @param props - All props from Radix UI Menubar Group
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* ```tsx
|
|
458
|
+
* <MenubarContent>
|
|
459
|
+
* <MenubarGroup>
|
|
460
|
+
* <MenubarItem>Cut</MenubarItem>
|
|
461
|
+
* <MenubarItem>Copy</MenubarItem>
|
|
462
|
+
* <MenubarItem>Paste</MenubarItem>
|
|
463
|
+
* </MenubarGroup>
|
|
464
|
+
* <MenubarSeparator />
|
|
465
|
+
* <MenubarGroup>
|
|
466
|
+
* <MenubarItem>Find</MenubarItem>
|
|
467
|
+
* <MenubarItem>Replace</MenubarItem>
|
|
468
|
+
* </MenubarGroup>
|
|
469
|
+
* </MenubarContent>
|
|
470
|
+
* ```
|
|
136
471
|
*/
|
|
137
472
|
function MenubarGroup({
|
|
138
473
|
...props
|
|
@@ -144,9 +479,19 @@ function MenubarGroup({
|
|
|
144
479
|
* Portal for rendering menu content outside the DOM hierarchy.
|
|
145
480
|
*
|
|
146
481
|
* Automatically used by MenubarContent to ensure proper layering
|
|
147
|
-
* and positioning of dropdown menus.
|
|
482
|
+
* and positioning of dropdown menus. Prevents z-index conflicts.
|
|
148
483
|
*
|
|
149
|
-
* @param
|
|
484
|
+
* @param forceMount - Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries
|
|
485
|
+
* @param container - Specify a container element to portal the content into
|
|
486
|
+
* @param props - Additional props from Radix UI Menubar Portal
|
|
487
|
+
*
|
|
488
|
+
* @example
|
|
489
|
+
* ```tsx
|
|
490
|
+
* // Usually used automatically by MenubarContent
|
|
491
|
+
* <MenubarPortal container={customContainer}>
|
|
492
|
+
* <MenubarPrimitive.Content>...</MenubarPrimitive.Content>
|
|
493
|
+
* </MenubarPortal>
|
|
494
|
+
* ```
|
|
150
495
|
*/
|
|
151
496
|
function MenubarPortal({
|
|
152
497
|
...props
|
|
@@ -159,13 +504,18 @@ function MenubarPortal({
|
|
|
159
504
|
*
|
|
160
505
|
* Use for single-selection scenarios like theme selection,
|
|
161
506
|
* view modes, or other settings where only one option can be active.
|
|
507
|
+
* Only one RadioItem can be selected at a time within the group.
|
|
508
|
+
*
|
|
509
|
+
* @param value - The controlled value of the radio item to check. Should be used in conjunction with onValueChange
|
|
510
|
+
* @param onValueChange - Event handler called when the value changes
|
|
511
|
+
* @param props - Additional props from Radix UI Menubar RadioGroup
|
|
162
512
|
*
|
|
163
|
-
* @param props - All props from Radix UI Menubar RadioGroup
|
|
164
513
|
* @example
|
|
165
514
|
* ```tsx
|
|
166
515
|
* <MenubarRadioGroup value={theme} onValueChange={setTheme}>
|
|
167
516
|
* <MenubarRadioItem value="light">Light</MenubarRadioItem>
|
|
168
517
|
* <MenubarRadioItem value="dark">Dark</MenubarRadioItem>
|
|
518
|
+
* <MenubarRadioItem value="system">System</MenubarRadioItem>
|
|
169
519
|
* </MenubarRadioGroup>
|
|
170
520
|
* ```
|
|
171
521
|
*/
|
|
@@ -182,9 +532,24 @@ function MenubarRadioGroup({
|
|
|
182
532
|
*
|
|
183
533
|
* The trigger text should be concise and descriptive of the menu contents.
|
|
184
534
|
* Common patterns include "File", "Edit", "View", "Tools", "Help".
|
|
535
|
+
* Automatically receives focus management and keyboard navigation.
|
|
185
536
|
*
|
|
186
|
-
* @param className - Additional CSS classes to apply
|
|
187
|
-
* @param
|
|
537
|
+
* @param className - Additional CSS classes to apply to the trigger button
|
|
538
|
+
* @param asChild - Change the default rendered element for the one passed as a child, merging their props and behavior
|
|
539
|
+
* @param props - Additional props from Radix UI Menubar Trigger
|
|
540
|
+
*
|
|
541
|
+
* @accessibility
|
|
542
|
+
* - Receives focus with Tab key
|
|
543
|
+
* - Opens menu with Enter, Space, or Arrow Down
|
|
544
|
+
* - Left/Right arrows navigate between triggers
|
|
545
|
+
* - Includes proper ARIA attributes for screen readers
|
|
546
|
+
*
|
|
547
|
+
* @example
|
|
548
|
+
* ```tsx
|
|
549
|
+
* <MenubarTrigger>
|
|
550
|
+
* File
|
|
551
|
+
* </MenubarTrigger>
|
|
552
|
+
* ```
|
|
188
553
|
*/
|
|
189
554
|
function MenubarTrigger({
|
|
190
555
|
className,
|
|
@@ -206,13 +571,37 @@ function MenubarTrigger({
|
|
|
206
571
|
* Dropdown content container for menu items.
|
|
207
572
|
*
|
|
208
573
|
* Contains the actual menu items, separators, and submenus that appear
|
|
209
|
-
* when a MenubarTrigger is activated.
|
|
574
|
+
* when a MenubarTrigger is activated. Automatically portaled and positioned.
|
|
210
575
|
*
|
|
211
|
-
* @param className - Additional CSS classes to apply
|
|
212
|
-
* @param align -
|
|
213
|
-
* @param alignOffset -
|
|
214
|
-
* @param sideOffset -
|
|
215
|
-
* @param
|
|
576
|
+
* @param className - Additional CSS classes to apply to the content container
|
|
577
|
+
* @param align - The preferred alignment against the trigger. May change when collisions occur
|
|
578
|
+
* @param alignOffset - An offset in pixels from the "start" or "end" alignment options
|
|
579
|
+
* @param sideOffset - The distance in pixels from the trigger
|
|
580
|
+
* @param side - The preferred side of the trigger to render against when open
|
|
581
|
+
* @param avoidCollisions - When true, overrides the side and align preferences to prevent collisions with viewport edges
|
|
582
|
+
* @param collisionBoundary - The element used as the collision boundary for positioning
|
|
583
|
+
* @param loop - Whether keyboard navigation should loop from last item to first, and vice versa
|
|
584
|
+
* @param onEscapeKeyDown - Event handler called when the escape key is down
|
|
585
|
+
* @param onPointerDownOutside - Event handler called when a pointerdown event happens outside of the component
|
|
586
|
+
* @param onFocusOutside - Event handler called when focus moves outside of the component
|
|
587
|
+
* @param onInteractOutside - Event handler called when an interaction happens outside the component
|
|
588
|
+
* @param props - Additional props from Radix UI Menubar Content
|
|
589
|
+
*
|
|
590
|
+
* @accessibility
|
|
591
|
+
* - Focus is automatically managed within the content
|
|
592
|
+
* - Arrow keys navigate between items
|
|
593
|
+
* - Escape key closes the menu
|
|
594
|
+
* - Click outside closes the menu
|
|
595
|
+
*
|
|
596
|
+
* @example
|
|
597
|
+
* ```tsx
|
|
598
|
+
* <MenubarContent align="center" sideOffset={12}>
|
|
599
|
+
* <MenubarItem>New File</MenubarItem>
|
|
600
|
+
* <MenubarItem>Open File</MenubarItem>
|
|
601
|
+
* <MenubarSeparator />
|
|
602
|
+
* <MenubarItem>Exit</MenubarItem>
|
|
603
|
+
* </MenubarContent>
|
|
604
|
+
* ```
|
|
216
605
|
*/
|
|
217
606
|
function MenubarContent({
|
|
218
607
|
className,
|
|
@@ -242,15 +631,29 @@ function MenubarContent({
|
|
|
242
631
|
* A selectable menu item within MenubarContent.
|
|
243
632
|
*
|
|
244
633
|
* Can be enhanced with icons, keyboard shortcuts, and supports
|
|
245
|
-
* different variants including destructive actions.
|
|
634
|
+
* different variants including destructive actions. Automatically
|
|
635
|
+
* handles selection events and keyboard navigation.
|
|
246
636
|
*
|
|
247
|
-
* @param className - Additional CSS classes to apply
|
|
637
|
+
* @param className - Additional CSS classes to apply to the menu item
|
|
248
638
|
* @param inset - Whether to add left padding for alignment with items that have icons
|
|
249
|
-
* @param variant - Visual variant
|
|
250
|
-
* @param
|
|
639
|
+
* @param variant - Visual variant of the menu item
|
|
640
|
+
* @param disabled - When true, prevents the user from interacting with the item
|
|
641
|
+
* @param onSelect - Event handler called when the user selects an item (via mouse or keyboard)
|
|
642
|
+
* @param textValue - Optional text used for typeahead purposes when content is complex
|
|
643
|
+
* @param props - Additional props from Radix UI Menubar Item
|
|
644
|
+
*
|
|
645
|
+
* @variant default - Standard menu item appearance with neutral colors
|
|
646
|
+
* @variant destructive - Red-tinted appearance for dangerous actions like delete or remove
|
|
647
|
+
*
|
|
648
|
+
* @accessibility
|
|
649
|
+
* - Focusable with keyboard navigation
|
|
650
|
+
* - Activatable with Enter or Space keys
|
|
651
|
+
* - Supports typeahead search within menu
|
|
652
|
+
* - Properly labeled for screen readers
|
|
653
|
+
*
|
|
251
654
|
* @example
|
|
252
655
|
* ```tsx
|
|
253
|
-
* <MenubarItem variant="destructive">
|
|
656
|
+
* <MenubarItem onSelect={() => deleteFile()} variant="destructive">
|
|
254
657
|
* Delete File
|
|
255
658
|
* <MenubarShortcut>⌫</MenubarShortcut>
|
|
256
659
|
* </MenubarItem>
|
|
@@ -283,16 +686,31 @@ function MenubarItem({
|
|
|
283
686
|
* A menu item that can be checked/unchecked.
|
|
284
687
|
*
|
|
285
688
|
* Perfect for toggle options like "Show Toolbar", "Enable Feature",
|
|
286
|
-
* or any binary setting that can be turned on/off.
|
|
689
|
+
* or any binary setting that can be turned on/off. Displays a
|
|
690
|
+
* checkmark icon when checked.
|
|
287
691
|
*
|
|
288
|
-
* @param className - Additional CSS classes to apply
|
|
692
|
+
* @param className - Additional CSS classes to apply to the checkbox item
|
|
289
693
|
* @param children - The content of the checkbox item
|
|
290
|
-
* @param checked -
|
|
291
|
-
* @param
|
|
694
|
+
* @param checked - The controlled checked state of the item. Must be used in conjunction with onCheckedChange
|
|
695
|
+
* @param onCheckedChange - Event handler called when the checked state changes
|
|
696
|
+
* @param disabled - When true, prevents the user from interacting with the item
|
|
697
|
+
* @param onSelect - Event handler called when the user selects an item (via mouse or keyboard)
|
|
698
|
+
* @param textValue - Optional text used for typeahead purposes when content is complex
|
|
699
|
+
* @param props - Additional props from Radix UI Menubar CheckboxItem
|
|
700
|
+
*
|
|
701
|
+
* @accessibility
|
|
702
|
+
* - Proper ARIA checkbox role and state
|
|
703
|
+
* - Keyboard activatable with Enter or Space
|
|
704
|
+
* - Visual indicator shows checked/unchecked state
|
|
705
|
+
* - Screen reader announces state changes
|
|
706
|
+
*
|
|
292
707
|
* @example
|
|
293
708
|
* ```tsx
|
|
294
|
-
* <MenubarCheckboxItem
|
|
295
|
-
*
|
|
709
|
+
* <MenubarCheckboxItem
|
|
710
|
+
* checked={showLineNumbers}
|
|
711
|
+
* onCheckedChange={setShowLineNumbers}
|
|
712
|
+
* >
|
|
713
|
+
* Show Line Numbers
|
|
296
714
|
* </MenubarCheckboxItem>
|
|
297
715
|
* ```
|
|
298
716
|
*/
|
|
@@ -327,13 +745,29 @@ function MenubarCheckboxItem({
|
|
|
327
745
|
*
|
|
328
746
|
* Use within MenubarRadioGroup for mutually exclusive options.
|
|
329
747
|
* Only one radio item can be selected at a time within the group.
|
|
748
|
+
* Displays a filled circle icon when selected.
|
|
330
749
|
*
|
|
331
|
-
* @param className - Additional CSS classes to apply
|
|
750
|
+
* @param className - Additional CSS classes to apply to the radio item
|
|
332
751
|
* @param children - The content of the radio item
|
|
333
|
-
* @param
|
|
752
|
+
* @param value - The unique value of the item (required)
|
|
753
|
+
* @param disabled - When true, prevents the user from interacting with the item
|
|
754
|
+
* @param onSelect - Event handler called when the user selects an item (via mouse or keyboard)
|
|
755
|
+
* @param textValue - Optional text used for typeahead purposes when content is complex
|
|
756
|
+
* @param props - Additional props from Radix UI Menubar RadioItem
|
|
757
|
+
*
|
|
758
|
+
* @accessibility
|
|
759
|
+
* - Proper ARIA radio role and state
|
|
760
|
+
* - Keyboard activatable with Enter or Space
|
|
761
|
+
* - Visual indicator shows selected state
|
|
762
|
+
* - Screen reader announces selection changes
|
|
763
|
+
*
|
|
334
764
|
* @example
|
|
335
765
|
* ```tsx
|
|
336
|
-
* <
|
|
766
|
+
* <MenubarRadioGroup value={theme} onValueChange={setTheme}>
|
|
767
|
+
* <MenubarRadioItem value="light">Light Theme</MenubarRadioItem>
|
|
768
|
+
* <MenubarRadioItem value="dark">Dark Theme</MenubarRadioItem>
|
|
769
|
+
* <MenubarRadioItem value="system">System Theme</MenubarRadioItem>
|
|
770
|
+
* </MenubarRadioGroup>
|
|
337
771
|
* ```
|
|
338
772
|
*/
|
|
339
773
|
function MenubarRadioItem({
|
|
@@ -365,14 +799,25 @@ function MenubarRadioItem({
|
|
|
365
799
|
*
|
|
366
800
|
* Used to provide section headings within menu content,
|
|
367
801
|
* helping users understand the organization of menu items.
|
|
802
|
+
* Cannot be focused or selected.
|
|
368
803
|
*
|
|
369
|
-
* @param className - Additional CSS classes to apply
|
|
804
|
+
* @param className - Additional CSS classes to apply to the label
|
|
370
805
|
* @param inset - Whether to add left padding for alignment with items that have icons
|
|
371
|
-
* @param props -
|
|
806
|
+
* @param props - Additional props from Radix UI Menubar Label
|
|
807
|
+
*
|
|
808
|
+
* @accessibility
|
|
809
|
+
* - Not focusable via keyboard navigation
|
|
810
|
+
* - Provides semantic grouping information
|
|
811
|
+
* - Screen readers announce as a label
|
|
812
|
+
*
|
|
372
813
|
* @example
|
|
373
814
|
* ```tsx
|
|
374
|
-
* <
|
|
375
|
-
*
|
|
815
|
+
* <MenubarContent>
|
|
816
|
+
* <MenubarLabel>Recent Files</MenubarLabel>
|
|
817
|
+
* <MenubarSeparator />
|
|
818
|
+
* <MenubarItem>document.txt</MenubarItem>
|
|
819
|
+
* <MenubarItem>photo.jpg</MenubarItem>
|
|
820
|
+
* </MenubarContent>
|
|
376
821
|
* ```
|
|
377
822
|
*/
|
|
378
823
|
function MenubarLabel({
|
|
@@ -399,10 +844,26 @@ function MenubarLabel({
|
|
|
399
844
|
* A visual divider between menu items.
|
|
400
845
|
*
|
|
401
846
|
* Use to create logical groupings and improve visual hierarchy
|
|
402
|
-
* within menu content.
|
|
847
|
+
* within menu content. Creates clear sections for related items.
|
|
848
|
+
*
|
|
849
|
+
* @param className - Additional CSS classes to apply to the separator
|
|
850
|
+
* @param props - Additional props from Radix UI Menubar Separator
|
|
403
851
|
*
|
|
404
|
-
* @
|
|
405
|
-
*
|
|
852
|
+
* @accessibility
|
|
853
|
+
* - Not focusable via keyboard navigation
|
|
854
|
+
* - Provides visual separation for screen reader users
|
|
855
|
+
* - Helps organize menu content logically
|
|
856
|
+
*
|
|
857
|
+
* @example
|
|
858
|
+
* ```tsx
|
|
859
|
+
* <MenubarContent>
|
|
860
|
+
* <MenubarItem>New</MenubarItem>
|
|
861
|
+
* <MenubarItem>Open</MenubarItem>
|
|
862
|
+
* <MenubarSeparator />
|
|
863
|
+
* <MenubarItem>Save</MenubarItem>
|
|
864
|
+
* <MenubarItem>Save As</MenubarItem>
|
|
865
|
+
* </MenubarContent>
|
|
866
|
+
* ```
|
|
406
867
|
*/
|
|
407
868
|
function MenubarSeparator({
|
|
408
869
|
className,
|
|
@@ -422,15 +883,28 @@ function MenubarSeparator({
|
|
|
422
883
|
*
|
|
423
884
|
* Shows keyboard shortcuts aligned to the right of menu items.
|
|
424
885
|
* Use standard platform conventions (⌘ for Mac, Ctrl+ for Windows/Linux).
|
|
886
|
+
* Purely visual - does not implement the actual keyboard functionality.
|
|
887
|
+
*
|
|
888
|
+
* @param className - Additional CSS classes to apply to the shortcut text
|
|
889
|
+
* @param props - Additional props from HTML span element
|
|
890
|
+
*
|
|
891
|
+
* @accessibility
|
|
892
|
+
* - Provides keyboard shortcut information to all users
|
|
893
|
+
* - Screen readers announce shortcut along with menu item
|
|
894
|
+
* - Does not interfere with keyboard navigation
|
|
425
895
|
*
|
|
426
|
-
* @param className - Additional CSS classes to apply
|
|
427
|
-
* @param props - All props from HTML span element
|
|
428
896
|
* @example
|
|
429
897
|
* ```tsx
|
|
430
|
-
* <MenubarItem>
|
|
898
|
+
* <MenubarItem onSelect={() => save()}>
|
|
431
899
|
* Save File
|
|
432
900
|
* <MenubarShortcut>⌘S</MenubarShortcut>
|
|
433
901
|
* </MenubarItem>
|
|
902
|
+
*
|
|
903
|
+
* // Platform-specific shortcuts
|
|
904
|
+
* <MenubarItem>
|
|
905
|
+
* Copy
|
|
906
|
+
* <MenubarShortcut>{isMac ? '⌘C' : 'Ctrl+C'}</MenubarShortcut>
|
|
907
|
+
* </MenubarItem>
|
|
434
908
|
* ```
|
|
435
909
|
*/
|
|
436
910
|
function MenubarShortcut({
|
|
@@ -453,9 +927,18 @@ function MenubarShortcut({
|
|
|
453
927
|
* Container for a submenu.
|
|
454
928
|
*
|
|
455
929
|
* Wraps MenubarSubTrigger and MenubarSubContent to create
|
|
456
|
-
* nested menu structures.
|
|
930
|
+
* nested menu structures. Supports controlled and uncontrolled states.
|
|
931
|
+
*
|
|
932
|
+
* @param open - The controlled open state of the sub menu. Must be used in conjunction with onOpenChange
|
|
933
|
+
* @param defaultOpen - The open state of the submenu when it is initially rendered. Use when you do not need to control its open state
|
|
934
|
+
* @param onOpenChange - Event handler called when the open state of the submenu changes
|
|
935
|
+
* @param props - Additional props from Radix UI Menubar Sub
|
|
936
|
+
*
|
|
937
|
+
* @accessibility
|
|
938
|
+
* - Right arrow key opens submenu from trigger
|
|
939
|
+
* - Left arrow key closes submenu and returns focus to trigger
|
|
940
|
+
* - Focus is managed automatically between parent and child menus
|
|
457
941
|
*
|
|
458
|
-
* @param props - All props from Radix UI Menubar Sub
|
|
459
942
|
* @example
|
|
460
943
|
* ```tsx
|
|
461
944
|
* <MenubarSub>
|
|
@@ -463,8 +946,15 @@ function MenubarShortcut({
|
|
|
463
946
|
* <MenubarSubContent>
|
|
464
947
|
* <MenubarItem>Export as PDF</MenubarItem>
|
|
465
948
|
* <MenubarItem>Export as CSV</MenubarItem>
|
|
949
|
+
* <MenubarItem>Export as JSON</MenubarItem>
|
|
466
950
|
* </MenubarSubContent>
|
|
467
951
|
* </MenubarSub>
|
|
952
|
+
*
|
|
953
|
+
* // Controlled submenu
|
|
954
|
+
* <MenubarSub open={exportOpen} onOpenChange={setExportOpen}>
|
|
955
|
+
* <MenubarSubTrigger>Export</MenubarSubTrigger>
|
|
956
|
+
* <MenubarSubContent>...</MenubarSubContent>
|
|
957
|
+
* </MenubarSub>
|
|
468
958
|
* ```
|
|
469
959
|
*/
|
|
470
960
|
function MenubarSub({
|
|
@@ -478,11 +968,27 @@ function MenubarSub({
|
|
|
478
968
|
*
|
|
479
969
|
* Automatically includes a right arrow indicator to show
|
|
480
970
|
* that it opens a submenu when hovered or focused.
|
|
971
|
+
* Opens submenu on hover or right arrow key press.
|
|
481
972
|
*
|
|
482
|
-
* @param className - Additional CSS classes to apply
|
|
973
|
+
* @param className - Additional CSS classes to apply to the sub-trigger
|
|
483
974
|
* @param inset - Whether to add left padding for alignment with items that have icons
|
|
484
975
|
* @param children - The content of the sub-trigger
|
|
485
|
-
* @param
|
|
976
|
+
* @param disabled - When true, prevents the user from interacting with the item
|
|
977
|
+
* @param textValue - Optional text used for typeahead purposes when content is complex
|
|
978
|
+
* @param props - Additional props from Radix UI Menubar SubTrigger
|
|
979
|
+
*
|
|
980
|
+
* @accessibility
|
|
981
|
+
* - Right arrow key opens the submenu
|
|
982
|
+
* - Enter or Space also opens the submenu
|
|
983
|
+
* - Focus moves to first item in submenu when opened
|
|
984
|
+
* - Visual arrow indicator shows submenu availability
|
|
985
|
+
*
|
|
986
|
+
* @example
|
|
987
|
+
* ```tsx
|
|
988
|
+
* <MenubarSubTrigger>
|
|
989
|
+
* Recent Files
|
|
990
|
+
* </MenubarSubTrigger>
|
|
991
|
+
* ```
|
|
486
992
|
*/
|
|
487
993
|
function MenubarSubTrigger({
|
|
488
994
|
className,
|
|
@@ -513,9 +1019,36 @@ function MenubarSubTrigger({
|
|
|
513
1019
|
*
|
|
514
1020
|
* Contains the menu items that appear when a MenubarSubTrigger
|
|
515
1021
|
* is hovered or focused. Supports all the same content as MenubarContent.
|
|
1022
|
+
* Automatically positioned to avoid viewport collisions.
|
|
1023
|
+
*
|
|
1024
|
+
* @param className - Additional CSS classes to apply to the sub-content container
|
|
1025
|
+
* @param align - The preferred alignment against the trigger. May change when collisions occur
|
|
1026
|
+
* @param alignOffset - An offset in pixels from the "start" or "end" alignment options
|
|
1027
|
+
* @param sideOffset - The distance in pixels from the trigger
|
|
1028
|
+
* @param side - The preferred side of the trigger to render against when open
|
|
1029
|
+
* @param avoidCollisions - When true, overrides the side and align preferences to prevent collisions with viewport edges
|
|
1030
|
+
* @param collisionBoundary - The element used as the collision boundary for positioning
|
|
1031
|
+
* @param loop - Whether keyboard navigation should loop from last item to first, and vice versa
|
|
1032
|
+
* @param onEscapeKeyDown - Event handler called when the escape key is down
|
|
1033
|
+
* @param onPointerDownOutside - Event handler called when a pointerdown event happens outside of the component
|
|
1034
|
+
* @param onFocusOutside - Event handler called when focus moves outside of the component
|
|
1035
|
+
* @param onInteractOutside - Event handler called when an interaction happens outside the component
|
|
1036
|
+
* @param props - Additional props from Radix UI Menubar SubContent
|
|
1037
|
+
*
|
|
1038
|
+
* @accessibility
|
|
1039
|
+
* - Left arrow key closes submenu and returns focus to trigger
|
|
1040
|
+
* - Arrow keys navigate within submenu items
|
|
1041
|
+
* - Escape key closes entire menu hierarchy
|
|
1042
|
+
* - Focus is trapped within submenu when open
|
|
516
1043
|
*
|
|
517
|
-
* @
|
|
518
|
-
*
|
|
1044
|
+
* @example
|
|
1045
|
+
* ```tsx
|
|
1046
|
+
* <MenubarSubContent>
|
|
1047
|
+
* <MenubarItem>document1.txt</MenubarItem>
|
|
1048
|
+
* <MenubarItem>document2.txt</MenubarItem>
|
|
1049
|
+
* <MenubarItem>document3.txt</MenubarItem>
|
|
1050
|
+
* </MenubarSubContent>
|
|
1051
|
+
* ```
|
|
519
1052
|
*/
|
|
520
1053
|
function MenubarSubContent({
|
|
521
1054
|
className,
|