moi-computer 0.11.0 → 0.11.1-next.1

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.
Files changed (196) hide show
  1. package/client/AGENTS.md +2 -2
  2. package/client/components/ui/button.tsx +1 -53
  3. package/client/components/ui/collapsible.tsx +1 -15
  4. package/client/components/ui/dialog.tsx +1 -58
  5. package/client/components/ui/dropdown-menu.tsx +1 -254
  6. package/client/components/ui/hover-card.tsx +1 -44
  7. package/client/components/ui/input.tsx +1 -21
  8. package/client/components/ui/popover.tsx +1 -88
  9. package/client/components/ui/resizable.tsx +1 -40
  10. package/client/components/ui/skeleton.tsx +1 -13
  11. package/client/components/ui/slider.tsx +1 -70
  12. package/client/components/ui/spinner.tsx +1 -18
  13. package/client/components/ui/switch.tsx +1 -23
  14. package/client/components/ui/tabs.tsx +1 -0
  15. package/client/components/ui/textarea.tsx +1 -18
  16. package/client/components/ui/tooltip.tsx +1 -51
  17. package/client/features/chat/ChatPanel.tsx +6 -6
  18. package/client/features/chat/ChatPopup.tsx +3 -4
  19. package/client/features/chat/TurnView.tsx +5 -4
  20. package/client/features/chat/api.ts +5 -14
  21. package/client/features/chat/chat-frames.ts +5 -2
  22. package/client/features/chat/composer/ChatComposer.tsx +5 -1
  23. package/client/features/chat/composer/ModelPicker.tsx +4 -3
  24. package/client/features/chat/composer/banners/ErrorBanner.tsx +20 -12
  25. package/client/features/chat/composer/useWorkspaceComposerState.tsx +15 -7
  26. package/client/features/chat/group-turns.ts +11 -0
  27. package/client/features/chat/session-view.ts +53 -0
  28. package/client/features/chat/useChat.ts +5 -1
  29. package/client/features/dev/ChatStatesPage.tsx +3 -1
  30. package/client/features/dev/DevIndexPage.tsx +5 -0
  31. package/client/features/dev/DevRoutes.tsx +2 -0
  32. package/client/features/dev/HarnessDebugPage.tsx +1 -1
  33. package/client/features/dev/UiComponentPreviews.tsx +834 -0
  34. package/client/features/dev/UiComponentsPage.tsx +60 -0
  35. package/client/features/home/WorkspacePreview.tsx +1 -1
  36. package/client/features/home/workspace-setup/DemoDialog.tsx +3 -2
  37. package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +5 -8
  38. package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +7 -20
  39. package/client/features/settings/SettingsLayout.tsx +1 -1
  40. package/client/features/settings/WorkspaceSettings.tsx +4 -1
  41. package/client/features/views/ViewManager.tsx +14 -9
  42. package/client/features/widgets/WidgetFrame.tsx +1 -1
  43. package/client/features/widgets/Widgets.tsx +1 -3
  44. package/client/features/workspace/WorkspaceScreen.tsx +5 -1
  45. package/client/features/workspace/WorkspaceSplitLayout.tsx +6 -1
  46. package/client/features/workspace/api.ts +2 -4
  47. package/client/index.css +22 -29
  48. package/dist/{chunk-tny85yt2.js → chunk-4s15axjs.js} +2 -2
  49. package/dist/{chunk-c9pjqx9m.js → chunk-53a7pxcz.js} +1 -1
  50. package/dist/chunk-6664vxpk.css +1 -0
  51. package/dist/{chunk-104m57qw.js → chunk-87thzbtw.js} +2 -2
  52. package/dist/chunk-a6jad1a6.js +1 -0
  53. package/dist/chunk-dghwstd2.js +9 -0
  54. package/dist/chunk-eg120aca.js +1 -0
  55. package/dist/{chunk-v7wr1df4.js → chunk-j3wvxjr7.js} +1 -1
  56. package/dist/chunk-vwjeezeb.js +1 -0
  57. package/dist/chunk-w482ew2c.js +546 -0
  58. package/dist/chunk-yc471zah.js +70 -0
  59. package/dist/index.html +1 -1
  60. package/lib/format.ts +49 -1
  61. package/lib/themes.ts +6 -6
  62. package/lib/types.ts +5 -7
  63. package/package.json +17 -7
  64. package/registry.json +643 -0
  65. package/server/AGENTS.md +1 -0
  66. package/server/agent.ts +1 -1
  67. package/server/api.ts +25 -29
  68. package/server/applets.ts +30 -29
  69. package/server/bundler/applet-css.ts +6 -1
  70. package/server/bundler/build-applet.ts +5 -1
  71. package/server/bundler/build-worker.ts +178 -0
  72. package/server/cli-ui-components.ts +28 -33
  73. package/server/cli.ts +6 -11
  74. package/server/data-dir.ts +1 -1
  75. package/server/harness/README.md +13 -9
  76. package/server/harness/acp/NOTES.md +426 -0
  77. package/server/harness/acp/discovery.ts +27 -30
  78. package/server/harness/acp/model-state.ts +57 -0
  79. package/server/harness/acp/session.ts +18 -6
  80. package/server/harness/claude-code/NOTES.md +47 -12
  81. package/server/harness/claude-code/cli.ts +40 -0
  82. package/server/harness/claude-code/index.ts +11 -5
  83. package/server/harness/claude-code/models.ts +72 -19
  84. package/server/harness/claude-code/session.ts +408 -299
  85. package/server/harness/hermes/NOTES.md +18 -0
  86. package/server/harness/hermes/discovery.ts +20 -0
  87. package/server/harness/hermes/index.ts +9 -0
  88. package/server/harness/hermes/models.ts +28 -8
  89. package/server/harness/types.ts +4 -2
  90. package/server/moi-scaffold.ts +1 -1
  91. package/server/preview.ts +3 -1
  92. package/server/registry.ts +63 -41
  93. package/server/scratchpad-executor.ts +79 -56
  94. package/server/scratchpad-shape-defaults.ts +82 -0
  95. package/server/tldraw-package.d.ts +4 -0
  96. package/server/ui-components.ts +101 -434
  97. package/server/view-builders.ts +2 -1
  98. package/server/web.ts +9 -5
  99. package/server/workspace-env.ts +3 -2
  100. package/tsconfig.json +0 -1
  101. package/ui-components/accordion.tsx +71 -0
  102. package/ui-components/alert-dialog.tsx +165 -0
  103. package/ui-components/alert.tsx +68 -0
  104. package/ui-components/attachment.tsx +195 -0
  105. package/ui-components/avatar.tsx +90 -0
  106. package/ui-components/badge.tsx +49 -0
  107. package/ui-components/button-group.tsx +78 -0
  108. package/ui-components/button.tsx +55 -0
  109. package/ui-components/calendar.tsx +180 -0
  110. package/ui-components/card.tsx +84 -0
  111. package/ui-components/carousel.tsx +235 -0
  112. package/ui-components/chart.tsx +338 -0
  113. package/ui-components/checkbox.tsx +27 -0
  114. package/ui-components/collapsible.tsx +15 -0
  115. package/ui-components/combobox.tsx +265 -0
  116. package/ui-components/context-menu.tsx +244 -0
  117. package/ui-components/dialog.tsx +138 -0
  118. package/ui-components/docs/accordion.md +463 -0
  119. package/ui-components/docs/alert-dialog.md +481 -0
  120. package/ui-components/docs/alert.md +301 -0
  121. package/ui-components/docs/attachment.md +689 -0
  122. package/ui-components/docs/avatar.md +495 -0
  123. package/ui-components/docs/badge.md +258 -0
  124. package/ui-components/docs/button-group.md +879 -0
  125. package/ui-components/docs/button.md +26 -0
  126. package/ui-components/docs/calendar.md +862 -0
  127. package/ui-components/docs/card.md +265 -0
  128. package/ui-components/docs/carousel.md +627 -0
  129. package/ui-components/docs/chart.md +1256 -0
  130. package/ui-components/docs/checkbox.md +477 -0
  131. package/ui-components/docs/collapsible.md +446 -0
  132. package/ui-components/docs/combobox.md +1003 -0
  133. package/ui-components/docs/context-menu.md +860 -0
  134. package/ui-components/docs/data-table.md +1580 -0
  135. package/ui-components/docs/date-picker.md +614 -0
  136. package/ui-components/docs/dialog.md +414 -0
  137. package/ui-components/docs/drawer.md +51 -0
  138. package/ui-components/docs/dropdown-menu.md +1000 -0
  139. package/ui-components/docs/field.md +1192 -0
  140. package/ui-components/docs/hover-card.md +275 -0
  141. package/ui-components/docs/input-group.md +866 -0
  142. package/ui-components/docs/input.md +456 -0
  143. package/ui-components/docs/label.md +295 -0
  144. package/ui-components/docs/pagination.md +416 -0
  145. package/ui-components/docs/popover.md +348 -0
  146. package/ui-components/docs/progress.md +214 -0
  147. package/ui-components/docs/radio-group.md +389 -0
  148. package/ui-components/docs/resizable.md +265 -0
  149. package/ui-components/docs/select.md +616 -0
  150. package/ui-components/docs/separator.md +216 -0
  151. package/ui-components/docs/skeleton.md +205 -0
  152. package/ui-components/docs/slider.md +226 -0
  153. package/ui-components/docs/spinner.md +332 -0
  154. package/ui-components/docs/switch.md +236 -0
  155. package/ui-components/docs/table.md +551 -0
  156. package/ui-components/docs/tabs.md +379 -0
  157. package/ui-components/docs/textarea.md +187 -0
  158. package/ui-components/docs/toggle-group.md +370 -0
  159. package/ui-components/docs/toggle.md +91 -0
  160. package/ui-components/docs/tooltip.md +290 -0
  161. package/ui-components/drawer.tsx +213 -0
  162. package/ui-components/dropdown-menu.tsx +263 -0
  163. package/ui-components/field.tsx +224 -0
  164. package/ui-components/hover-card.tsx +46 -0
  165. package/ui-components/input-group.tsx +146 -0
  166. package/ui-components/input.tsx +20 -0
  167. package/ui-components/label.tsx +17 -0
  168. package/ui-components/pagination.tsx +124 -0
  169. package/ui-components/popover.tsx +81 -0
  170. package/ui-components/progress.tsx +63 -0
  171. package/ui-components/radio-group.tsx +37 -0
  172. package/ui-components/resizable.tsx +40 -0
  173. package/ui-components/scoped-portal.tsx +31 -0
  174. package/ui-components/select.tsx +195 -0
  175. package/ui-components/separator.tsx +18 -0
  176. package/ui-components/skeleton.tsx +15 -0
  177. package/ui-components/slider.tsx +75 -0
  178. package/ui-components/spinner.tsx +20 -0
  179. package/ui-components/switch.tsx +26 -0
  180. package/ui-components/table.tsx +86 -0
  181. package/ui-components/tabs.tsx +75 -0
  182. package/ui-components/textarea.tsx +17 -0
  183. package/ui-components/toggle-group.tsx +85 -0
  184. package/ui-components/toggle.tsx +42 -0
  185. package/ui-components/tooltip.tsx +61 -0
  186. package/ui-components/utils.ts +8 -0
  187. package/workspace/.claude/skills/moi-workspace/SKILL.md +11 -20
  188. package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +4 -3
  189. package/workspace/.claude/skills/moi-workspace/references/UI-COMPONENTS.md +67 -203
  190. package/dist/chunk-59zf0m6n.js +0 -1
  191. package/dist/chunk-bj3akjs2.js +0 -1
  192. package/dist/chunk-j2w2vak4.js +0 -546
  193. package/dist/chunk-k2r9c95m.js +0 -10
  194. package/dist/chunk-kmbxhgwv.js +0 -1
  195. package/dist/chunk-p1yqa71k.js +0 -83
  196. package/dist/chunk-r5xrenjy.css +0 -1
