moi-computer 0.11.1-next.0 → 0.11.1-next.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/client/AGENTS.md +2 -2
- package/client/components/ui/button.tsx +1 -53
- package/client/components/ui/collapsible.tsx +1 -15
- package/client/components/ui/dialog.tsx +1 -58
- package/client/components/ui/dropdown-menu.tsx +1 -254
- package/client/components/ui/hover-card.tsx +1 -44
- package/client/components/ui/input.tsx +1 -21
- package/client/components/ui/popover.tsx +1 -88
- package/client/components/ui/resizable.tsx +1 -40
- package/client/components/ui/skeleton.tsx +1 -13
- package/client/components/ui/slider.tsx +1 -70
- package/client/components/ui/spinner.tsx +1 -18
- package/client/components/ui/switch.tsx +1 -23
- package/client/components/ui/tabs.tsx +1 -0
- package/client/components/ui/textarea.tsx +1 -18
- package/client/components/ui/tooltip.tsx +1 -51
- package/client/features/chat/ChatPanel.tsx +6 -6
- package/client/features/chat/ChatPopup.tsx +3 -4
- package/client/features/chat/TurnView.tsx +5 -4
- package/client/features/chat/api.ts +5 -14
- package/client/features/chat/chat-frames.ts +9 -7
- package/client/features/chat/chat-send.ts +13 -2
- package/client/features/chat/chat-store.ts +1 -3
- package/client/features/chat/composer/ChatComposer.tsx +5 -1
- package/client/features/chat/composer/ModelPicker.tsx +44 -44
- package/client/features/chat/composer/banners/ErrorBanner.tsx +20 -12
- package/client/features/chat/composer/model-order.ts +15 -0
- package/client/features/chat/composer/useWorkspaceComposerState.tsx +15 -7
- package/client/features/chat/group-turns.ts +12 -0
- package/client/features/chat/interleave-notices.ts +7 -11
- package/client/features/chat/session-view.ts +53 -0
- package/client/features/chat/tool-group/ToolCallGroup.tsx +1 -4
- package/client/features/chat/tool-group/format/codex.ts +4 -1
- package/client/features/chat/useChat.ts +10 -9
- package/client/features/dev/ChatStatesPage.tsx +3 -1
- package/client/features/dev/DevIndexPage.tsx +5 -0
- package/client/features/dev/DevRoutes.tsx +2 -0
- package/client/features/dev/HarnessDebugPage.tsx +1 -1
- package/client/features/dev/UiComponentPreviews.tsx +834 -0
- package/client/features/dev/UiComponentsPage.tsx +60 -0
- package/client/features/home/WorkspacePreview.tsx +1 -1
- package/client/features/home/workspace-setup/DemoDialog.tsx +3 -2
- package/client/features/home/workspace-setup/ImportWorkspaceDialog.tsx +5 -8
- package/client/features/home/workspace-setup/WorkspaceDialogContent.tsx +7 -20
- package/client/features/settings/SettingsLayout.tsx +1 -1
- package/client/features/settings/WorkspaceSettings.tsx +4 -1
- package/client/features/views/ViewManager.tsx +14 -9
- package/client/features/widgets/WidgetFrame.tsx +1 -1
- package/client/features/widgets/Widgets.tsx +1 -3
- package/client/features/workspace/WorkspaceScreen.tsx +5 -1
- package/client/features/workspace/WorkspaceSplitLayout.tsx +6 -1
- package/client/features/workspace/api.ts +2 -4
- package/client/index.css +22 -29
- package/dist/chunk-245wt82v.css +1 -0
- package/dist/{chunk-tny85yt2.js → chunk-4s15axjs.js} +2 -2
- package/dist/{chunk-c9pjqx9m.js → chunk-53a7pxcz.js} +1 -1
- package/dist/{chunk-104m57qw.js → chunk-87thzbtw.js} +2 -2
- package/dist/chunk-a6jad1a6.js +1 -0
- package/dist/chunk-dghwstd2.js +9 -0
- package/dist/chunk-eg120aca.js +1 -0
- package/dist/{chunk-v7wr1df4.js → chunk-j3wvxjr7.js} +1 -1
- package/dist/chunk-j7hh2ab4.js +70 -0
- package/dist/chunk-w482ew2c.js +546 -0
- package/dist/chunk-y8eyahwx.js +1 -0
- package/dist/index.html +1 -1
- package/lib/format.ts +55 -6
- package/lib/themes.ts +6 -6
- package/lib/types.ts +10 -9
- package/package.json +12 -5
- package/registry.json +643 -0
- package/server/agent.ts +1 -1
- package/server/api.ts +26 -30
- package/server/applets.ts +30 -29
- package/server/bundler/applet-css.ts +7 -107
- package/server/bundler/build-applet.ts +5 -1
- package/server/bundler/build-worker.ts +178 -0
- package/server/cli-ui-components.ts +28 -33
- package/server/cli.ts +6 -11
- package/server/data-dir.ts +1 -1
- package/server/harness/README.md +41 -48
- package/server/harness/acp/NOTES.md +426 -0
- package/server/harness/acp/discovery.ts +27 -30
- package/server/harness/acp/model-state.ts +57 -0
- package/server/harness/acp/session.ts +18 -6
- package/server/harness/claude-code/NOTES.md +47 -12
- package/server/harness/claude-code/cli.ts +40 -0
- package/server/harness/claude-code/index.ts +11 -5
- package/server/harness/claude-code/models.ts +72 -19
- package/server/harness/claude-code/session.ts +408 -299
- package/server/harness/codex/NOTES.md +222 -350
- package/server/harness/codex/adapter.ts +94 -45
- package/server/harness/codex/auth.ts +1 -3
- package/server/harness/codex/client.ts +169 -249
- package/server/harness/codex/discovery.ts +9 -17
- package/server/harness/codex/index.ts +2 -1
- package/server/harness/codex/pagination.ts +24 -0
- package/server/harness/codex/permissions.ts +31 -7
- package/server/harness/codex/probe.ts +10 -13
- package/server/harness/codex/session.ts +549 -136
- package/server/harness/codex/transport.ts +184 -0
- package/server/harness/debug.ts +1 -1
- package/server/harness/hermes/NOTES.md +18 -0
- package/server/harness/hermes/discovery.ts +20 -0
- package/server/harness/hermes/index.ts +9 -0
- package/server/harness/hermes/models.ts +28 -8
- package/server/harness/types.ts +4 -2
- package/server/moi-scaffold.ts +1 -1
- package/server/preview.ts +3 -1
- package/server/registry.ts +63 -41
- package/server/tldraw-package.d.ts +4 -0
- package/server/ui-components.ts +101 -434
- package/server/view-builders.ts +2 -1
- package/server/web.ts +12 -5
- package/server/workspace-env.ts +3 -2
- package/tsconfig.json +0 -1
- package/ui-components/accordion.tsx +71 -0
- package/ui-components/alert-dialog.tsx +165 -0
- package/ui-components/alert.tsx +68 -0
- package/ui-components/attachment.tsx +195 -0
- package/ui-components/avatar.tsx +90 -0
- package/ui-components/badge.tsx +49 -0
- package/ui-components/button-group.tsx +78 -0
- package/ui-components/button.tsx +55 -0
- package/ui-components/calendar.tsx +180 -0
- package/ui-components/card.tsx +84 -0
- package/ui-components/carousel.tsx +235 -0
- package/ui-components/chart.tsx +338 -0
- package/ui-components/checkbox.tsx +28 -0
- package/ui-components/collapsible.tsx +15 -0
- package/ui-components/combobox.tsx +267 -0
- package/ui-components/context-menu.tsx +244 -0
- package/ui-components/dialog.tsx +138 -0
- package/ui-components/docs/accordion.md +463 -0
- package/ui-components/docs/alert-dialog.md +481 -0
- package/ui-components/docs/alert.md +301 -0
- package/ui-components/docs/attachment.md +689 -0
- package/ui-components/docs/avatar.md +495 -0
- package/ui-components/docs/badge.md +258 -0
- package/ui-components/docs/button-group.md +879 -0
- package/ui-components/docs/button.md +26 -0
- package/ui-components/docs/calendar.md +862 -0
- package/ui-components/docs/card.md +265 -0
- package/ui-components/docs/carousel.md +627 -0
- package/ui-components/docs/chart.md +1256 -0
- package/ui-components/docs/checkbox.md +477 -0
- package/ui-components/docs/collapsible.md +446 -0
- package/ui-components/docs/combobox.md +1003 -0
- package/ui-components/docs/context-menu.md +860 -0
- package/ui-components/docs/data-table.md +1580 -0
- package/ui-components/docs/date-picker.md +614 -0
- package/ui-components/docs/dialog.md +414 -0
- package/ui-components/docs/drawer.md +51 -0
- package/ui-components/docs/dropdown-menu.md +1000 -0
- package/ui-components/docs/field.md +1192 -0
- package/ui-components/docs/hover-card.md +275 -0
- package/ui-components/docs/input-group.md +866 -0
- package/ui-components/docs/input.md +456 -0
- package/ui-components/docs/label.md +295 -0
- package/ui-components/docs/pagination.md +416 -0
- package/ui-components/docs/popover.md +348 -0
- package/ui-components/docs/progress.md +214 -0
- package/ui-components/docs/radio-group.md +389 -0
- package/ui-components/docs/resizable.md +265 -0
- package/ui-components/docs/select.md +616 -0
- package/ui-components/docs/separator.md +216 -0
- package/ui-components/docs/skeleton.md +205 -0
- package/ui-components/docs/slider.md +226 -0
- package/ui-components/docs/spinner.md +332 -0
- package/ui-components/docs/switch.md +236 -0
- package/ui-components/docs/table.md +551 -0
- package/ui-components/docs/tabs.md +379 -0
- package/ui-components/docs/textarea.md +187 -0
- package/ui-components/docs/toggle-group.md +370 -0
- package/ui-components/docs/toggle.md +91 -0
- package/ui-components/docs/tooltip.md +290 -0
- package/ui-components/drawer.tsx +213 -0
- package/ui-components/dropdown-menu.tsx +263 -0
- package/ui-components/field.tsx +224 -0
- package/ui-components/hover-card.tsx +46 -0
- package/ui-components/input-group.tsx +146 -0
- package/ui-components/input.tsx +20 -0
- package/ui-components/label.tsx +17 -0
- package/ui-components/pagination.tsx +124 -0
- package/ui-components/popover.tsx +81 -0
- package/ui-components/progress.tsx +63 -0
- package/ui-components/radio-group.tsx +38 -0
- package/ui-components/resizable.tsx +40 -0
- package/ui-components/scoped-portal.tsx +31 -0
- package/ui-components/select.tsx +195 -0
- package/ui-components/separator.tsx +18 -0
- package/ui-components/skeleton.tsx +15 -0
- package/ui-components/slider.tsx +75 -0
- package/ui-components/spinner.tsx +20 -0
- package/ui-components/switch.tsx +27 -0
- package/ui-components/table.tsx +86 -0
- package/ui-components/tabs.tsx +75 -0
- package/ui-components/textarea.tsx +17 -0
- package/ui-components/toggle-group.tsx +85 -0
- package/ui-components/toggle.tsx +42 -0
- package/ui-components/tooltip.tsx +61 -0
- package/ui-components/utils.ts +8 -0
- package/workspace/.claude/skills/moi-workspace/SKILL.md +11 -20
- package/workspace/.claude/skills/moi-workspace/references/DESIGN.md +4 -3
- package/workspace/.claude/skills/moi-workspace/references/UI-COMPONENTS.md +67 -203
- package/dist/chunk-59zf0m6n.js +0 -1
- package/dist/chunk-bj3akjs2.js +0 -1
- package/dist/chunk-j2w2vak4.js +0 -546
- package/dist/chunk-k2r9c95m.js +0 -10
- package/dist/chunk-kmbxhgwv.js +0 -1
- package/dist/chunk-p1yqa71k.js +0 -83
- package/dist/chunk-r5xrenjy.css +0 -1
|
@@ -0,0 +1,866 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Input Group
|
|
3
|
+
description: Add addons, buttons, and helper content to inputs.
|
|
4
|
+
base: base
|
|
5
|
+
component: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
import { IconInfoCircle } from "@tabler/icons-react"
|
|
9
|
+
|
|
10
|
+
```tsx
|
|
11
|
+
import { IconSearch } from '@tabler/icons-react'
|
|
12
|
+
|
|
13
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from '@/components/ui/input-group'
|
|
14
|
+
|
|
15
|
+
export function InputGroupDemo() {
|
|
16
|
+
return (
|
|
17
|
+
<InputGroup className="max-w-xs">
|
|
18
|
+
<InputGroupInput placeholder="Search..." />
|
|
19
|
+
<InputGroupAddon>
|
|
20
|
+
<IconSearch stroke={1.75} />
|
|
21
|
+
</InputGroupAddon>
|
|
22
|
+
<InputGroupAddon align="inline-end">12 results</InputGroupAddon>
|
|
23
|
+
</InputGroup>
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
<CodeTabs>
|
|
31
|
+
|
|
32
|
+
<TabsList>
|
|
33
|
+
<TabsTrigger value="cli">Command</TabsTrigger>
|
|
34
|
+
<TabsTrigger value="manual">Manual</TabsTrigger>
|
|
35
|
+
</TabsList>
|
|
36
|
+
<TabsContent value="cli">
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
moi ui-components add input-group
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
</TabsContent>
|
|
43
|
+
|
|
44
|
+
<TabsContent value="manual">
|
|
45
|
+
|
|
46
|
+
<Steps className="mb-0 pt-2">
|
|
47
|
+
|
|
48
|
+
<Step>Copy and paste the following code into your project.</Step>
|
|
49
|
+
|
|
50
|
+
<ComponentSource
|
|
51
|
+
name="input-group"
|
|
52
|
+
title="components/ui/input-group.tsx"
|
|
53
|
+
styleName="base-nova"
|
|
54
|
+
/>
|
|
55
|
+
|
|
56
|
+
<Step>Update the import paths to match your project setup.</Step>
|
|
57
|
+
|
|
58
|
+
</Steps>
|
|
59
|
+
|
|
60
|
+
</TabsContent>
|
|
61
|
+
|
|
62
|
+
</CodeTabs>
|
|
63
|
+
|
|
64
|
+
## Usage
|
|
65
|
+
|
|
66
|
+
```tsx showLineNumbers
|
|
67
|
+
import {
|
|
68
|
+
InputGroup,
|
|
69
|
+
InputGroupAddon,
|
|
70
|
+
InputGroupButton,
|
|
71
|
+
InputGroupInput,
|
|
72
|
+
InputGroupText,
|
|
73
|
+
InputGroupTextarea
|
|
74
|
+
} from '@/components/ui/input-group'
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```tsx showLineNumbers
|
|
78
|
+
<InputGroup>
|
|
79
|
+
<InputGroupInput placeholder="Search..." />
|
|
80
|
+
<InputGroupAddon>
|
|
81
|
+
<IconSearch stroke={1.75} />
|
|
82
|
+
</InputGroupAddon>
|
|
83
|
+
</InputGroup>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Composition
|
|
87
|
+
|
|
88
|
+
Use the following composition to build an `InputGroup`:
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
InputGroup
|
|
92
|
+
├── InputGroupInput or InputGroupTextarea
|
|
93
|
+
├── InputGroupAddon
|
|
94
|
+
├── InputGroupButton
|
|
95
|
+
└── InputGroupText
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Align
|
|
99
|
+
|
|
100
|
+
Use the `align` prop on `InputGroupAddon` to position the addon relative to the input.
|
|
101
|
+
|
|
102
|
+
<Callout>
|
|
103
|
+
For proper focus management, `InputGroupAddon` should always be placed after
|
|
104
|
+
`InputGroupInput` or `InputGroupTextarea` in the DOM. Use the `align` prop to
|
|
105
|
+
visually position the addon.
|
|
106
|
+
</Callout>
|
|
107
|
+
|
|
108
|
+
### inline-start
|
|
109
|
+
|
|
110
|
+
Use `align="inline-start"` to position the addon at the start of the input. This is the default.
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import { IconSearch } from '@tabler/icons-react'
|
|
114
|
+
|
|
115
|
+
import { Field, FieldDescription, FieldLabel } from '@/components/ui/field'
|
|
116
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from '@/components/ui/input-group'
|
|
117
|
+
|
|
118
|
+
export function InputGroupInlineStart() {
|
|
119
|
+
return (
|
|
120
|
+
<Field className="max-w-sm">
|
|
121
|
+
<FieldLabel htmlFor="inline-start-input">Input</FieldLabel>
|
|
122
|
+
<InputGroup>
|
|
123
|
+
<InputGroupInput id="inline-start-input" placeholder="Search..." />
|
|
124
|
+
<InputGroupAddon align="inline-start">
|
|
125
|
+
<IconSearch stroke={1.75} className="text-muted-foreground" />
|
|
126
|
+
</InputGroupAddon>
|
|
127
|
+
</InputGroup>
|
|
128
|
+
<FieldDescription>Icon positioned at the start.</FieldDescription>
|
|
129
|
+
</Field>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### inline-end
|
|
135
|
+
|
|
136
|
+
Use `align="inline-end"` to position the addon at the end of the input.
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
import { IconEyeOff } from '@tabler/icons-react'
|
|
140
|
+
|
|
141
|
+
import { Field, FieldDescription, FieldLabel } from '@/components/ui/field'
|
|
142
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from '@/components/ui/input-group'
|
|
143
|
+
|
|
144
|
+
export function InputGroupInlineEnd() {
|
|
145
|
+
return (
|
|
146
|
+
<Field className="max-w-sm">
|
|
147
|
+
<FieldLabel htmlFor="inline-end-input">Input</FieldLabel>
|
|
148
|
+
<InputGroup>
|
|
149
|
+
<InputGroupInput id="inline-end-input" type="password" placeholder="Enter password" />
|
|
150
|
+
<InputGroupAddon align="inline-end">
|
|
151
|
+
<IconEyeOff stroke={1.75} />
|
|
152
|
+
</InputGroupAddon>
|
|
153
|
+
</InputGroup>
|
|
154
|
+
<FieldDescription>Icon positioned at the end.</FieldDescription>
|
|
155
|
+
</Field>
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### block-start
|
|
161
|
+
|
|
162
|
+
Use `align="block-start"` to position the addon above the input.
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
import { IconCopy, IconFileCode } from '@tabler/icons-react'
|
|
166
|
+
|
|
167
|
+
import { Field, FieldDescription, FieldGroup, FieldLabel } from '@/components/ui/field'
|
|
168
|
+
import {
|
|
169
|
+
InputGroup,
|
|
170
|
+
InputGroupAddon,
|
|
171
|
+
InputGroupButton,
|
|
172
|
+
InputGroupInput,
|
|
173
|
+
InputGroupText,
|
|
174
|
+
InputGroupTextarea
|
|
175
|
+
} from '@/components/ui/input-group'
|
|
176
|
+
|
|
177
|
+
export function InputGroupBlockStart() {
|
|
178
|
+
return (
|
|
179
|
+
<FieldGroup className="max-w-sm">
|
|
180
|
+
<Field>
|
|
181
|
+
<FieldLabel htmlFor="block-start-input">Input</FieldLabel>
|
|
182
|
+
<InputGroup className="h-auto">
|
|
183
|
+
<InputGroupInput id="block-start-input" placeholder="Enter your name" />
|
|
184
|
+
<InputGroupAddon align="block-start">
|
|
185
|
+
<InputGroupText>Full Name</InputGroupText>
|
|
186
|
+
</InputGroupAddon>
|
|
187
|
+
</InputGroup>
|
|
188
|
+
<FieldDescription>Header positioned above the input.</FieldDescription>
|
|
189
|
+
</Field>
|
|
190
|
+
<Field>
|
|
191
|
+
<FieldLabel htmlFor="block-start-textarea">Textarea</FieldLabel>
|
|
192
|
+
<InputGroup>
|
|
193
|
+
<InputGroupTextarea
|
|
194
|
+
id="block-start-textarea"
|
|
195
|
+
placeholder="console.log('Hello, world!');"
|
|
196
|
+
className="font-mono text-sm"
|
|
197
|
+
/>
|
|
198
|
+
<InputGroupAddon align="block-start">
|
|
199
|
+
<IconFileCode stroke={1.75} className="text-muted-foreground" />
|
|
200
|
+
<InputGroupText className="font-mono">script.js</InputGroupText>
|
|
201
|
+
<InputGroupButton size="icon-xs" className="ml-auto">
|
|
202
|
+
<IconCopy stroke={1.5} />
|
|
203
|
+
<span className="sr-only">Copy</span>
|
|
204
|
+
</InputGroupButton>
|
|
205
|
+
</InputGroupAddon>
|
|
206
|
+
</InputGroup>
|
|
207
|
+
<FieldDescription>Header positioned above the textarea.</FieldDescription>
|
|
208
|
+
</Field>
|
|
209
|
+
</FieldGroup>
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### block-end
|
|
215
|
+
|
|
216
|
+
Use `align="block-end"` to position the addon below the input.
|
|
217
|
+
|
|
218
|
+
```tsx
|
|
219
|
+
import { Field, FieldDescription, FieldGroup, FieldLabel } from '@/components/ui/field'
|
|
220
|
+
import {
|
|
221
|
+
InputGroup,
|
|
222
|
+
InputGroupAddon,
|
|
223
|
+
InputGroupButton,
|
|
224
|
+
InputGroupInput,
|
|
225
|
+
InputGroupText,
|
|
226
|
+
InputGroupTextarea
|
|
227
|
+
} from '@/components/ui/input-group'
|
|
228
|
+
|
|
229
|
+
export function InputGroupBlockEnd() {
|
|
230
|
+
return (
|
|
231
|
+
<FieldGroup className="max-w-sm">
|
|
232
|
+
<Field>
|
|
233
|
+
<FieldLabel htmlFor="block-end-input">Input</FieldLabel>
|
|
234
|
+
<InputGroup className="h-auto">
|
|
235
|
+
<InputGroupInput id="block-end-input" placeholder="Enter amount" />
|
|
236
|
+
<InputGroupAddon align="block-end">
|
|
237
|
+
<InputGroupText>USD</InputGroupText>
|
|
238
|
+
</InputGroupAddon>
|
|
239
|
+
</InputGroup>
|
|
240
|
+
<FieldDescription>Footer positioned below the input.</FieldDescription>
|
|
241
|
+
</Field>
|
|
242
|
+
<Field>
|
|
243
|
+
<FieldLabel htmlFor="block-end-textarea">Textarea</FieldLabel>
|
|
244
|
+
<InputGroup>
|
|
245
|
+
<InputGroupTextarea id="block-end-textarea" placeholder="Write a comment..." />
|
|
246
|
+
<InputGroupAddon align="block-end">
|
|
247
|
+
<InputGroupText>0/280</InputGroupText>
|
|
248
|
+
<InputGroupButton variant="default" size="sm" className="ml-auto">
|
|
249
|
+
Post
|
|
250
|
+
</InputGroupButton>
|
|
251
|
+
</InputGroupAddon>
|
|
252
|
+
</InputGroup>
|
|
253
|
+
<FieldDescription>Footer positioned below the textarea.</FieldDescription>
|
|
254
|
+
</Field>
|
|
255
|
+
</FieldGroup>
|
|
256
|
+
)
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Icon
|
|
261
|
+
|
|
262
|
+
```tsx
|
|
263
|
+
import {
|
|
264
|
+
IconCheck,
|
|
265
|
+
IconCreditCard,
|
|
266
|
+
IconInfoCircle,
|
|
267
|
+
IconMail,
|
|
268
|
+
IconSearch,
|
|
269
|
+
IconStar
|
|
270
|
+
} from '@tabler/icons-react'
|
|
271
|
+
|
|
272
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from '@/components/ui/input-group'
|
|
273
|
+
|
|
274
|
+
export function InputGroupIcon() {
|
|
275
|
+
return (
|
|
276
|
+
<div className="grid w-full max-w-sm gap-6">
|
|
277
|
+
<InputGroup>
|
|
278
|
+
<InputGroupInput placeholder="Search..." />
|
|
279
|
+
<InputGroupAddon>
|
|
280
|
+
<IconSearch stroke={1.75} />
|
|
281
|
+
</InputGroupAddon>
|
|
282
|
+
</InputGroup>
|
|
283
|
+
<InputGroup>
|
|
284
|
+
<InputGroupInput type="email" placeholder="Enter your email" />
|
|
285
|
+
<InputGroupAddon>
|
|
286
|
+
<IconMail stroke={1.75} />
|
|
287
|
+
</InputGroupAddon>
|
|
288
|
+
</InputGroup>
|
|
289
|
+
<InputGroup>
|
|
290
|
+
<InputGroupInput placeholder="Card number" />
|
|
291
|
+
<InputGroupAddon>
|
|
292
|
+
<IconCreditCard stroke={1.75} />
|
|
293
|
+
</InputGroupAddon>
|
|
294
|
+
<InputGroupAddon align="inline-end">
|
|
295
|
+
<IconCheck stroke={1.75} />
|
|
296
|
+
</InputGroupAddon>
|
|
297
|
+
</InputGroup>
|
|
298
|
+
<InputGroup>
|
|
299
|
+
<InputGroupInput placeholder="Card number" />
|
|
300
|
+
<InputGroupAddon align="inline-end">
|
|
301
|
+
<IconStar stroke={1.75} />
|
|
302
|
+
<IconInfoCircle stroke={1.75} />
|
|
303
|
+
</InputGroupAddon>
|
|
304
|
+
</InputGroup>
|
|
305
|
+
</div>
|
|
306
|
+
)
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## Text
|
|
311
|
+
|
|
312
|
+
```tsx
|
|
313
|
+
import {
|
|
314
|
+
InputGroup,
|
|
315
|
+
InputGroupAddon,
|
|
316
|
+
InputGroupInput,
|
|
317
|
+
InputGroupText,
|
|
318
|
+
InputGroupTextarea
|
|
319
|
+
} from '@/components/ui/input-group'
|
|
320
|
+
|
|
321
|
+
export function InputGroupTextExample() {
|
|
322
|
+
return (
|
|
323
|
+
<div className="grid w-full max-w-sm gap-6">
|
|
324
|
+
<InputGroup>
|
|
325
|
+
<InputGroupAddon>
|
|
326
|
+
<InputGroupText>$</InputGroupText>
|
|
327
|
+
</InputGroupAddon>
|
|
328
|
+
<InputGroupInput placeholder="0.00" />
|
|
329
|
+
<InputGroupAddon align="inline-end">
|
|
330
|
+
<InputGroupText>USD</InputGroupText>
|
|
331
|
+
</InputGroupAddon>
|
|
332
|
+
</InputGroup>
|
|
333
|
+
<InputGroup>
|
|
334
|
+
<InputGroupAddon>
|
|
335
|
+
<InputGroupText>https://</InputGroupText>
|
|
336
|
+
</InputGroupAddon>
|
|
337
|
+
<InputGroupInput placeholder="example.com" className="pl-0.5!" />
|
|
338
|
+
<InputGroupAddon align="inline-end">
|
|
339
|
+
<InputGroupText>.com</InputGroupText>
|
|
340
|
+
</InputGroupAddon>
|
|
341
|
+
</InputGroup>
|
|
342
|
+
<InputGroup>
|
|
343
|
+
<InputGroupInput placeholder="Enter your username" />
|
|
344
|
+
<InputGroupAddon align="inline-end">
|
|
345
|
+
<InputGroupText>@company.com</InputGroupText>
|
|
346
|
+
</InputGroupAddon>
|
|
347
|
+
</InputGroup>
|
|
348
|
+
<InputGroup>
|
|
349
|
+
<InputGroupTextarea placeholder="Enter your message" />
|
|
350
|
+
<InputGroupAddon align="block-end">
|
|
351
|
+
<InputGroupText className="text-xs text-muted-foreground">
|
|
352
|
+
120 characters left
|
|
353
|
+
</InputGroupText>
|
|
354
|
+
</InputGroupAddon>
|
|
355
|
+
</InputGroup>
|
|
356
|
+
</div>
|
|
357
|
+
)
|
|
358
|
+
}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
## Button
|
|
362
|
+
|
|
363
|
+
```tsx
|
|
364
|
+
'use client'
|
|
365
|
+
|
|
366
|
+
import * as React from 'react'
|
|
367
|
+
import { IconCheck, IconCopy, IconInfoCircle, IconStar } from '@tabler/icons-react'
|
|
368
|
+
|
|
369
|
+
import { useCopyToClipboard } from '@/hooks/use-copy-to-clipboard'
|
|
370
|
+
import {
|
|
371
|
+
InputGroup,
|
|
372
|
+
InputGroupAddon,
|
|
373
|
+
InputGroupButton,
|
|
374
|
+
InputGroupInput
|
|
375
|
+
} from '@/components/ui/input-group'
|
|
376
|
+
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'
|
|
377
|
+
|
|
378
|
+
export function InputGroupButtonExample() {
|
|
379
|
+
const { copyToClipboard, isCopied } = useCopyToClipboard()
|
|
380
|
+
const [isFavorite, setIsFavorite] = React.useState(false)
|
|
381
|
+
|
|
382
|
+
return (
|
|
383
|
+
<div className="grid w-full max-w-sm gap-6">
|
|
384
|
+
<InputGroup>
|
|
385
|
+
<InputGroupInput placeholder="https://x.com/shadcn" readOnly />
|
|
386
|
+
<InputGroupAddon align="inline-end">
|
|
387
|
+
<InputGroupButton
|
|
388
|
+
aria-label="Copy"
|
|
389
|
+
title="Copy"
|
|
390
|
+
size="icon-xs"
|
|
391
|
+
onClick={() => {
|
|
392
|
+
copyToClipboard('https://x.com/shadcn')
|
|
393
|
+
}}
|
|
394
|
+
>
|
|
395
|
+
{isCopied ? <IconCheck stroke={1.5} /> : <IconCopy stroke={1.5} />}
|
|
396
|
+
</InputGroupButton>
|
|
397
|
+
</InputGroupAddon>
|
|
398
|
+
</InputGroup>
|
|
399
|
+
<InputGroup className="[--radius:9999px]">
|
|
400
|
+
<Popover>
|
|
401
|
+
<PopoverTrigger render={<InputGroupAddon />}>
|
|
402
|
+
<InputGroupButton variant="secondary" size="icon-xs">
|
|
403
|
+
<IconInfoCircle stroke={1.5} />
|
|
404
|
+
</InputGroupButton>
|
|
405
|
+
</PopoverTrigger>
|
|
406
|
+
<PopoverContent align="start" className="flex flex-col gap-1 rounded-xl text-sm">
|
|
407
|
+
<p className="font-medium">Your connection is not secure.</p>
|
|
408
|
+
<p>You should not enter any sensitive information on this site.</p>
|
|
409
|
+
</PopoverContent>
|
|
410
|
+
</Popover>
|
|
411
|
+
<InputGroupAddon className="pl-1.5 text-muted-foreground">https://</InputGroupAddon>
|
|
412
|
+
<InputGroupInput id="input-secure-19" />
|
|
413
|
+
<InputGroupAddon align="inline-end">
|
|
414
|
+
<InputGroupButton onClick={() => setIsFavorite(!isFavorite)} size="icon-xs">
|
|
415
|
+
<IconStar
|
|
416
|
+
stroke={1.5}
|
|
417
|
+
data-favorite={isFavorite}
|
|
418
|
+
className="data-[favorite=true]:fill-blue-600 data-[favorite=true]:stroke-blue-600"
|
|
419
|
+
/>
|
|
420
|
+
</InputGroupButton>
|
|
421
|
+
</InputGroupAddon>
|
|
422
|
+
</InputGroup>
|
|
423
|
+
<InputGroup>
|
|
424
|
+
<InputGroupInput placeholder="Type to search..." />
|
|
425
|
+
<InputGroupAddon align="inline-end">
|
|
426
|
+
<InputGroupButton variant="secondary">Search</InputGroupButton>
|
|
427
|
+
</InputGroupAddon>
|
|
428
|
+
</InputGroup>
|
|
429
|
+
</div>
|
|
430
|
+
)
|
|
431
|
+
}
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
## Kbd
|
|
435
|
+
|
|
436
|
+
```tsx
|
|
437
|
+
import { IconSearch } from '@tabler/icons-react'
|
|
438
|
+
|
|
439
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from '@/components/ui/input-group'
|
|
440
|
+
import { Kbd } from '@/components/ui/kbd'
|
|
441
|
+
|
|
442
|
+
export function InputGroupKbd() {
|
|
443
|
+
return (
|
|
444
|
+
<InputGroup className="max-w-sm">
|
|
445
|
+
<InputGroupInput placeholder="Search..." />
|
|
446
|
+
<InputGroupAddon>
|
|
447
|
+
<IconSearch stroke={1.75} className="text-muted-foreground" />
|
|
448
|
+
</InputGroupAddon>
|
|
449
|
+
<InputGroupAddon align="inline-end">
|
|
450
|
+
<Kbd>⌘K</Kbd>
|
|
451
|
+
</InputGroupAddon>
|
|
452
|
+
</InputGroup>
|
|
453
|
+
)
|
|
454
|
+
}
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
## Dropdown
|
|
458
|
+
|
|
459
|
+
```tsx
|
|
460
|
+
'use client'
|
|
461
|
+
|
|
462
|
+
import { IconChevronDown, IconDots } from '@tabler/icons-react'
|
|
463
|
+
|
|
464
|
+
import {
|
|
465
|
+
DropdownMenu,
|
|
466
|
+
DropdownMenuContent,
|
|
467
|
+
DropdownMenuGroup,
|
|
468
|
+
DropdownMenuItem,
|
|
469
|
+
DropdownMenuTrigger
|
|
470
|
+
} from '@/components/ui/dropdown-menu'
|
|
471
|
+
import {
|
|
472
|
+
InputGroup,
|
|
473
|
+
InputGroupAddon,
|
|
474
|
+
InputGroupButton,
|
|
475
|
+
InputGroupInput
|
|
476
|
+
} from '@/components/ui/input-group'
|
|
477
|
+
|
|
478
|
+
export function InputGroupDropdown() {
|
|
479
|
+
return (
|
|
480
|
+
<div className="grid w-full max-w-sm gap-4">
|
|
481
|
+
<InputGroup>
|
|
482
|
+
<InputGroupInput placeholder="Enter file name" />
|
|
483
|
+
<InputGroupAddon align="inline-end">
|
|
484
|
+
<DropdownMenu>
|
|
485
|
+
<DropdownMenuTrigger
|
|
486
|
+
render={<InputGroupButton variant="ghost" aria-label="More" size="icon-xs" />}
|
|
487
|
+
>
|
|
488
|
+
<IconDots stroke={1.5} />
|
|
489
|
+
</DropdownMenuTrigger>
|
|
490
|
+
<DropdownMenuContent align="end" sideOffset={8} alignOffset={-4}>
|
|
491
|
+
<DropdownMenuGroup>
|
|
492
|
+
<DropdownMenuItem>Settings</DropdownMenuItem>
|
|
493
|
+
<DropdownMenuItem>Copy path</DropdownMenuItem>
|
|
494
|
+
<DropdownMenuItem>Open location</DropdownMenuItem>
|
|
495
|
+
</DropdownMenuGroup>
|
|
496
|
+
</DropdownMenuContent>
|
|
497
|
+
</DropdownMenu>
|
|
498
|
+
</InputGroupAddon>
|
|
499
|
+
</InputGroup>
|
|
500
|
+
<InputGroup>
|
|
501
|
+
<InputGroupInput placeholder="Enter search query" />
|
|
502
|
+
<InputGroupAddon align="inline-end">
|
|
503
|
+
<DropdownMenu>
|
|
504
|
+
<DropdownMenuTrigger
|
|
505
|
+
render={<InputGroupButton variant="ghost" className="pr-1.5! text-xs" />}
|
|
506
|
+
>
|
|
507
|
+
Search In... <IconChevronDown stroke={1.75} className="size-3" />
|
|
508
|
+
</DropdownMenuTrigger>
|
|
509
|
+
<DropdownMenuContent align="end" sideOffset={8} alignOffset={-4}>
|
|
510
|
+
<DropdownMenuGroup>
|
|
511
|
+
<DropdownMenuItem>Documentation</DropdownMenuItem>
|
|
512
|
+
<DropdownMenuItem>Blog Posts</DropdownMenuItem>
|
|
513
|
+
<DropdownMenuItem>Changelog</DropdownMenuItem>
|
|
514
|
+
</DropdownMenuGroup>
|
|
515
|
+
</DropdownMenuContent>
|
|
516
|
+
</DropdownMenu>
|
|
517
|
+
</InputGroupAddon>
|
|
518
|
+
</InputGroup>
|
|
519
|
+
</div>
|
|
520
|
+
)
|
|
521
|
+
}
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
## Spinner
|
|
525
|
+
|
|
526
|
+
```tsx
|
|
527
|
+
import { IconLoader } from '@tabler/icons-react'
|
|
528
|
+
|
|
529
|
+
import {
|
|
530
|
+
InputGroup,
|
|
531
|
+
InputGroupAddon,
|
|
532
|
+
InputGroupInput,
|
|
533
|
+
InputGroupText
|
|
534
|
+
} from '@/components/ui/input-group'
|
|
535
|
+
import { Spinner } from '@/components/ui/spinner'
|
|
536
|
+
|
|
537
|
+
export function InputGroupSpinner() {
|
|
538
|
+
return (
|
|
539
|
+
<div className="grid w-full max-w-sm gap-4">
|
|
540
|
+
<InputGroup>
|
|
541
|
+
<InputGroupInput placeholder="Searching..." />
|
|
542
|
+
<InputGroupAddon align="inline-end">
|
|
543
|
+
<Spinner stroke={1.75} />
|
|
544
|
+
</InputGroupAddon>
|
|
545
|
+
</InputGroup>
|
|
546
|
+
<InputGroup>
|
|
547
|
+
<InputGroupInput placeholder="Processing..." />
|
|
548
|
+
<InputGroupAddon>
|
|
549
|
+
<Spinner stroke={1.75} />
|
|
550
|
+
</InputGroupAddon>
|
|
551
|
+
</InputGroup>
|
|
552
|
+
<InputGroup>
|
|
553
|
+
<InputGroupInput placeholder="Saving changes..." />
|
|
554
|
+
<InputGroupAddon align="inline-end">
|
|
555
|
+
<InputGroupText>Saving...</InputGroupText>
|
|
556
|
+
<Spinner stroke={1.75} />
|
|
557
|
+
</InputGroupAddon>
|
|
558
|
+
</InputGroup>
|
|
559
|
+
<InputGroup>
|
|
560
|
+
<InputGroupInput placeholder="Refreshing data..." />
|
|
561
|
+
<InputGroupAddon>
|
|
562
|
+
<IconLoader stroke={1.75} className="animate-spin" />
|
|
563
|
+
</InputGroupAddon>
|
|
564
|
+
<InputGroupAddon align="inline-end">
|
|
565
|
+
<InputGroupText className="text-muted-foreground">Please wait...</InputGroupText>
|
|
566
|
+
</InputGroupAddon>
|
|
567
|
+
</InputGroup>
|
|
568
|
+
</div>
|
|
569
|
+
)
|
|
570
|
+
}
|
|
571
|
+
```
|
|
572
|
+
|
|
573
|
+
## Textarea
|
|
574
|
+
|
|
575
|
+
```tsx
|
|
576
|
+
import { IconBrandJavascript, IconCopy, IconCornerDownLeft, IconRefresh } from '@tabler/icons-react'
|
|
577
|
+
|
|
578
|
+
import {
|
|
579
|
+
InputGroup,
|
|
580
|
+
InputGroupAddon,
|
|
581
|
+
InputGroupButton,
|
|
582
|
+
InputGroupText,
|
|
583
|
+
InputGroupTextarea
|
|
584
|
+
} from '@/components/ui/input-group'
|
|
585
|
+
|
|
586
|
+
export function InputGroupTextareaExample() {
|
|
587
|
+
return (
|
|
588
|
+
<div className="grid w-full max-w-md gap-4">
|
|
589
|
+
<InputGroup>
|
|
590
|
+
<InputGroupTextarea
|
|
591
|
+
id="textarea-code-32"
|
|
592
|
+
placeholder="console.log('Hello, world!');"
|
|
593
|
+
className="min-h-[200px]"
|
|
594
|
+
/>
|
|
595
|
+
<InputGroupAddon align="block-end" className="border-t">
|
|
596
|
+
<InputGroupText>Line 1, Column 1</InputGroupText>
|
|
597
|
+
<InputGroupButton size="sm" className="ml-auto" variant="default">
|
|
598
|
+
Run <IconCornerDownLeft stroke={1.5} />
|
|
599
|
+
</InputGroupButton>
|
|
600
|
+
</InputGroupAddon>
|
|
601
|
+
<InputGroupAddon align="block-start" className="border-b">
|
|
602
|
+
<InputGroupText className="font-mono font-medium">
|
|
603
|
+
<IconBrandJavascript stroke={1.75} />
|
|
604
|
+
script.js
|
|
605
|
+
</InputGroupText>
|
|
606
|
+
<InputGroupButton className="ml-auto" size="icon-xs">
|
|
607
|
+
<IconRefresh stroke={1.5} />
|
|
608
|
+
</InputGroupButton>
|
|
609
|
+
<InputGroupButton variant="ghost" size="icon-xs">
|
|
610
|
+
<IconCopy stroke={1.5} />
|
|
611
|
+
</InputGroupButton>
|
|
612
|
+
</InputGroupAddon>
|
|
613
|
+
</InputGroup>
|
|
614
|
+
</div>
|
|
615
|
+
)
|
|
616
|
+
}
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
## Custom Input
|
|
620
|
+
|
|
621
|
+
Add the `data-slot="input-group-control"` attribute to your custom input for automatic focus state handling.
|
|
622
|
+
|
|
623
|
+
Here's an example of a custom resizable textarea from a third-party library.
|
|
624
|
+
|
|
625
|
+
```tsx
|
|
626
|
+
'use client'
|
|
627
|
+
|
|
628
|
+
import TextareaAutosize from 'react-textarea-autosize'
|
|
629
|
+
|
|
630
|
+
import { InputGroup, InputGroupAddon, InputGroupButton } from '@/components/ui/input-group'
|
|
631
|
+
|
|
632
|
+
export function InputGroupCustom() {
|
|
633
|
+
return (
|
|
634
|
+
<div className="grid w-full max-w-sm gap-6">
|
|
635
|
+
<InputGroup>
|
|
636
|
+
<TextareaAutosize
|
|
637
|
+
data-slot="input-group-control"
|
|
638
|
+
className="flex field-sizing-content min-h-16 w-full resize-none rounded-md bg-transparent px-3 py-2.5 text-base transition-[color,box-shadow] outline-none md:text-sm"
|
|
639
|
+
placeholder="Autoresize textarea..."
|
|
640
|
+
/>
|
|
641
|
+
<InputGroupAddon align="block-end">
|
|
642
|
+
<InputGroupButton className="ml-auto" size="sm" variant="default">
|
|
643
|
+
Submit
|
|
644
|
+
</InputGroupButton>
|
|
645
|
+
</InputGroupAddon>
|
|
646
|
+
</InputGroup>
|
|
647
|
+
</div>
|
|
648
|
+
)
|
|
649
|
+
}
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
## RTL
|
|
653
|
+
|
|
654
|
+
```tsx
|
|
655
|
+
'use client'
|
|
656
|
+
|
|
657
|
+
import * as React from 'react'
|
|
658
|
+
import { IconSearch } from '@tabler/icons-react'
|
|
659
|
+
|
|
660
|
+
import { useTranslation, type Translations } from '@/components/language-selector'
|
|
661
|
+
import { Field, FieldDescription, FieldGroup, FieldLabel } from '@/components/ui/field'
|
|
662
|
+
import {
|
|
663
|
+
InputGroup,
|
|
664
|
+
InputGroupAddon,
|
|
665
|
+
InputGroupButton,
|
|
666
|
+
InputGroupInput,
|
|
667
|
+
InputGroupText,
|
|
668
|
+
InputGroupTextarea
|
|
669
|
+
} from '@/components/ui/input-group'
|
|
670
|
+
import { Spinner } from '@/components/ui/spinner'
|
|
671
|
+
|
|
672
|
+
const translations: Translations = {
|
|
673
|
+
en: {
|
|
674
|
+
dir: 'ltr',
|
|
675
|
+
values: {
|
|
676
|
+
placeholder: 'Search...',
|
|
677
|
+
results: '12 results',
|
|
678
|
+
searching: 'Searching...',
|
|
679
|
+
saving: 'Saving...',
|
|
680
|
+
savingChanges: 'Saving changes...',
|
|
681
|
+
textareaLabel: 'Textarea',
|
|
682
|
+
textareaPlaceholder: 'Write a comment...',
|
|
683
|
+
characterCount: '0/280',
|
|
684
|
+
post: 'Post',
|
|
685
|
+
textareaDescription: 'Footer positioned below the textarea.'
|
|
686
|
+
}
|
|
687
|
+
},
|
|
688
|
+
ar: {
|
|
689
|
+
dir: 'rtl',
|
|
690
|
+
values: {
|
|
691
|
+
placeholder: 'بحث...',
|
|
692
|
+
results: '١٢ نتيجة',
|
|
693
|
+
searching: 'جاري البحث...',
|
|
694
|
+
saving: 'جاري الحفظ...',
|
|
695
|
+
savingChanges: 'جاري حفظ التغييرات...',
|
|
696
|
+
textareaLabel: 'منطقة النص',
|
|
697
|
+
textareaPlaceholder: 'اكتب تعليقًا...',
|
|
698
|
+
characterCount: '٠/٢٨٠',
|
|
699
|
+
post: 'نشر',
|
|
700
|
+
textareaDescription: 'تذييل موضع أسفل منطقة النص.'
|
|
701
|
+
}
|
|
702
|
+
},
|
|
703
|
+
he: {
|
|
704
|
+
dir: 'rtl',
|
|
705
|
+
values: {
|
|
706
|
+
placeholder: 'חפש...',
|
|
707
|
+
results: '12 תוצאות',
|
|
708
|
+
searching: 'מחפש...',
|
|
709
|
+
saving: 'שומר...',
|
|
710
|
+
savingChanges: 'שומר שינויים...',
|
|
711
|
+
textareaLabel: 'אזור טקסט',
|
|
712
|
+
textareaPlaceholder: 'כתוב תגובה...',
|
|
713
|
+
characterCount: '0/280',
|
|
714
|
+
post: 'פרסם',
|
|
715
|
+
textareaDescription: 'כותרת תחתונה ממוקמת מתחת לאזור הטקסט.'
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
export function InputGroupRtl() {
|
|
721
|
+
const { dir, t } = useTranslation(translations, 'ar')
|
|
722
|
+
|
|
723
|
+
return (
|
|
724
|
+
<div className="grid w-full max-w-sm gap-6">
|
|
725
|
+
<InputGroup className="max-w-xs">
|
|
726
|
+
<InputGroupInput placeholder={t.placeholder} />
|
|
727
|
+
<InputGroupAddon>
|
|
728
|
+
<IconSearch stroke={1.75} />
|
|
729
|
+
</InputGroupAddon>
|
|
730
|
+
<InputGroupAddon align="inline-end">{t.results}</InputGroupAddon>
|
|
731
|
+
</InputGroup>
|
|
732
|
+
<InputGroup>
|
|
733
|
+
<InputGroupInput placeholder={t.searching} />
|
|
734
|
+
<InputGroupAddon align="inline-end">
|
|
735
|
+
<Spinner stroke={1.75} />
|
|
736
|
+
</InputGroupAddon>
|
|
737
|
+
</InputGroup>
|
|
738
|
+
<InputGroup>
|
|
739
|
+
<InputGroupInput placeholder={t.savingChanges} />
|
|
740
|
+
<InputGroupAddon align="inline-end">
|
|
741
|
+
<InputGroupText>{t.saving}</InputGroupText>
|
|
742
|
+
<Spinner stroke={1.75} />
|
|
743
|
+
</InputGroupAddon>
|
|
744
|
+
</InputGroup>
|
|
745
|
+
<FieldGroup className="max-w-sm">
|
|
746
|
+
<Field>
|
|
747
|
+
<FieldLabel htmlFor="rtl-textarea">{t.textareaLabel}</FieldLabel>
|
|
748
|
+
<InputGroup>
|
|
749
|
+
<InputGroupTextarea id="rtl-textarea" placeholder={t.textareaPlaceholder} />
|
|
750
|
+
<InputGroupAddon align="block-end">
|
|
751
|
+
<InputGroupText>{t.characterCount}</InputGroupText>
|
|
752
|
+
<InputGroupButton variant="default" size="sm" className="ms-auto">
|
|
753
|
+
{t.post}
|
|
754
|
+
</InputGroupButton>
|
|
755
|
+
</InputGroupAddon>
|
|
756
|
+
</InputGroup>
|
|
757
|
+
<FieldDescription>{t.textareaDescription}</FieldDescription>
|
|
758
|
+
</Field>
|
|
759
|
+
</FieldGroup>
|
|
760
|
+
</div>
|
|
761
|
+
)
|
|
762
|
+
}
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
## API Reference
|
|
766
|
+
|
|
767
|
+
### InputGroup
|
|
768
|
+
|
|
769
|
+
The main component that wraps inputs and addons.
|
|
770
|
+
|
|
771
|
+
| Prop | Type | Default |
|
|
772
|
+
| ----------- | -------- | ------- |
|
|
773
|
+
| `className` | `string` | |
|
|
774
|
+
|
|
775
|
+
```tsx
|
|
776
|
+
<InputGroup>
|
|
777
|
+
<InputGroupInput />
|
|
778
|
+
<InputGroupAddon />
|
|
779
|
+
</InputGroup>
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
### InputGroupAddon
|
|
783
|
+
|
|
784
|
+
Displays icons, text, buttons, or other content alongside inputs.
|
|
785
|
+
|
|
786
|
+
<Callout icon={<IconInfoCircle stroke={1.75} />} title="Focus Navigation">
|
|
787
|
+
For proper focus navigation, the `InputGroupAddon` component should be placed
|
|
788
|
+
after the input. Set the `align` prop to position the addon.
|
|
789
|
+
</Callout>
|
|
790
|
+
|
|
791
|
+
| Prop | Type | Default |
|
|
792
|
+
| ----------- | ---------------------------------------------------------------- | ---------------- |
|
|
793
|
+
| `align` | `"inline-start" \| "inline-end" \| "block-start" \| "block-end"` | `"inline-start"` |
|
|
794
|
+
| `className` | `string` | |
|
|
795
|
+
|
|
796
|
+
```tsx
|
|
797
|
+
<InputGroupAddon align="inline-end">
|
|
798
|
+
<IconSearch stroke={1.75} />
|
|
799
|
+
</InputGroupAddon>
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
**For `<InputGroupInput />`, use the `inline-start` or `inline-end` alignment. For `<InputGroupTextarea />`, use the `block-start` or `block-end` alignment.**
|
|
803
|
+
|
|
804
|
+
The `InputGroupAddon` component can have multiple `InputGroupButton` components and icons.
|
|
805
|
+
|
|
806
|
+
```tsx
|
|
807
|
+
<InputGroupAddon>
|
|
808
|
+
<InputGroupButton>Button</InputGroupButton>
|
|
809
|
+
<InputGroupButton>Button</InputGroupButton>
|
|
810
|
+
</InputGroupAddon>
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
### InputGroupButton
|
|
814
|
+
|
|
815
|
+
Displays buttons within input groups.
|
|
816
|
+
|
|
817
|
+
| Prop | Type | Default |
|
|
818
|
+
| ----------- | ----------------------------------------------------------------------------- | --------- |
|
|
819
|
+
| `size` | `"xs" \| "icon-xs" \| "sm" \| "icon-sm"` | `"xs"` |
|
|
820
|
+
| `variant` | `"default" \| "destructive" \| "outline" \| "secondary" \| "ghost" \| "link"` | `"ghost"` |
|
|
821
|
+
| `className` | `string` | |
|
|
822
|
+
|
|
823
|
+
```tsx
|
|
824
|
+
<InputGroupButton>Button</InputGroupButton>
|
|
825
|
+
<InputGroupButton size="icon-xs" aria-label="Copy">
|
|
826
|
+
<IconCopy stroke={1.5} />
|
|
827
|
+
</InputGroupButton>
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
### InputGroupInput
|
|
831
|
+
|
|
832
|
+
Replacement for `<Input />` when building input groups. This component has the input group styles pre-applied and uses the unified `data-slot="input-group-control"` for focus state handling.
|
|
833
|
+
|
|
834
|
+
| Prop | Type | Default |
|
|
835
|
+
| ----------- | -------- | ------- |
|
|
836
|
+
| `className` | `string` | |
|
|
837
|
+
|
|
838
|
+
All other props are passed through to the underlying `<Input />` component.
|
|
839
|
+
|
|
840
|
+
```tsx
|
|
841
|
+
<InputGroup>
|
|
842
|
+
<InputGroupInput placeholder="Enter text..." />
|
|
843
|
+
<InputGroupAddon>
|
|
844
|
+
<IconSearch stroke={1.75} />
|
|
845
|
+
</InputGroupAddon>
|
|
846
|
+
</InputGroup>
|
|
847
|
+
```
|
|
848
|
+
|
|
849
|
+
### InputGroupTextarea
|
|
850
|
+
|
|
851
|
+
Replacement for `<Textarea />` when building input groups. This component has the textarea group styles pre-applied and uses the unified `data-slot="input-group-control"` for focus state handling.
|
|
852
|
+
|
|
853
|
+
| Prop | Type | Default |
|
|
854
|
+
| ----------- | -------- | ------- |
|
|
855
|
+
| `className` | `string` | |
|
|
856
|
+
|
|
857
|
+
All other props are passed through to the underlying `<Textarea />` component.
|
|
858
|
+
|
|
859
|
+
```tsx
|
|
860
|
+
<InputGroup>
|
|
861
|
+
<InputGroupTextarea placeholder="Enter message..." />
|
|
862
|
+
<InputGroupAddon align="block-end">
|
|
863
|
+
<InputGroupButton>Send</InputGroupButton>
|
|
864
|
+
</InputGroupAddon>
|
|
865
|
+
</InputGroup>
|
|
866
|
+
```
|