@neynar/ui 1.0.1 → 1.0.3

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 (68) hide show
  1. package/context7.json +17 -0
  2. package/llm/components/accordion.llm.md +205 -0
  3. package/llm/components/alert-dialog.llm.md +289 -0
  4. package/llm/components/alert.llm.md +310 -0
  5. package/llm/components/aspect-ratio.llm.md +110 -0
  6. package/llm/components/avatar.llm.md +282 -0
  7. package/llm/components/badge.llm.md +185 -0
  8. package/llm/components/blockquote.llm.md +86 -0
  9. package/llm/components/breadcrumb.llm.md +245 -0
  10. package/llm/components/button-group.llm.md +248 -0
  11. package/llm/components/button.llm.md +247 -0
  12. package/llm/components/calendar.llm.md +252 -0
  13. package/llm/components/card.llm.md +356 -0
  14. package/llm/components/carousel.llm.md +281 -0
  15. package/llm/components/chart.llm.md +278 -0
  16. package/llm/components/checkbox.llm.md +234 -0
  17. package/llm/components/code.llm.md +75 -0
  18. package/llm/components/collapsible.llm.md +271 -0
  19. package/llm/components/color-mode.llm.md +196 -0
  20. package/llm/components/combobox.llm.md +346 -0
  21. package/llm/components/command.llm.md +353 -0
  22. package/llm/components/context-menu.llm.md +368 -0
  23. package/llm/components/dialog.llm.md +283 -0
  24. package/llm/components/drawer.llm.md +326 -0
  25. package/llm/components/dropdown-menu.llm.md +404 -0
  26. package/llm/components/empty.llm.md +282 -0
  27. package/llm/components/field.llm.md +303 -0
  28. package/llm/components/first-light.llm.md +129 -0
  29. package/llm/components/hover-card.llm.md +278 -0
  30. package/llm/components/input-group.llm.md +334 -0
  31. package/llm/components/input-otp.llm.md +270 -0
  32. package/llm/components/input.llm.md +197 -0
  33. package/llm/components/item.llm.md +347 -0
  34. package/llm/components/kbd.llm.md +221 -0
  35. package/llm/components/label.llm.md +219 -0
  36. package/llm/components/menubar.llm.md +378 -0
  37. package/llm/components/navigation-menu.llm.md +320 -0
  38. package/llm/components/pagination.llm.md +337 -0
  39. package/llm/components/popover.llm.md +278 -0
  40. package/llm/components/progress.llm.md +259 -0
  41. package/llm/components/radio-group.llm.md +269 -0
  42. package/llm/components/resizable.llm.md +222 -0
  43. package/llm/components/scroll-area.llm.md +290 -0
  44. package/llm/components/select.llm.md +338 -0
  45. package/llm/components/separator.llm.md +129 -0
  46. package/llm/components/sheet.llm.md +275 -0
  47. package/llm/components/sidebar.llm.md +528 -0
  48. package/llm/components/skeleton.llm.md +140 -0
  49. package/llm/components/slider.llm.md +213 -0
  50. package/llm/components/sonner.llm.md +299 -0
  51. package/llm/components/spinner.llm.md +187 -0
  52. package/llm/components/switch.llm.md +258 -0
  53. package/llm/components/table.llm.md +334 -0
  54. package/llm/components/tabs.llm.md +245 -0
  55. package/llm/components/text.llm.md +108 -0
  56. package/llm/components/textarea.llm.md +236 -0
  57. package/llm/components/title.llm.md +88 -0
  58. package/llm/components/toggle-group.llm.md +228 -0
  59. package/llm/components/toggle.llm.md +235 -0
  60. package/llm/components/tooltip.llm.md +191 -0
  61. package/llm/contributing.llm.md +273 -0
  62. package/llm/hooks.llm.md +91 -0
  63. package/llm/index.llm.md +178 -0
  64. package/llm/theming.llm.md +381 -0
  65. package/llm/utilities.llm.md +97 -0
  66. package/llms-full.txt +15995 -0
  67. package/llms.txt +182 -0
  68. package/package.json +5 -1