@@ -0,0 +1,879 @@
1
+ ---
2
+ title: Button Group
3
+ description: A container that groups related buttons together with consistent styling.
4
+ base: base
5
+ component: true
6
+ ---
7
+
8
+ ```tsx
9
+ 'use client'
10
+
11
+ import * as React from 'react'
12
+ import {
13
+ IconArchive,
14
+ IconArrowLeft,
15
+ IconCalendarPlus,
16
+ IconClock,
17
+ IconFilter,
18
+ IconMailCheck,
19
+ IconDots,
20
+ IconTag,
21
+ IconTrash
22
+ } from '@tabler/icons-react'
23
+
24
+ import { Button } from '@/components/ui/button'
25
+ import { ButtonGroup } from '@/components/ui/button-group'
26
+ import {
27
+ DropdownMenu,
28
+ DropdownMenuContent,
29
+ DropdownMenuGroup,
30
+ DropdownMenuItem,
31
+ DropdownMenuRadioGroup,
32
+ DropdownMenuRadioItem,
33
+ DropdownMenuSeparator,
34
+ DropdownMenuSub,
35
+ DropdownMenuSubContent,
36
+ DropdownMenuSubTrigger,
37
+ DropdownMenuTrigger
38
+ } from '@/components/ui/dropdown-menu'
39
+
40
+ export function ButtonGroupDemo() {
41
+ const [label, setLabel] = React.useState('personal')
42
+
43
+ return (
44
+ <ButtonGroup>
45
+ <ButtonGroup className="hidden sm:flex">
46
+ <Button variant="outline" size="icon" aria-label="Go Back">
47
+ <IconArrowLeft stroke={1.5} />
48
+ </Button>
49
+ </ButtonGroup>
50
+ <ButtonGroup>
51
+ <Button variant="outline">Archive</Button>
52
+ <Button variant="outline">Report</Button>
53
+ </ButtonGroup>
54
+ <ButtonGroup>
55
+ <Button variant="outline">Snooze</Button>
56
+ <DropdownMenu>
57
+ <DropdownMenuTrigger
58
+ render={<Button variant="outline" size="icon" aria-label="More Options" />}
59
+ >
60
+ <IconDots stroke={1.5} />
61
+ </DropdownMenuTrigger>
62
+ <DropdownMenuContent align="end" className="w-40">
63
+ <DropdownMenuGroup>
64
+ <DropdownMenuItem>
65
+ <IconMailCheck stroke={1.75} />
66
+ Mark as Read
67
+ </DropdownMenuItem>
68
+ <DropdownMenuItem>
69
+ <IconArchive stroke={1.75} />
70
+ Archive
71
+ </DropdownMenuItem>
72
+ </DropdownMenuGroup>
73
+ <DropdownMenuSeparator />
74
+ <DropdownMenuGroup>
75
+ <DropdownMenuItem>
76
+ <IconClock stroke={1.75} />
77
+ Snooze
78
+ </DropdownMenuItem>
79
+ <DropdownMenuItem>
80
+ <IconCalendarPlus stroke={1.75} />
81
+ Add to Calendar
82
+ </DropdownMenuItem>
83
+ <DropdownMenuItem>
84
+ <IconFilter stroke={1.75} />
85
+ Add to List
86
+ </DropdownMenuItem>
87
+ <DropdownMenuSub>
88
+ <DropdownMenuSubTrigger>
89
+ <IconTag stroke={1.75} />
90
+ Label As...
91
+ </DropdownMenuSubTrigger>
92
+ <DropdownMenuSubContent>
93
+ <DropdownMenuRadioGroup value={label} onValueChange={setLabel}>
94
+ <DropdownMenuRadioItem value="personal">Personal</DropdownMenuRadioItem>
95
+ <DropdownMenuRadioItem value="work">Work</DropdownMenuRadioItem>
96
+ <DropdownMenuRadioItem value="other">Other</DropdownMenuRadioItem>
97
+ </DropdownMenuRadioGroup>
98
+ </DropdownMenuSubContent>
99
+ </DropdownMenuSub>
100
+ </DropdownMenuGroup>
101
+ <DropdownMenuSeparator />
102
+ <DropdownMenuGroup>
103
+ <DropdownMenuItem variant="destructive">
104
+ <IconTrash stroke={1.75} />
105
+ Trash
106
+ </DropdownMenuItem>
107
+ </DropdownMenuGroup>
108
+ </DropdownMenuContent>
109
+ </DropdownMenu>
110
+ </ButtonGroup>
111
+ </ButtonGroup>
112
+ )
113
+ }
114
+ ```
115
+
116
+ ## Installation
117
+
118
+ <CodeTabs>
119
+
120
+ <TabsList>
121
+ <TabsTrigger value="cli">Command</TabsTrigger>
122
+ <TabsTrigger value="manual">Manual</TabsTrigger>
123
+ </TabsList>
124
+ <TabsContent value="cli">
125
+
126
+ ```bash
127
+ moi ui-components add button-group
128
+ ```
129
+
130
+ </TabsContent>
131
+
132
+ <TabsContent value="manual">
133
+
134
+ <Steps className="mb-0 pt-2">
135
+
136
+ <Step>Install the following dependencies:</Step>
137
+
138
+ ```bash
139
+ npm install @base-ui/react
140
+ ```
141
+
142
+ <Step>Copy and paste the following code into your project.</Step>
143
+
144
+ <ComponentSource
145
+ name="button-group"
146
+ title="components/ui/button-group.tsx"
147
+ styleName="base-nova"
148
+ />
149
+
150
+ <Step>Update the import paths to match your project setup.</Step>
151
+
152
+ </Steps>
153
+
154
+ </TabsContent>
155
+
156
+ </CodeTabs>
157
+
158
+ ## Usage
159
+
160
+ ```tsx
161
+ import { ButtonGroup, ButtonGroupSeparator, ButtonGroupText } from '@/components/ui/button-group'
162
+ ```
163
+
164
+ ```tsx
165
+ <ButtonGroup>
166
+ <Button>Button 1</Button>
167
+ <Button>Button 2</Button>
168
+ </ButtonGroup>
169
+ ```
170
+
171
+ ## Composition
172
+
173
+ Use the following composition to build a `ButtonGroup`:
174
+
175
+ ```text
176
+ ButtonGroup
177
+ ├── Button or Input
178
+ ├── ButtonGroupSeparator
179
+ └── ButtonGroupText
180
+ ```
181
+
182
+ ## Accessibility
183
+
184
+ - The `ButtonGroup` component has the `role` attribute set to `group`.
185
+ - Use <Kbd>Tab</Kbd> to navigate between the buttons in the group.
186
+ - Use `aria-label` or `aria-labelledby` to label the button group.
187
+
188
+ ```tsx showLineNumbers
189
+ <ButtonGroup aria-label="Button group">
190
+ <Button>Button 1</Button>
191
+ <Button>Button 2</Button>
192
+ </ButtonGroup>
193
+ ```
194
+
195
+ ## ButtonGroup vs ToggleGroup
196
+
197
+ - Use the `ButtonGroup` component when you want to group buttons that perform an action.
198
+ - Use the `ToggleGroup` component when you want to group buttons that toggle a state.
199
+
200
+ ## Orientation
201
+
202
+ Set the `orientation` prop to change the button group layout.
203
+
204
+ ```tsx
205
+ import { IconMinus, IconPlus } from '@tabler/icons-react'
206
+
207
+ import { Button } from '@/components/ui/button'
208
+ import { ButtonGroup } from '@/components/ui/button-group'
209
+
210
+ export function ButtonGroupOrientation() {
211
+ return (
212
+ <ButtonGroup orientation="vertical" aria-label="Media controls" className="h-fit">
213
+ <Button variant="outline" size="icon">
214
+ <IconPlus stroke={1.5} />
215
+ </Button>
216
+ <Button variant="outline" size="icon">
217
+ <IconMinus stroke={1.5} />
218
+ </Button>
219
+ </ButtonGroup>
220
+ )
221
+ }
222
+ ```
223
+
224
+ ## Size
225
+
226
+ Control the size of buttons using the `size` prop on individual buttons.
227
+
228
+ ```tsx
229
+ import { IconPlus } from '@tabler/icons-react'
230
+
231
+ import { Button } from '@/components/ui/button'
232
+ import { ButtonGroup } from '@/components/ui/button-group'
233
+
234
+ export function ButtonGroupSize() {
235
+ return (
236
+ <div className="flex flex-col items-start gap-8">
237
+ <ButtonGroup>
238
+ <Button variant="outline" size="sm">
239
+ Small
240
+ </Button>
241
+ <Button variant="outline" size="sm">
242
+ Button
243
+ </Button>
244
+ <Button variant="outline" size="sm">
245
+ Group
246
+ </Button>
247
+ <Button variant="outline" size="icon-sm">
248
+ <IconPlus stroke={1.75} />
249
+ </Button>
250
+ </ButtonGroup>
251
+ <ButtonGroup>
252
+ <Button variant="outline">Default</Button>
253
+ <Button variant="outline">Button</Button>
254
+ <Button variant="outline">Group</Button>
255
+ <Button variant="outline" size="icon">
256
+ <IconPlus stroke={1.5} />
257
+ </Button>
258
+ </ButtonGroup>
259
+ <ButtonGroup>
260
+ <Button variant="outline" size="lg">
261
+ Large
262
+ </Button>
263
+ <Button variant="outline" size="lg">
264
+ Button
265
+ </Button>
266
+ <Button variant="outline" size="lg">
267
+ Group
268
+ </Button>
269
+ <Button variant="outline" size="icon-lg">
270
+ <IconPlus stroke={1.5} />
271
+ </Button>
272
+ </ButtonGroup>
273
+ </div>
274
+ )
275
+ }
276
+ ```
277
+
278
+ ## Nested
279
+
280
+ Nest `<ButtonGroup>` components to create button groups with spacing.
281
+
282
+ ```tsx
283
+ import { IconWaveSine, IconPlus } from '@tabler/icons-react'
284
+
285
+ import { Button } from '@/components/ui/button'
286
+ import { ButtonGroup } from '@/components/ui/button-group'
287
+ import { Input } from '@/components/ui/input'
288
+ import { InputGroup, InputGroupAddon, InputGroupInput } from '@/components/ui/input-group'
289
+ import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
290
+
291
+ export function ButtonGroupNested() {
292
+ return (
293
+ <ButtonGroup>
294
+ <ButtonGroup>
295
+ <Button variant="outline" size="icon">
296
+ <IconPlus stroke={1.5} />
297
+ </Button>
298
+ </ButtonGroup>
299
+ <ButtonGroup>
300
+ <InputGroup>
301
+ <InputGroupInput placeholder="Send a message..." />
302
+ <Tooltip>
303
+ <TooltipTrigger render={<InputGroupAddon align="inline-end" />}>
304
+ <IconWaveSine stroke={1.75} />
305
+ </TooltipTrigger>
306
+ <TooltipContent>Voice Mode</TooltipContent>
307
+ </Tooltip>
308
+ </InputGroup>
309
+ </ButtonGroup>
310
+ </ButtonGroup>
311
+ )
312
+ }
313
+ ```
314
+
315
+ ## Separator
316
+
317
+ The `ButtonGroupSeparator` component visually divides buttons within a group.
318
+
319
+ Buttons with variant `outline` do not need a separator since they have a border. For other variants, a separator is recommended to improve the visual hierarchy.
320
+
321
+ ```tsx
322
+ import { Button } from '@/components/ui/button'
323
+ import { ButtonGroup, ButtonGroupSeparator } from '@/components/ui/button-group'
324
+
325
+ export function ButtonGroupSeparatorDemo() {
326
+ return (
327
+ <ButtonGroup>
328
+ <Button variant="secondary" size="sm">
329
+ Copy
330
+ </Button>
331
+ <ButtonGroupSeparator />
332
+ <Button variant="secondary" size="sm">
333
+ Paste
334
+ </Button>
335
+ </ButtonGroup>
336
+ )
337
+ }
338
+ ```
339
+
340
+ ## Split
341
+
342
+ Create a split button group by adding two buttons separated by a `ButtonGroupSeparator`.
343
+
344
+ ```tsx
345
+ import { IconPlus } from '@tabler/icons-react'
346
+
347
+ import { Button } from '@/components/ui/button'
348
+ import { ButtonGroup, ButtonGroupSeparator } from '@/components/ui/button-group'
349
+
350
+ export function ButtonGroupSplit() {
351
+ return (
352
+ <ButtonGroup>
353
+ <Button variant="secondary">Button</Button>
354
+ <ButtonGroupSeparator />
355
+ <Button size="icon" variant="secondary">
356
+ <IconPlus stroke={1.5} />
357
+ </Button>
358
+ </ButtonGroup>
359
+ )
360
+ }
361
+ ```
362
+
363
+ ## Input
364
+
365
+ Wrap an `Input` component with buttons.
366
+
367
+ ```tsx
368
+ import { IconSearch } from '@tabler/icons-react'
369
+
370
+ import { Button } from '@/components/ui/button'
371
+ import { ButtonGroup } from '@/components/ui/button-group'
372
+ import { Input } from '@/components/ui/input'
373
+
374
+ export function ButtonGroupInput() {
375
+ return (
376
+ <ButtonGroup>
377
+ <Input placeholder="Search..." />
378
+ <Button variant="outline" aria-label="Search">
379
+ <IconSearch stroke={1.5} />
380
+ </Button>
381
+ </ButtonGroup>
382
+ )
383
+ }
384
+ ```
385
+
386
+ ## Input Group
387
+
388
+ Wrap an `InputGroup` component to create complex input layouts.
389
+
390
+ ```tsx
391
+ 'use client'
392
+
393
+ import * as React from 'react'
394
+ import { IconWaveSine, IconPlus } from '@tabler/icons-react'
395
+
396
+ import { Button } from '@/components/ui/button'
397
+ import { ButtonGroup } from '@/components/ui/button-group'
398
+ import {
399
+ InputGroup,
400
+ InputGroupAddon,
401
+ InputGroupButton,
402
+ InputGroupInput
403
+ } from '@/components/ui/input-group'
404
+ import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
405
+
406
+ export function ButtonGroupInputGroup() {
407
+ const [voiceEnabled, setVoiceEnabled] = React.useState(false)
408
+
409
+ return (
410
+ <ButtonGroup className="[--radius:9999rem]">
411
+ <ButtonGroup>
412
+ <Button variant="outline" size="icon">
413
+ <IconPlus stroke={1.5} />
414
+ </Button>
415
+ </ButtonGroup>
416
+ <ButtonGroup>
417
+ <InputGroup>
418
+ <InputGroupInput
419
+ placeholder={voiceEnabled ? 'Record and send audio...' : 'Send a message...'}
420
+ disabled={voiceEnabled}
421
+ />
422
+ <InputGroupAddon align="inline-end">
423
+ <Tooltip>
424
+ <TooltipTrigger
425
+ render={
426
+ <InputGroupButton
427
+ onClick={() => setVoiceEnabled(!voiceEnabled)}
428
+ size="icon-xs"
429
+ data-active={voiceEnabled}
430
+ className="data-[active=true]:bg-orange-100 data-[active=true]:text-orange-700 dark:data-[active=true]:bg-orange-800 dark:data-[active=true]:text-orange-100"
431
+ aria-pressed={voiceEnabled}
432
+ />
433
+ }
434
+ >
435
+ <IconWaveSine stroke={1.5} />
436
+ </TooltipTrigger>
437
+ <TooltipContent>Voice Mode</TooltipContent>
438
+ </Tooltip>
439
+ </InputGroupAddon>
440
+ </InputGroup>
441
+ </ButtonGroup>
442
+ </ButtonGroup>
443
+ )
444
+ }
445
+ ```
446
+
447
+ ## Dropdown Menu
448
+
449
+ Create a split button group with a `DropdownMenu` component.
450
+
451
+ ```tsx
452
+ 'use client'
453
+
454
+ import {
455
+ IconAlertTriangle,
456
+ IconCheck,
457
+ IconChevronDown,
458
+ IconCopy,
459
+ IconShare,
460
+ IconTrash,
461
+ IconUserX,
462
+ IconVolumeOff
463
+ } from '@tabler/icons-react'
464
+
465
+ import { Button } from '@/components/ui/button'
466
+ import { ButtonGroup } from '@/components/ui/button-group'
467
+ import {
468
+ DropdownMenu,
469
+ DropdownMenuContent,
470
+ DropdownMenuGroup,
471
+ DropdownMenuItem,
472
+ DropdownMenuSeparator,
473
+ DropdownMenuTrigger
474
+ } from '@/components/ui/dropdown-menu'
475
+
476
+ export function ButtonGroupDropdown() {
477
+ return (
478
+ <ButtonGroup>
479
+ <Button variant="outline">Follow</Button>
480
+ <DropdownMenu>
481
+ <DropdownMenuTrigger render={<Button variant="outline" className="pl-2!" />}>
482
+ <IconChevronDown stroke={1.5} />
483
+ </DropdownMenuTrigger>
484
+ <DropdownMenuContent align="end" className="w-44">
485
+ <DropdownMenuGroup>
486
+ <DropdownMenuItem>
487
+ <IconVolumeOff stroke={1.75} />
488
+ Mute Conversation
489
+ </DropdownMenuItem>
490
+ <DropdownMenuItem>
491
+ <IconCheck stroke={1.75} />
492
+ Mark as Read
493
+ </DropdownMenuItem>
494
+ <DropdownMenuItem>
495
+ <IconAlertTriangle stroke={1.75} />
496
+ Report Conversation
497
+ </DropdownMenuItem>
498
+ <DropdownMenuItem>
499
+ <IconUserX stroke={1.75} />
500
+ Block User
501
+ </DropdownMenuItem>
502
+ <DropdownMenuItem>
503
+ <IconShare stroke={1.75} />
504
+ Share Conversation
505
+ </DropdownMenuItem>
506
+ <DropdownMenuItem>
507
+ <IconCopy stroke={1.75} />
508
+ Copy Conversation
509
+ </DropdownMenuItem>
510
+ </DropdownMenuGroup>
511
+ <DropdownMenuSeparator />
512
+ <DropdownMenuGroup>
513
+ <DropdownMenuItem variant="destructive">
514
+ <IconTrash stroke={1.75} />
515
+ Delete Conversation
516
+ </DropdownMenuItem>
517
+ </DropdownMenuGroup>
518
+ </DropdownMenuContent>
519
+ </DropdownMenu>
520
+ </ButtonGroup>
521
+ )
522
+ }
523
+ ```
524
+
525
+ ## Select
526
+
527
+ Pair with a `Select` component.
528
+
529
+ ```tsx
530
+ 'use client'
531
+
532
+ import * as React from 'react'
533
+ import { IconArrowRight } from '@tabler/icons-react'
534
+
535
+ import { Button } from '@/components/ui/button'
536
+ import { ButtonGroup } from '@/components/ui/button-group'
537
+ import { Input } from '@/components/ui/input'
538
+ import {
539
+ Select,
540
+ SelectContent,
541
+ SelectGroup,
542
+ SelectItem,
543
+ SelectTrigger
544
+ } from '@/components/ui/select'
545
+
546
+ const CURRENCIES = [
547
+ { label: 'US Dollar', value: '$' },
548
+ { label: 'Euro', value: '€' },
549
+ { label: 'British Pound', value: '£' }
550
+ ]
551
+
552
+ export function ButtonGroupSelect() {
553
+ const [currency, setCurrency] = React.useState('$')
554
+
555
+ return (
556
+ <ButtonGroup>
557
+ <ButtonGroup>
558
+ <Select
559
+ items={CURRENCIES}
560
+ value={currency}
561
+ onValueChange={value => setCurrency(value as string)}
562
+ >
563
+ <SelectTrigger className="font-mono">{currency}</SelectTrigger>
564
+ <SelectContent alignItemWithTrigger={false} align="start">
565
+ <SelectGroup>
566
+ {CURRENCIES.map(item => (
567
+ <SelectItem key={item.value} value={item.value}>
568
+ {item.value} <span className="text-muted-foreground">{item.label}</span>
569
+ </SelectItem>
570
+ ))}
571
+ </SelectGroup>
572
+ </SelectContent>
573
+ </Select>
574
+ <Input placeholder="10.00" pattern="[0-9]*" />
575
+ </ButtonGroup>
576
+ <ButtonGroup>
577
+ <Button aria-label="Send" size="icon" variant="outline">
578
+ <IconArrowRight stroke={1.5} />
579
+ </Button>
580
+ </ButtonGroup>
581
+ </ButtonGroup>
582
+ )
583
+ }
584
+ ```
585
+
586
+ ## Popover
587
+
588
+ Use with a `Popover` component.
589
+
590
+ ```tsx
591
+ import { IconRobot, IconChevronDown } from '@tabler/icons-react'
592
+
593
+ import { Button } from '@/components/ui/button'
594
+ import { ButtonGroup } from '@/components/ui/button-group'
595
+ import { Field, FieldDescription, FieldLabel } from '@/components/ui/field'
596
+ import {
597
+ Popover,
598
+ PopoverContent,
599
+ PopoverDescription,
600
+ PopoverHeader,
601
+ PopoverTitle,
602
+ PopoverTrigger
603
+ } from '@/components/ui/popover'
604
+ import { Textarea } from '@/components/ui/textarea'
605
+
606
+ export function ButtonGroupPopover() {
607
+ return (
608
+ <ButtonGroup>
609
+ <Button variant="outline">
610
+ <IconRobot stroke={1.5} /> Copilot
611
+ </Button>
612
+ <Popover>
613
+ <PopoverTrigger render={<Button variant="outline" size="icon" aria-label="Open Popover" />}>
614
+ <IconChevronDown stroke={1.5} />
615
+ </PopoverTrigger>
616
+ <PopoverContent align="end" className="rounded-xl text-sm">
617
+ <PopoverHeader>
618
+ <PopoverTitle>Start a new task with Copilot</PopoverTitle>
619
+ <PopoverDescription>Describe your task in natural language.</PopoverDescription>
620
+ </PopoverHeader>
621
+ <Field>
622
+ <FieldLabel htmlFor="task" className="sr-only">
623
+ Task Description
624
+ </FieldLabel>
625
+ <Textarea id="task" placeholder="I need to..." className="resize-none" />
626
+ <FieldDescription>Copilot will open a pull request for review.</FieldDescription>
627
+ </Field>
628
+ </PopoverContent>
629
+ </Popover>
630
+ </ButtonGroup>
631
+ )
632
+ }
633
+ ```
634
+
635
+ ## RTL
636
+
637
+ ```tsx
638
+ 'use client'
639
+
640
+ import * as React from 'react'
641
+ import {
642
+ IconArchive,
643
+ IconArrowLeft,
644
+ IconCalendarPlus,
645
+ IconClock,
646
+ IconFilter,
647
+ IconMailCheck,
648
+ IconDots,
649
+ IconTag,
650
+ IconTrash
651
+ } from '@tabler/icons-react'
652
+
653
+ import { useTranslation, type Translations } from '@/components/language-selector'
654
+ import { Button } from '@/components/ui/button'
655
+ import { ButtonGroup } from '@/components/ui/button-group'
656
+ import {
657
+ DropdownMenu,
658
+ DropdownMenuContent,
659
+ DropdownMenuGroup,
660
+ DropdownMenuItem,
661
+ DropdownMenuRadioGroup,
662
+ DropdownMenuRadioItem,
663
+ DropdownMenuSeparator,
664
+ DropdownMenuSub,
665
+ DropdownMenuSubContent,
666
+ DropdownMenuSubTrigger,
667
+ DropdownMenuTrigger
668
+ } from '@/components/ui/dropdown-menu'
669
+
670
+ const translations: Translations = {
671
+ en: {
672
+ dir: 'ltr',
673
+ values: {
674
+ archive: 'Archive',
675
+ report: 'Report',
676
+ snooze: 'Snooze',
677
+ markAsRead: 'Mark as Read',
678
+ addToCalendar: 'Add to Calendar',
679
+ addToList: 'Add to List',
680
+ labelAs: 'Label As...',
681
+ personal: 'Personal',
682
+ work: 'Work',
683
+ other: 'Other',
684
+ trash: 'Trash'
685
+ }
686
+ },
687
+ ar: {
688
+ dir: 'rtl',
689
+ values: {
690
+ archive: 'أرشفة',
691
+ report: 'تقرير',
692
+ snooze: 'تأجيل',
693
+ markAsRead: 'وضع علامة كمقروء',
694
+ addToCalendar: 'إضافة إلى التقويم',
695
+ addToList: 'إضافة إلى القائمة',
696
+ labelAs: 'تصنيف كـ...',
697
+ personal: 'شخصي',
698
+ work: 'عمل',
699
+ other: 'آخر',
700
+ trash: 'سلة المهملات'
701
+ }
702
+ },
703
+ he: {
704
+ dir: 'rtl',
705
+ values: {
706
+ archive: 'ארכיון',
707
+ report: 'דוח',
708
+ snooze: 'דחה',
709
+ markAsRead: 'סמן כנקרא',
710
+ addToCalendar: 'הוסף ליומן',
711
+ addToList: 'הוסף לרשימה',
712
+ labelAs: 'תייג כ...',
713
+ personal: 'אישי',
714
+ work: 'עבודה',
715
+ other: 'אחר',
716
+ trash: 'פח'
717
+ }
718
+ }
719
+ }
720
+
721
+ export function ButtonGroupRtl() {
722
+ const { dir, t, language } = useTranslation(translations, 'ar')
723
+ const [label, setLabel] = React.useState('personal')
724
+
725
+ return (
726
+ <div dir={dir}>
727
+ <ButtonGroup>
728
+ <ButtonGroup className="hidden sm:flex">
729
+ <Button variant="outline" size="icon" aria-label="Go Back">
730
+ <IconArrowLeft stroke={1.5} className="rtl:rotate-180" />
731
+ </Button>
732
+ </ButtonGroup>
733
+ <ButtonGroup>
734
+ <Button variant="outline">{t.archive}</Button>
735
+ <Button variant="outline">{t.report}</Button>
736
+ </ButtonGroup>
737
+ <ButtonGroup>
738
+ <Button variant="outline">{t.snooze}</Button>
739
+ <DropdownMenu>
740
+ <DropdownMenuTrigger
741
+ render={<Button variant="outline" size="icon" aria-label="More Options" />}
742
+ >
743
+ <IconDots stroke={1.5} />
744
+ </DropdownMenuTrigger>
745
+ <DropdownMenuContent
746
+ align={dir === 'rtl' ? 'start' : 'end'}
747
+ data-lang={dir === 'rtl' ? language : undefined}
748
+ dir={dir}
749
+ className="w-40"
750
+ >
751
+ <DropdownMenuGroup>
752
+ <DropdownMenuItem>
753
+ <IconMailCheck stroke={1.75} />
754
+ {t.markAsRead}
755
+ </DropdownMenuItem>
756
+ <DropdownMenuItem>
757
+ <IconArchive stroke={1.75} />
758
+ {t.archive}
759
+ </DropdownMenuItem>
760
+ </DropdownMenuGroup>
761
+ <DropdownMenuSeparator />
762
+ <DropdownMenuGroup>
763
+ <DropdownMenuItem>
764
+ <IconClock stroke={1.75} />
765
+ {t.snooze}
766
+ </DropdownMenuItem>
767
+ <DropdownMenuItem>
768
+ <IconCalendarPlus stroke={1.75} />
769
+ {t.addToCalendar}
770
+ </DropdownMenuItem>
771
+ <DropdownMenuItem>
772
+ <IconFilter stroke={1.75} />
773
+ {t.addToList}
774
+ </DropdownMenuItem>
775
+ <DropdownMenuSub>
776
+ <DropdownMenuSubTrigger>
777
+ <IconTag stroke={1.75} />
778
+ {t.labelAs}
779
+ </DropdownMenuSubTrigger>
780
+ <DropdownMenuSubContent
781
+ dir={dir}
782
+ data-lang={dir === 'rtl' ? language : undefined}
783
+ >
784
+ <DropdownMenuRadioGroup value={label} onValueChange={setLabel}>
785
+ <DropdownMenuRadioItem value="personal">{t.personal}</DropdownMenuRadioItem>
786
+ <DropdownMenuRadioItem value="work">{t.work}</DropdownMenuRadioItem>
787
+ <DropdownMenuRadioItem value="other">{t.other}</DropdownMenuRadioItem>
788
+ </DropdownMenuRadioGroup>
789
+ </DropdownMenuSubContent>
790
+ </DropdownMenuSub>
791
+ </DropdownMenuGroup>
792
+ <DropdownMenuSeparator />
793
+ <DropdownMenuGroup>
794
+ <DropdownMenuItem variant="destructive">
795
+ <IconTrash stroke={1.75} />
796
+ {t.trash}
797
+ </DropdownMenuItem>
798
+ </DropdownMenuGroup>
799
+ </DropdownMenuContent>
800
+ </DropdownMenu>
801
+ </ButtonGroup>
802
+ </ButtonGroup>
803
+ </div>
804
+ )
805
+ }
806
+ ```
807
+
808
+ ## API Reference
809
+
810
+ ### ButtonGroup
811
+
812
+ The `ButtonGroup` component is a container that groups related buttons together with consistent styling.
813
+
814
+ | Prop | Type | Default |
815
+ | ------------- | ---------------------------- | -------------- |
816
+ | `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` |
817
+
818
+ ```tsx
819
+ <ButtonGroup>
820
+ <Button>Button 1</Button>
821
+ <Button>Button 2</Button>
822
+ </ButtonGroup>
823
+ ```
824
+
825
+ Nest multiple button groups to create complex layouts with spacing. See the [nested](#nested) example for more details.
826
+
827
+ ```tsx
828
+ <ButtonGroup>
829
+ <ButtonGroup />
830
+ <ButtonGroup />
831
+ </ButtonGroup>
832
+ ```
833
+
834
+ ### ButtonGroupSeparator
835
+
836
+ The `ButtonGroupSeparator` component visually divides buttons within a group.
837
+
838
+ | Prop | Type | Default |
839
+ | ------------- | ---------------------------- | ------------ |
840
+ | `orientation` | `"horizontal" \| "vertical"` | `"vertical"` |
841
+
842
+ ```tsx
843
+ <ButtonGroup>
844
+ <Button>Button 1</Button>
845
+ <ButtonGroupSeparator />
846
+ <Button>Button 2</Button>
847
+ </ButtonGroup>
848
+ ```
849
+
850
+ ### ButtonGroupText
851
+
852
+ Use this component to display text within a button group.
853
+
854
+ | Prop | Type | Default |
855
+ | -------- | -------------------- | ------- |
856
+ | `render` | `React.ReactElement` | |
857
+
858
+ ```tsx
859
+ <ButtonGroup>
860
+ <ButtonGroupText>Text</ButtonGroupText>
861
+ <Button>Button</Button>
862
+ </ButtonGroup>
863
+ ```
864
+
865
+ Use the `render` prop to render a custom component as the text, for example a label.
866
+
867
+ ```tsx showLineNumbers
868
+ import { ButtonGroupText } from '@/components/ui/button-group'
869
+ import { Label } from '@/components/ui/label'
870
+
871
+ export function ButtonGroupTextDemo() {
872
+ return (
873
+ <ButtonGroup>
874
+ <ButtonGroupText render={<Label htmlFor="name" />}>Text</ButtonGroupText>
875
+ <Input placeholder="Type something here..." id="name" />
876
+ </ButtonGroup>
877
+ )
878
+ }
879
+ ```