@app-studio/web 0.9.31 → 0.9.32
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/docs/components/Accordion.mdx +158 -0
- package/docs/components/Alert.mdx +123 -0
- package/docs/components/AspectRatio.mdx +55 -0
- package/docs/components/Avatar.mdx +85 -0
- package/docs/components/Background.mdx +522 -0
- package/docs/components/Badge.mdx +220 -0
- package/docs/components/Button.mdx +272 -0
- package/docs/components/Calendar.mdx +274 -0
- package/docs/components/Card.mdx +341 -0
- package/docs/components/Carousel.mdx +411 -0
- package/docs/components/Center.mdx +474 -0
- package/docs/components/Chart.mdx +232 -0
- package/docs/components/ChatInput.mdx +373 -0
- package/docs/components/Checkbox.mdx +66 -0
- package/docs/components/ColorInput.mdx +209 -0
- package/docs/components/ComboBox.mdx +364 -0
- package/docs/components/Command.mdx +252 -0
- package/docs/components/ContextMenu.mdx +219 -0
- package/docs/components/CountryPicker.mdx +123 -0
- package/docs/components/DatePicker.mdx +77 -0
- package/docs/components/DragAndDrop.mdx +539 -0
- package/docs/components/DropdownMenu.mdx +205 -0
- package/docs/components/File.mdx +8 -0
- package/docs/components/Flow.mdx +257 -0
- package/docs/components/Form.mdx +681 -0
- package/docs/components/Formik.mdx +621 -0
- package/docs/components/Gradient.mdx +271 -0
- package/docs/components/Horizontal.mdx +40 -0
- package/docs/components/HoverCard.mdx +140 -0
- package/docs/components/Icon.mdx +438 -0
- package/docs/components/Label.mdx +438 -0
- package/docs/components/Link.mdx +83 -0
- package/docs/components/Loader.mdx +527 -0
- package/docs/components/Menubar.mdx +124 -0
- package/docs/components/Message.mdx +571 -0
- package/docs/components/Modal.mdx +533 -0
- package/docs/components/NavigationMenu.mdx +165 -0
- package/docs/components/Pagination.mdx +150 -0
- package/docs/components/Password.mdx +121 -0
- package/docs/components/Resizable.mdx +148 -0
- package/docs/components/Select.mdx +126 -0
- package/docs/components/Separator.mdx +121 -0
- package/docs/components/Sidebar.mdx +147 -0
- package/docs/components/Slider.mdx +232 -0
- package/docs/components/Switch.mdx +62 -0
- package/docs/components/Table.mdx +409 -0
- package/docs/components/Tabs.mdx +215 -0
- package/docs/components/TagInput.mdx +528 -0
- package/docs/components/Text.mdx +163 -0
- package/docs/components/TextArea.mdx +136 -0
- package/docs/components/TextField.mdx +225 -0
- package/docs/components/Title.mdx +535 -0
- package/docs/components/Toast.mdx +165 -0
- package/docs/components/Toggle.mdx +141 -0
- package/docs/components/ToggleGroup.mdx +165 -0
- package/docs/components/Tooltip.mdx +191 -0
- package/docs/components/Tree.mdx +340 -0
- package/docs/components/Uploader.mdx +426 -0
- package/docs/components/Vertical.mdx +566 -0
- package/package.json +1 -1
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
# ComboBox
|
|
2
|
+
|
|
3
|
+
A customizable dropdown list with optional search functionality.
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { ComboBox } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### **Default**
|
|
11
|
+
```tsx
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { ComboBox } from '../ComboBox';
|
|
14
|
+
|
|
15
|
+
export const DefaultDemo = () => {
|
|
16
|
+
const items = [
|
|
17
|
+
{
|
|
18
|
+
value: 'next.js',
|
|
19
|
+
label: 'Next.js',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: 'sveltekit',
|
|
23
|
+
label: 'SvelteKit',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
value: 'nuxt.js',
|
|
27
|
+
label: 'Nuxt.js',
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
return <ComboBox id="default" name="default" items={items} />;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### **onSelect**
|
|
36
|
+
Optional callback function triggered when an item is selected.
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import React from 'react';
|
|
40
|
+
import { ComboBox } from '../ComboBox';
|
|
41
|
+
import { Vertical } from 'app-studio';
|
|
42
|
+
import { MessageLayout, showMessage } from '../../..';
|
|
43
|
+
|
|
44
|
+
export const OnSelectDemo = () => {
|
|
45
|
+
const items = [
|
|
46
|
+
{
|
|
47
|
+
value: 'next.js',
|
|
48
|
+
label: 'Next.js',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
value: 'sveltekit',
|
|
52
|
+
label: 'SvelteKit',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
value: 'nuxt.js',
|
|
56
|
+
label: 'Nuxt.js',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: 'remix',
|
|
60
|
+
label: 'Remix',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
value: 'astro',
|
|
64
|
+
label: 'Astro',
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
return (
|
|
68
|
+
<Vertical gap={15}>
|
|
69
|
+
<ComboBox
|
|
70
|
+
id="onSelect"
|
|
71
|
+
items={items}
|
|
72
|
+
onSelect={(item) => {
|
|
73
|
+
showMessage('success', `Item selected: ${item.label}`);
|
|
74
|
+
}}
|
|
75
|
+
/>
|
|
76
|
+
<MessageLayout position="bottomRight" />
|
|
77
|
+
</Vertical>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Props
|
|
84
|
+
|
|
85
|
+
| Prop | Type | Description | Default |
|
|
86
|
+
| ----------------- | ------------- | --------------------------------------------------------------------------- | ----------- |
|
|
87
|
+
| items | array | Array of items to be displayed in the dropdown. | |
|
|
88
|
+
| onSelect | function | Callback function triggered when an item is selected. | |
|
|
89
|
+
| searchEnabled | boolean | Flag to enable search functionality. | true |
|
|
90
|
+
| left | ReactNode | Element to display on the left side. | |
|
|
91
|
+
| right | ReactNode | Element to display on the right side. | |
|
|
92
|
+
| label | string | Label to describe the ComboBox. | |
|
|
93
|
+
| showTick | boolean | Flag to show a tick mark next to selected items. | true |
|
|
94
|
+
| placeholder | string | Placeholder text when nothing is selected. | |
|
|
95
|
+
| styles | CSSProperties | Optional custom styles for the ComboBox. | |
|
|
96
|
+
| searchPlaceholder | string | Placeholder text for the search input. | 'Search...' |
|
|
97
|
+
| className | string | Optional className for the ComboBox container. | |
|
|
98
|
+
|
|
99
|
+
### **searchEnabled**
|
|
100
|
+
Flag to enable search functionality within the ComboBox.
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
import React from 'react';
|
|
104
|
+
import { ComboBox } from '../ComboBox';
|
|
105
|
+
|
|
106
|
+
export const SearchEnabledDemo = () => {
|
|
107
|
+
const items = [
|
|
108
|
+
{
|
|
109
|
+
value: 'next.js',
|
|
110
|
+
label: 'Next.js',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
value: 'sveltekit',
|
|
114
|
+
label: 'SvelteKit',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
value: 'nuxt.js',
|
|
118
|
+
label: 'Nuxt.js',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
value: 'remix',
|
|
122
|
+
label: 'Remix',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
value: 'astro',
|
|
126
|
+
label: 'Astro',
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
|
+
return <ComboBox id="searchEnabled" items={items} searchEnabled={false} />;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### **left**
|
|
135
|
+
Optional element to display on the left side of the ComboBox.
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
import React from 'react';
|
|
139
|
+
import { Badge } from '../../..';
|
|
140
|
+
import { ComboBox } from '../ComboBox';
|
|
141
|
+
|
|
142
|
+
export const LeftDemo = () => {
|
|
143
|
+
const items = [
|
|
144
|
+
{
|
|
145
|
+
value: 'enhancement',
|
|
146
|
+
label: 'Enhancement',
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
value: 'bug',
|
|
150
|
+
label: 'Bugs',
|
|
151
|
+
},
|
|
152
|
+
];
|
|
153
|
+
|
|
154
|
+
return (
|
|
155
|
+
<ComboBox
|
|
156
|
+
id="left"
|
|
157
|
+
name="left"
|
|
158
|
+
items={items}
|
|
159
|
+
left={<Badge content="Status" />}
|
|
160
|
+
/>
|
|
161
|
+
);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### **right**
|
|
167
|
+
Optional element to display on the right side of the ComboBox.
|
|
168
|
+
|
|
169
|
+
```tsx
|
|
170
|
+
import React from 'react';
|
|
171
|
+
import { Badge } from '../../..';
|
|
172
|
+
import { ComboBox } from '../ComboBox';
|
|
173
|
+
|
|
174
|
+
export const RightDemo = () => {
|
|
175
|
+
const items = [
|
|
176
|
+
{
|
|
177
|
+
value: 'enhancement',
|
|
178
|
+
label: 'Enhancement',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
value: 'bug',
|
|
182
|
+
label: 'Bugs',
|
|
183
|
+
},
|
|
184
|
+
];
|
|
185
|
+
|
|
186
|
+
return (
|
|
187
|
+
<ComboBox id="right" items={items} right={<Badge content="Status" />} />
|
|
188
|
+
);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### **label**
|
|
194
|
+
Optional label to describe the purpose of the ComboBox.
|
|
195
|
+
|
|
196
|
+
```tsx
|
|
197
|
+
import React from 'react';
|
|
198
|
+
import PlusIcon from '../../../Icon/Plus';
|
|
199
|
+
import { ComboBox } from '../ComboBox';
|
|
200
|
+
|
|
201
|
+
export const LabelDemo = () => {
|
|
202
|
+
const items = [
|
|
203
|
+
{
|
|
204
|
+
value: 'todo',
|
|
205
|
+
label: 'To Do',
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
value: 'inprogress',
|
|
209
|
+
label: 'In Progress',
|
|
210
|
+
},
|
|
211
|
+
];
|
|
212
|
+
return (
|
|
213
|
+
<ComboBox
|
|
214
|
+
id="label"
|
|
215
|
+
name="label"
|
|
216
|
+
label="Status"
|
|
217
|
+
items={items}
|
|
218
|
+
left={<PlusIcon size={12} />}
|
|
219
|
+
/>
|
|
220
|
+
);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### **showTick**
|
|
226
|
+
Flag to show a tick mark next to selected items.
|
|
227
|
+
|
|
228
|
+
```tsx
|
|
229
|
+
import React from 'react';
|
|
230
|
+
import { ComboBox } from '../ComboBox';
|
|
231
|
+
|
|
232
|
+
export const ShowTickDemo = () => {
|
|
233
|
+
const statuses = [
|
|
234
|
+
{
|
|
235
|
+
value: 'backlog',
|
|
236
|
+
label: 'Backlog',
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
value: 'todo',
|
|
240
|
+
label: 'Todo',
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
value: 'in progress',
|
|
244
|
+
label: 'In Progress',
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
value: 'done',
|
|
248
|
+
label: 'Done',
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
value: 'canceled',
|
|
252
|
+
label: 'Canceled',
|
|
253
|
+
},
|
|
254
|
+
];
|
|
255
|
+
return <ComboBox id="showTick" items={statuses} showTick={false} />;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### **placeholder**
|
|
261
|
+
Text to display when nothing has been selected in the ComboBox.
|
|
262
|
+
|
|
263
|
+
```tsx
|
|
264
|
+
import React from 'react';
|
|
265
|
+
import { ComboBox } from '../ComboBox';
|
|
266
|
+
|
|
267
|
+
export const PlaceholderDemo = () => {
|
|
268
|
+
const items = [
|
|
269
|
+
{
|
|
270
|
+
value: 'todo',
|
|
271
|
+
label: 'To Do',
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
value: 'inprogress',
|
|
275
|
+
label: 'In Progress',
|
|
276
|
+
},
|
|
277
|
+
];
|
|
278
|
+
return (
|
|
279
|
+
<ComboBox
|
|
280
|
+
id="placeholder"
|
|
281
|
+
name="placeholder"
|
|
282
|
+
placeholder="Select..."
|
|
283
|
+
searchEnabled={false}
|
|
284
|
+
items={items}
|
|
285
|
+
/>
|
|
286
|
+
);
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### **styles**
|
|
292
|
+
Optional custom styles to apply to the ComboBox.
|
|
293
|
+
|
|
294
|
+
```tsx
|
|
295
|
+
import React from 'react';
|
|
296
|
+
import { ComboBox } from '../ComboBox';
|
|
297
|
+
|
|
298
|
+
export const StylesDemo = () => {
|
|
299
|
+
const items = [
|
|
300
|
+
{
|
|
301
|
+
value: 'todo',
|
|
302
|
+
label: 'To Do',
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
value: 'inprogress',
|
|
306
|
+
label: 'In Progress',
|
|
307
|
+
},
|
|
308
|
+
];
|
|
309
|
+
return (
|
|
310
|
+
<ComboBox
|
|
311
|
+
id="styles"
|
|
312
|
+
items={items}
|
|
313
|
+
searchEnabled={false}
|
|
314
|
+
views={{
|
|
315
|
+
container: {
|
|
316
|
+
boxShadow:
|
|
317
|
+
'rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px, rgba(10, 37, 64, 0.35) 0px -2px 6px 0px inset',
|
|
318
|
+
},
|
|
319
|
+
item: {
|
|
320
|
+
margin: '10px',
|
|
321
|
+
},
|
|
322
|
+
dropdown: {
|
|
323
|
+
boxShadow:
|
|
324
|
+
'rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px, rgba(10, 37, 64, 0.35) 0px -2px 6px 0px inset',
|
|
325
|
+
},
|
|
326
|
+
text: {
|
|
327
|
+
borderBottom: '1px solid transparent',
|
|
328
|
+
},
|
|
329
|
+
}}
|
|
330
|
+
/>
|
|
331
|
+
);
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### **searchPlaceholder**
|
|
337
|
+
Placeholder text for the search input when search is enabled.
|
|
338
|
+
|
|
339
|
+
```tsx
|
|
340
|
+
import React from 'react';
|
|
341
|
+
import { ComboBox } from '../ComboBox';
|
|
342
|
+
|
|
343
|
+
export const SearchPlaceholderDemo = () => {
|
|
344
|
+
const items = [
|
|
345
|
+
{
|
|
346
|
+
value: 'todo',
|
|
347
|
+
label: 'To Do',
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
value: 'inprogress',
|
|
351
|
+
label: 'In Progress',
|
|
352
|
+
},
|
|
353
|
+
];
|
|
354
|
+
return (
|
|
355
|
+
<ComboBox
|
|
356
|
+
id="searchPlaceholder"
|
|
357
|
+
placeholder="Select..."
|
|
358
|
+
searchPlaceholder="FilterStatus.."
|
|
359
|
+
items={items}
|
|
360
|
+
/>
|
|
361
|
+
);
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
```
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# Command
|
|
2
|
+
|
|
3
|
+
A command palette for displaying a searchable list of commands.
|
|
4
|
+
|
|
5
|
+
### **Import**
|
|
6
|
+
```tsx
|
|
7
|
+
import { Command } from '@app-studio/web';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
### **Default**
|
|
11
|
+
```tsx
|
|
12
|
+
import React, { useState } from 'react';
|
|
13
|
+
import { Command } from '@app-studio/web';
|
|
14
|
+
import { Button } from '@app-studio/web';
|
|
15
|
+
import { HomeIcon, SettingsIcon, UserIcon } from '@app-studio/web';
|
|
16
|
+
|
|
17
|
+
export const DefaultCommand = () => {
|
|
18
|
+
const [open, setOpen] = useState(false);
|
|
19
|
+
|
|
20
|
+
const commands = [
|
|
21
|
+
{
|
|
22
|
+
id: 'home',
|
|
23
|
+
name: 'Home',
|
|
24
|
+
description: 'Go to home page',
|
|
25
|
+
icon: <HomeIcon widthHeight={16} />,
|
|
26
|
+
shortcut: '⌘H',
|
|
27
|
+
onSelect: () => console.log('Home selected'),
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'settings',
|
|
31
|
+
name: 'Settings',
|
|
32
|
+
description: 'Open settings page',
|
|
33
|
+
icon: <SettingsIcon widthHeight={16} />,
|
|
34
|
+
shortcut: '⌘S',
|
|
35
|
+
onSelect: () => console.log('Settings selected'),
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'profile',
|
|
39
|
+
name: 'Profile',
|
|
40
|
+
description: 'View your profile',
|
|
41
|
+
icon: <UserIcon widthHeight={16} />,
|
|
42
|
+
shortcut: '⌘P',
|
|
43
|
+
onSelect: () => console.log('Profile selected'),
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<>
|
|
49
|
+
<Button onClick={() => setOpen(true)}>Open Command Palette</Button>
|
|
50
|
+
<Command
|
|
51
|
+
open={open}
|
|
52
|
+
onOpenChange={setOpen}
|
|
53
|
+
commands={commands}
|
|
54
|
+
placeholder="Search commands..."
|
|
55
|
+
/>
|
|
56
|
+
</>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### **Groups**
|
|
62
|
+
The Command component supports grouping commands:
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
const groups = [
|
|
66
|
+
{
|
|
67
|
+
id: 'navigation',
|
|
68
|
+
name: 'Navigation',
|
|
69
|
+
commands: [
|
|
70
|
+
{
|
|
71
|
+
id: 'home',
|
|
72
|
+
name: 'Home',
|
|
73
|
+
description: 'Go to home page',
|
|
74
|
+
icon: <HomeIcon widthHeight={16} />,
|
|
75
|
+
shortcut: '⌘H',
|
|
76
|
+
onSelect: () => console.log('Home selected'),
|
|
77
|
+
},
|
|
78
|
+
// More commands...
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: 'actions',
|
|
83
|
+
name: 'Actions',
|
|
84
|
+
commands: [
|
|
85
|
+
{
|
|
86
|
+
id: 'edit',
|
|
87
|
+
name: 'Edit',
|
|
88
|
+
description: 'Edit current document',
|
|
89
|
+
icon: <EditIcon widthHeight={16} />,
|
|
90
|
+
shortcut: '⌘E',
|
|
91
|
+
onSelect: () => console.log('Edit selected'),
|
|
92
|
+
},
|
|
93
|
+
// More commands...
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
|
|
98
|
+
<Command
|
|
99
|
+
open={open}
|
|
100
|
+
onOpenChange={setOpen}
|
|
101
|
+
groups={groups}
|
|
102
|
+
placeholder="Search commands..."
|
|
103
|
+
/>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### **Variants**
|
|
107
|
+
The Command component supports different visual variants:
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
// Default variant
|
|
111
|
+
<Command variant="default" />
|
|
112
|
+
|
|
113
|
+
// Filled variant
|
|
114
|
+
<Command variant="filled" />
|
|
115
|
+
|
|
116
|
+
// Outline variant
|
|
117
|
+
<Command variant="outline" />
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### **Sizes**
|
|
121
|
+
The Command component supports different sizes:
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
// Small size
|
|
125
|
+
<Command size="sm" />
|
|
126
|
+
|
|
127
|
+
// Medium size (default)
|
|
128
|
+
<Command size="md" />
|
|
129
|
+
|
|
130
|
+
// Large size
|
|
131
|
+
<Command size="lg" />
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### **Custom Empty State**
|
|
135
|
+
The Command component supports a custom empty state:
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
const customEmptyState = (
|
|
139
|
+
<View
|
|
140
|
+
alignItems="center"
|
|
141
|
+
justifyContent="center"
|
|
142
|
+
padding="24px"
|
|
143
|
+
flexDirection="column"
|
|
144
|
+
>
|
|
145
|
+
<Text fontSize="16px" fontWeight="bold" color="color.gray.600">
|
|
146
|
+
No commands found
|
|
147
|
+
</Text>
|
|
148
|
+
<Text fontSize="14px" color="color.gray.500" marginTop="8px">
|
|
149
|
+
Try a different search term
|
|
150
|
+
</Text>
|
|
151
|
+
</View>
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
<Command
|
|
155
|
+
open={open}
|
|
156
|
+
onOpenChange={setOpen}
|
|
157
|
+
commands={commands}
|
|
158
|
+
emptyState={customEmptyState}
|
|
159
|
+
/>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### **Custom Footer**
|
|
163
|
+
The Command component supports a custom footer:
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
const customFooter = (
|
|
167
|
+
<Horizontal justifyContent="space-between" width="100%">
|
|
168
|
+
<Text fontSize="12px" color="color.gray.500">
|
|
169
|
+
Press ↑↓ to navigate
|
|
170
|
+
</Text>
|
|
171
|
+
<Text fontSize="12px" color="color.gray.500">
|
|
172
|
+
Press Enter to select
|
|
173
|
+
</Text>
|
|
174
|
+
<Text fontSize="12px" color="color.gray.500">
|
|
175
|
+
Press Esc to close
|
|
176
|
+
</Text>
|
|
177
|
+
</Horizontal>
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
<Command
|
|
181
|
+
open={open}
|
|
182
|
+
onOpenChange={setOpen}
|
|
183
|
+
commands={commands}
|
|
184
|
+
footer={customFooter}
|
|
185
|
+
/>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### **Customization**
|
|
189
|
+
The Command component can be customized with the views prop:
|
|
190
|
+
|
|
191
|
+
```tsx
|
|
192
|
+
<Command
|
|
193
|
+
open={open}
|
|
194
|
+
onOpenChange={setOpen}
|
|
195
|
+
commands={commands}
|
|
196
|
+
views={{
|
|
197
|
+
container: {
|
|
198
|
+
backgroundColor: 'color.blue.50',
|
|
199
|
+
borderColor: 'color.blue.200',
|
|
200
|
+
borderWidth: '2px',
|
|
201
|
+
borderRadius: '12px',
|
|
202
|
+
},
|
|
203
|
+
searchInput: {
|
|
204
|
+
container: {
|
|
205
|
+
backgroundColor: 'color.white',
|
|
206
|
+
borderBottomColor: 'color.blue.200',
|
|
207
|
+
},
|
|
208
|
+
input: {
|
|
209
|
+
color: 'color.blue.800',
|
|
210
|
+
fontWeight: 'medium',
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
item: {
|
|
214
|
+
backgroundColor: 'transparent',
|
|
215
|
+
borderRadius: '8px',
|
|
216
|
+
_hover: {
|
|
217
|
+
backgroundColor: 'color.blue.100',
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
selectedItem: {
|
|
221
|
+
backgroundColor: 'color.blue.200',
|
|
222
|
+
_hover: {
|
|
223
|
+
backgroundColor: 'color.blue.300',
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
name: {
|
|
227
|
+
color: 'color.blue.800',
|
|
228
|
+
fontWeight: 'bold',
|
|
229
|
+
},
|
|
230
|
+
description: {
|
|
231
|
+
color: 'color.blue.600',
|
|
232
|
+
},
|
|
233
|
+
shortcut: {
|
|
234
|
+
backgroundColor: 'color.white',
|
|
235
|
+
padding: '2px 6px',
|
|
236
|
+
borderRadius: '4px',
|
|
237
|
+
fontWeight: 'bold',
|
|
238
|
+
},
|
|
239
|
+
footer: {
|
|
240
|
+
backgroundColor: 'color.white',
|
|
241
|
+
borderTopColor: 'color.blue.200',
|
|
242
|
+
},
|
|
243
|
+
}}
|
|
244
|
+
/>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### **Keyboard Navigation**
|
|
248
|
+
The Command component supports keyboard navigation:
|
|
249
|
+
|
|
250
|
+
- `↑` and `↓` to navigate between commands
|
|
251
|
+
- `Enter` to select a command
|
|
252
|
+
- `Escape` to close the command palette
|