@@ -0,0 +1,353 @@
1
+ # Command
2
+
3
+ Fast, accessible command palette with keyboard navigation and fuzzy search built on cmdk.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import {
9
+ Command,
10
+ CommandDialog,
11
+ CommandInput,
12
+ CommandList,
13
+ CommandEmpty,
14
+ CommandGroup,
15
+ CommandItem,
16
+ CommandSeparator,
17
+ CommandShortcut,
18
+ } from "@neynar/ui/command"
19
+ ```
20
+
21
+ ## Anatomy
22
+
23
+ ```tsx
24
+ <CommandDialog open={open} onOpenChange={setOpen}>
25
+ <Command>
26
+ <CommandInput placeholder="Search..." />
27
+ <CommandList>
28
+ <CommandEmpty>No results found.</CommandEmpty>
29
+ <CommandGroup heading="Navigation">
30
+ <CommandItem onSelect={handleSelect}>
31
+ Dashboard
32
+ <CommandShortcut>⌘D</CommandShortcut>
33
+ </CommandItem>
34
+ </CommandGroup>
35
+ <CommandSeparator />
36
+ <CommandGroup heading="Actions">
37
+ <CommandItem>Create</CommandItem>
38
+ </CommandGroup>
39
+ </CommandList>
40
+ </Command>
41
+ </CommandDialog>
42
+ ```
43
+
44
+ ## Components
45
+
46
+ | Component | Description |
47
+ |-----------|-------------|
48
+ | Command | Root container with fuzzy search and keyboard navigation |
49
+ | CommandDialog | Command wrapped in modal dialog, typical for ⌘K palettes |
50
+ | CommandInput | Search input with integrated search icon |
51
+ | CommandList | Scrollable container for groups/items (max-h-72) |
52
+ | CommandEmpty | Displayed when search returns no results |
53
+ | CommandGroup | Groups related items with optional heading |
54
+ | CommandItem | Selectable item, automatically shows check icon when selected |
55
+ | CommandSeparator | Visual divider between groups |
56
+ | CommandShortcut | Keyboard shortcut label, auto-aligned right |
57
+
58
+ ## Props
59
+
60
+ ### Command
61
+
62
+ Extends cmdk's Command component.
63
+
64
+ | Prop | Type | Default | Description |
65
+ |------|------|---------|-------------|
66
+ | label | string | - | Accessible label for screen readers |
67
+ | value | string | - | Controlled selected value |
68
+ | onValueChange | (value: string) => void | - | Called when selection changes |
69
+ | filter | (value: string, search: string) => number | - | Custom filter function (0-1 score) |
70
+ | className | string | - | Additional CSS classes |
71
+
72
+ ### CommandDialog
73
+
74
+ Wraps Command in a modal dialog with portal and overlay.
75
+
76
+ | Prop | Type | Default | Description |
77
+ |------|------|---------|-------------|
78
+ | open | boolean | - | Controlled open state |
79
+ | onOpenChange | (open: boolean) => void | - | Called when open state changes |
80
+ | title | string | "Command Palette" | Dialog title (screen readers only) |
81
+ | description | string | "Search for a command..." | Dialog description (screen readers only) |
82
+ | showCloseButton | boolean | false | Show X button in top-right corner |
83
+ | className | string | - | Additional CSS classes for content |
84
+
85
+ Title and description are visually hidden but read by screen readers for accessibility.
86
+
87
+ ### CommandInput
88
+
89
+ | Prop | Type | Default | Description |
90
+ |------|------|---------|-------------|
91
+ | placeholder | string | - | Input placeholder text |
92
+ | value | string | - | Controlled input value |
93
+ | onValueChange | (search: string) => void | - | Called when input changes |
94
+ | className | string | - | Additional CSS classes |
95
+
96
+ Search icon is automatically included on the right side of the input.
97
+
98
+ ### CommandList
99
+
100
+ | Prop | Type | Default | Description |
101
+ |------|------|---------|-------------|
102
+ | className | string | - | Additional CSS classes |
103
+
104
+ Automatically handles scrolling with max height of 18rem (72). Hidden scrollbar for clean appearance.
105
+
106
+ ### CommandEmpty
107
+
108
+ | Prop | Type | Default | Description |
109
+ |------|------|---------|-------------|
110
+ | children | ReactNode | - | Content shown when no results |
111
+ | className | string | - | Additional CSS classes |
112
+
113
+ Automatically displayed when search returns no matching items.
114
+
115
+ ### CommandGroup
116
+
117
+ | Prop | Type | Default | Description |
118
+ |------|------|---------|-------------|
119
+ | heading | string | - | Optional group label |
120
+ | className | string | - | Additional CSS classes |
121
+
122
+ ### CommandItem
123
+
124
+ | Prop | Type | Default | Description |
125
+ |------|------|---------|-------------|
126
+ | value | string | - | Unique value (auto-inferred from textContent if omitted) |
127
+ | keywords | string[] | - | Additional search keywords |
128
+ | onSelect | (value: string) => void | - | Called when item is selected |
129
+ | disabled | boolean | - | Disable selection |
130
+ | className | string | - | Additional CSS classes |
131
+
132
+ Check icon automatically appears when item is selected (hidden if CommandShortcut is present).
133
+
134
+ ### CommandShortcut
135
+
136
+ | Prop | Type | Default | Description |
137
+ |------|------|---------|-------------|
138
+ | children | ReactNode | - | Shortcut text (e.g., "⌘K") |
139
+ | className | string | - | Additional CSS classes |
140
+
141
+ Automatically positioned at the end of the command item and hides the check icon.
142
+
143
+ ### CommandSeparator
144
+
145
+ | Prop | Type | Default | Description |
146
+ |------|------|---------|-------------|
147
+ | className | string | - | Additional CSS classes |
148
+
149
+ ## Data Attributes
150
+
151
+ ### CommandItem
152
+
153
+ | Attribute | When Present |
154
+ |-----------|--------------|
155
+ | data-selected | Item is currently highlighted/active |
156
+ | data-disabled | Item is disabled (disabled={true}) |
157
+ | data-checked | Item is marked as checked/selected |
158
+
159
+ Use these for custom styling based on item state.
160
+
161
+ ## Examples
162
+
163
+ ### Basic Command Palette
164
+
165
+ ```tsx
166
+ function QuickActions() {
167
+ const [open, setOpen] = useState(false)
168
+
169
+ useEffect(() => {
170
+ const down = (e: KeyboardEvent) => {
171
+ if (e.key === "k" && (e.metaKey || e.ctrlKey)) {
172
+ e.preventDefault()
173
+ setOpen((open) => !open)
174
+ }
175
+ }
176
+ document.addEventListener("keydown", down)
177
+ return () => document.removeEventListener("keydown", down)
178
+ }, [])
179
+
180
+ return (
181
+ <CommandDialog open={open} onOpenChange={setOpen}>
182
+ <Command>
183
+ <CommandInput placeholder="Type a command or search..." />
184
+ <CommandList>
185
+ <CommandEmpty>No results found.</CommandEmpty>
186
+ <CommandGroup heading="Actions">
187
+ <CommandItem onSelect={() => console.log("Dashboard")}>
188
+ <LayoutDashboardIcon />
189
+ Dashboard
190
+ <CommandShortcut>⌘D</CommandShortcut>
191
+ </CommandItem>
192
+ <CommandItem onSelect={() => console.log("Settings")}>
193
+ <SettingsIcon />
194
+ Settings
195
+ <CommandShortcut>⌘,</CommandShortcut>
196
+ </CommandItem>
197
+ </CommandGroup>
198
+ </CommandList>
199
+ </Command>
200
+ </CommandDialog>
201
+ )
202
+ }
203
+ ```
204
+
205
+ ### Multiple Groups with Separators
206
+
207
+ ```tsx
208
+ <Command>
209
+ <CommandInput placeholder="Search..." />
210
+ <CommandList>
211
+ <CommandEmpty>No results found.</CommandEmpty>
212
+
213
+ <CommandGroup heading="Navigation">
214
+ <CommandItem>
215
+ <LayoutDashboardIcon />
216
+ Dashboard
217
+ </CommandItem>
218
+ <CommandItem>
219
+ <BarChart3Icon />
220
+ Analytics
221
+ </CommandItem>
222
+ </CommandGroup>
223
+
224
+ <CommandSeparator />
225
+
226
+ <CommandGroup heading="Settings">
227
+ <CommandItem>
228
+ <UserIcon />
229
+ Profile
230
+ </CommandItem>
231
+ <CommandItem>
232
+ <SettingsIcon />
233
+ Preferences
234
+ </CommandItem>
235
+ </CommandGroup>
236
+ </CommandList>
237
+ </Command>
238
+ ```
239
+
240
+ ### Controlled with Loading States
241
+
242
+ ```tsx
243
+ function CommandWithLoading() {
244
+ const [open, setOpen] = useState(false)
245
+ const [loading, setLoading] = useState(false)
246
+ const [selectedCommand, setSelectedCommand] = useState<string | null>(null)
247
+
248
+ const handleSelect = (value: string) => {
249
+ setSelectedCommand(value)
250
+ setLoading(true)
251
+
252
+ // Simulate async action
253
+ setTimeout(() => {
254
+ setLoading(false)
255
+ setOpen(false)
256
+ setSelectedCommand(null)
257
+ }, 1000)
258
+ }
259
+
260
+ return (
261
+ <CommandDialog open={open} onOpenChange={setOpen}>
262
+ <Command>
263
+ <CommandInput placeholder="Type a command..." />
264
+ <CommandList>
265
+ <CommandEmpty>No results found.</CommandEmpty>
266
+ <CommandGroup heading="Actions">
267
+ <CommandItem
268
+ onSelect={() => handleSelect("create")}
269
+ disabled={loading && selectedCommand === "create"}
270
+ >
271
+ {loading && selectedCommand === "create" ? (
272
+ <Loader2Icon className="animate-spin" />
273
+ ) : (
274
+ <ZapIcon />
275
+ )}
276
+ Create API Key
277
+ <CommandShortcut>⌘N</CommandShortcut>
278
+ </CommandItem>
279
+ </CommandGroup>
280
+ </CommandList>
281
+ </Command>
282
+ </CommandDialog>
283
+ )
284
+ }
285
+ ```
286
+
287
+ ### Custom Empty State
288
+
289
+ ```tsx
290
+ <Command>
291
+ <CommandInput placeholder="Search documentation..." />
292
+ <CommandList>
293
+ <CommandEmpty>
294
+ <div className="py-6 text-center">
295
+ <p className="text-sm">No results found.</p>
296
+ <p className="text-muted-foreground mt-1 text-xs">
297
+ Try a different search term or check the docs.
298
+ </p>
299
+ </div>
300
+ </CommandEmpty>
301
+ <CommandGroup heading="Documentation">
302
+ <CommandItem>Getting Started</CommandItem>
303
+ <CommandItem>API Reference</CommandItem>
304
+ </CommandGroup>
305
+ </CommandList>
306
+ </Command>
307
+ ```
308
+
309
+ ### Without Dialog (Inline)
310
+
311
+ ```tsx
312
+ <Command className="w-full max-w-md rounded-lg border">
313
+ <CommandInput placeholder="Search commands..." />
314
+ <CommandList>
315
+ <CommandEmpty>No results found.</CommandEmpty>
316
+ <CommandGroup heading="Actions">
317
+ <CommandItem>
318
+ <FileTextIcon />
319
+ New File
320
+ </CommandItem>
321
+ <CommandItem>
322
+ <UserIcon />
323
+ New User
324
+ </CommandItem>
325
+ </CommandGroup>
326
+ </CommandList>
327
+ </Command>
328
+ ```
329
+
330
+ ## Keyboard
331
+
332
+ | Key | Action |
333
+ |-----|--------|
334
+ | ⌘K / Ctrl+K | Open command palette (app implementation) |
335
+ | ↓ / ↑ | Navigate items |
336
+ | Enter | Select highlighted item |
337
+ | Escape | Close dialog |
338
+ | Home / End | Jump to first/last item |
339
+ | Type | Filter items by fuzzy search |
340
+
341
+ ## Accessibility
342
+
343
+ - Full keyboard navigation with arrow keys and Enter
344
+ - ARIA attributes automatically applied to items and groups
345
+ - Screen reader support for search input and results count
346
+ - Focus management when opening/closing dialog
347
+ - DialogTitle and DialogDescription provided for screen readers (visually hidden)
348
+ - Disabled items marked with `aria-disabled` and cannot be selected
349
+
350
+ ## Related
351
+
352
+ - [Dialog](/Users/bobringer/work/neynar/worktrees/frontend-monorepo/neyn-8162-nas-baseui-upgrade./dialog.llm.md) - Command dialog uses Dialog internally
353
+ - [Input Group](/Users/bobringer/work/neynar/worktrees/frontend-monorepo/neyn-8162-nas-baseui-upgrade./input-group.llm.md) - CommandInput uses InputGroup for icon layout