@neynar/ui 1.0.0 → 1.0.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.
Files changed (69) hide show
  1. package/README.md +1 -1
  2. package/context7.json +17 -0
  3. package/llm/components/accordion.llm.md +205 -0
  4. package/llm/components/alert-dialog.llm.md +289 -0
  5. package/llm/components/alert.llm.md +310 -0
  6. package/llm/components/aspect-ratio.llm.md +110 -0
  7. package/llm/components/avatar.llm.md +282 -0
  8. package/llm/components/badge.llm.md +185 -0
  9. package/llm/components/blockquote.llm.md +86 -0
  10. package/llm/components/breadcrumb.llm.md +245 -0
  11. package/llm/components/button-group.llm.md +248 -0
  12. package/llm/components/button.llm.md +247 -0
  13. package/llm/components/calendar.llm.md +252 -0
  14. package/llm/components/card.llm.md +356 -0
  15. package/llm/components/carousel.llm.md +281 -0
  16. package/llm/components/chart.llm.md +278 -0
  17. package/llm/components/checkbox.llm.md +234 -0
  18. package/llm/components/code.llm.md +75 -0
  19. package/llm/components/collapsible.llm.md +271 -0
  20. package/llm/components/color-mode.llm.md +196 -0
  21. package/llm/components/combobox.llm.md +346 -0
  22. package/llm/components/command.llm.md +353 -0
  23. package/llm/components/context-menu.llm.md +368 -0
  24. package/llm/components/dialog.llm.md +283 -0
  25. package/llm/components/drawer.llm.md +326 -0
  26. package/llm/components/dropdown-menu.llm.md +404 -0
  27. package/llm/components/empty.llm.md +282 -0
  28. package/llm/components/field.llm.md +303 -0
  29. package/llm/components/first-light.llm.md +129 -0
  30. package/llm/components/hover-card.llm.md +278 -0
  31. package/llm/components/input-group.llm.md +334 -0
  32. package/llm/components/input-otp.llm.md +270 -0
  33. package/llm/components/input.llm.md +197 -0
  34. package/llm/components/item.llm.md +347 -0
  35. package/llm/components/kbd.llm.md +221 -0
  36. package/llm/components/label.llm.md +219 -0
  37. package/llm/components/menubar.llm.md +378 -0
  38. package/llm/components/navigation-menu.llm.md +320 -0
  39. package/llm/components/pagination.llm.md +337 -0
  40. package/llm/components/popover.llm.md +278 -0
  41. package/llm/components/progress.llm.md +259 -0
  42. package/llm/components/radio-group.llm.md +269 -0
  43. package/llm/components/resizable.llm.md +222 -0
  44. package/llm/components/scroll-area.llm.md +290 -0
  45. package/llm/components/select.llm.md +338 -0
  46. package/llm/components/separator.llm.md +129 -0
  47. package/llm/components/sheet.llm.md +275 -0
  48. package/llm/components/sidebar.llm.md +528 -0
  49. package/llm/components/skeleton.llm.md +140 -0
  50. package/llm/components/slider.llm.md +213 -0
  51. package/llm/components/sonner.llm.md +299 -0
  52. package/llm/components/spinner.llm.md +187 -0
  53. package/llm/components/switch.llm.md +258 -0
  54. package/llm/components/table.llm.md +334 -0
  55. package/llm/components/tabs.llm.md +245 -0
  56. package/llm/components/text.llm.md +108 -0
  57. package/llm/components/textarea.llm.md +236 -0
  58. package/llm/components/title.llm.md +88 -0
  59. package/llm/components/toggle-group.llm.md +228 -0
  60. package/llm/components/toggle.llm.md +235 -0
  61. package/llm/components/tooltip.llm.md +191 -0
  62. package/llm/contributing.llm.md +273 -0
  63. package/llm/hooks.llm.md +91 -0
  64. package/llm/index.llm.md +178 -0
  65. package/llm/theming.llm.md +381 -0
  66. package/llm/utilities.llm.md +97 -0
  67. package/llms-full.txt +15995 -0
  68. package/llms.txt +182 -0
  69. package/package.json +6 -2
@@ -0,0 +1,221 @@
1
+ # Kbd
2
+
3
+ Display keyboard shortcuts and key combinations with consistent styling.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { Kbd, KbdGroup } from "@neynar/ui/kbd"
9
+ ```
10
+
11
+ ## Anatomy
12
+
13
+ ```tsx
14
+ // Single key
15
+ <Kbd>K</Kbd>
16
+
17
+ // Key combination
18
+ <KbdGroup>
19
+ <Kbd><CommandIcon /></Kbd>
20
+ <Kbd>K</Kbd>
21
+ </KbdGroup>
22
+ ```
23
+
24
+ ## Components
25
+
26
+ | Component | Description |
27
+ |-----------|-------------|
28
+ | Kbd | Individual keyboard key display (text or icon) |
29
+ | KbdGroup | Container for multiple keys pressed together or in sequence |
30
+
31
+ ## Props
32
+
33
+ ### Kbd
34
+
35
+ Extends standard HTML `<kbd>` element props.
36
+
37
+ | Prop | Type | Default | Description |
38
+ |------|------|---------|-------------|
39
+ | children | ReactNode | - | Key text or icon (e.g., "K", `<CommandIcon />`) |
40
+ | className | string | - | Additional CSS classes |
41
+
42
+ **Auto-styling:**
43
+ - Fixed height (h-5), auto width with minimum size
44
+ - Muted background and foreground colors
45
+ - Non-interactive (pointer-events-none, select-none)
46
+ - Icons auto-sized to size-3
47
+ - Special styling when used in tooltips
48
+
49
+ ### KbdGroup
50
+
51
+ Extends standard HTML `<div>` element props (rendered as `<kbd>` tag).
52
+
53
+ | Prop | Type | Default | Description |
54
+ |------|------|---------|-------------|
55
+ | children | ReactNode | - | Multiple `<Kbd>` components |
56
+ | className | string | - | Additional CSS classes |
57
+
58
+ **Auto-behaviors:**
59
+ - Horizontal flex layout with gap-1
60
+ - Use for simultaneous keys (Cmd+K) or sequential keys (G→H)
61
+
62
+ ## Data Attributes
63
+
64
+ | Attribute | Component | Description |
65
+ |-----------|-----------|-------------|
66
+ | data-slot="kbd" | Kbd | Identifies individual key element |
67
+ | data-slot="kbd-group" | KbdGroup | Identifies key combination container |
68
+
69
+ ## Examples
70
+
71
+ ### Single Keys
72
+
73
+ ```tsx
74
+ <div className="flex gap-2">
75
+ <Kbd>A</Kbd>
76
+ <Kbd>Esc</Kbd>
77
+ <Kbd>Enter</Kbd>
78
+ <Kbd>Space</Kbd>
79
+ </div>
80
+ ```
81
+
82
+ ### Keys with Icons
83
+
84
+ ```tsx
85
+ import { CommandIcon, ArrowUpIcon, CornerDownLeftIcon } from "lucide-react"
86
+
87
+ <div className="flex gap-2">
88
+ <Kbd><CommandIcon /></Kbd>
89
+ <Kbd><ArrowUpIcon /></Kbd>
90
+ <Kbd><CornerDownLeftIcon /></Kbd>
91
+ </div>
92
+ ```
93
+
94
+ Icons are automatically sized to fit the kbd container.
95
+
96
+ ### Key Combinations (Simultaneous)
97
+
98
+ ```tsx
99
+ // Cmd+K (command palette)
100
+ <KbdGroup>
101
+ <Kbd><CommandIcon /></Kbd>
102
+ <Kbd>K</Kbd>
103
+ </KbdGroup>
104
+
105
+ // Cmd+Shift+P
106
+ <KbdGroup>
107
+ <Kbd><CommandIcon /></Kbd>
108
+ <Kbd>Shift</Kbd>
109
+ <Kbd>P</Kbd>
110
+ </KbdGroup>
111
+
112
+ // Ctrl+Alt+Delete
113
+ <KbdGroup>
114
+ <Kbd>Ctrl</Kbd>
115
+ <Kbd>Alt</Kbd>
116
+ <Kbd><DeleteIcon /></Kbd>
117
+ </KbdGroup>
118
+ ```
119
+
120
+ ### Sequential Keys (Vim-like)
121
+
122
+ ```tsx
123
+ // G then H (Go Home)
124
+ <KbdGroup>
125
+ <Kbd>G</Kbd>
126
+ <Kbd>H</Kbd>
127
+ </KbdGroup>
128
+
129
+ // G then D (Go Dashboard)
130
+ <KbdGroup>
131
+ <Kbd>G</Kbd>
132
+ <Kbd>D</Kbd>
133
+ </KbdGroup>
134
+ ```
135
+
136
+ KbdGroup works for both simultaneous and sequential shortcuts - context determines meaning.
137
+
138
+ ### In Documentation/Prose
139
+
140
+ ```tsx
141
+ <p>
142
+ To open the command palette, press{" "}
143
+ <KbdGroup>
144
+ <Kbd><CommandIcon /></Kbd>
145
+ <Kbd>K</Kbd>
146
+ </KbdGroup>{" "}
147
+ at any time.
148
+ </p>
149
+
150
+ <p>
151
+ Use <Kbd><ArrowUpIcon /></Kbd> and <Kbd><ArrowDownIcon /></Kbd> to navigate,
152
+ then press <Kbd><CornerDownLeftIcon /></Kbd> to select.
153
+ </p>
154
+ ```
155
+
156
+ ### Keyboard Shortcuts Help Panel
157
+
158
+ ```tsx
159
+ function ShortcutsHelp() {
160
+ const shortcuts = [
161
+ {
162
+ keys: <KbdGroup><Kbd><CommandIcon /></Kbd><Kbd>K</Kbd></KbdGroup>,
163
+ description: "Open command palette"
164
+ },
165
+ {
166
+ keys: <KbdGroup><Kbd><CommandIcon /></Kbd><Kbd>S</Kbd></KbdGroup>,
167
+ description: "Save changes"
168
+ },
169
+ {
170
+ keys: <Kbd>Esc</Kbd>,
171
+ description: "Close dialog"
172
+ }
173
+ ]
174
+
175
+ return (
176
+ <div className="space-y-2">
177
+ {shortcuts.map((shortcut, idx) => (
178
+ <div key={idx} className="flex justify-between">
179
+ <span>{shortcut.description}</span>
180
+ {shortcut.keys}
181
+ </div>
182
+ ))}
183
+ </div>
184
+ )
185
+ }
186
+ ```
187
+
188
+ ### Common Shortcuts Grid
189
+
190
+ ```tsx
191
+ <div className="grid grid-cols-2 gap-4">
192
+ <div className="flex justify-between">
193
+ <span>Save</span>
194
+ <KbdGroup><Kbd><CommandIcon /></Kbd><Kbd>S</Kbd></KbdGroup>
195
+ </div>
196
+ <div className="flex justify-between">
197
+ <span>Copy</span>
198
+ <KbdGroup><Kbd><CommandIcon /></Kbd><Kbd>C</Kbd></KbdGroup>
199
+ </div>
200
+ <div className="flex justify-between">
201
+ <span>Paste</span>
202
+ <KbdGroup><Kbd><CommandIcon /></Kbd><Kbd>V</Kbd></KbdGroup>
203
+ </div>
204
+ <div className="flex justify-between">
205
+ <span>Undo</span>
206
+ <KbdGroup><Kbd><CommandIcon /></Kbd><Kbd>Z</Kbd></KbdGroup>
207
+ </div>
208
+ </div>
209
+ ```
210
+
211
+ ## Accessibility
212
+
213
+ - Uses semantic `<kbd>` HTML element for keyboard input
214
+ - Non-interactive by default (pointer-events-none, select-none)
215
+ - Text content is screen-reader accessible
216
+ - Icon-only keys may need aria-label on parent for context
217
+
218
+ ## Related
219
+
220
+ - [Tooltip](/docs/components/tooltip.llm.md) - Often used together to show shortcuts on hover
221
+ - [Command](/docs/components/command.llm.md) - Command palette that displays kbd shortcuts
@@ -0,0 +1,219 @@
1
+ # Label
2
+
3
+ Accessible label component for form controls with automatic disabled state styling.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { Label } from "@neynar/ui/label"
9
+ ```
10
+
11
+ ## Anatomy
12
+
13
+ ```tsx
14
+ <Label htmlFor="input-id">Label Text</Label>
15
+ <Input id="input-id" />
16
+ ```
17
+
18
+ ## Props
19
+
20
+ Extends all native HTML `<label>` element props including:
21
+
22
+ | Prop | Type | Description |
23
+ |------|------|-------------|
24
+ | htmlFor | string | ID of the associated form control (creates accessible relationship) |
25
+ | className | string | Additional CSS classes |
26
+ | children | ReactNode | Label content (text, icons, indicators, etc.) |
27
+
28
+ ### Automatic Disabled States
29
+
30
+ The Label component automatically responds to disabled states:
31
+ - **peer-disabled**: When the associated input uses `disabled` prop
32
+ - **group-data-[disabled=true]**: When wrapped in a disabled group/fieldset
33
+
34
+ ## Data Attributes
35
+
36
+ | Attribute | Value |
37
+ |-----------|-------|
38
+ | data-slot | "label" |
39
+
40
+ ## Examples
41
+
42
+ ### Basic Label with Input
43
+
44
+ ```tsx
45
+ <div className="space-y-2">
46
+ <Label htmlFor="email">Email Address</Label>
47
+ <Input id="email" type="email" placeholder="you@example.com" />
48
+ </div>
49
+ ```
50
+
51
+ ### Required Field Indicator
52
+
53
+ ```tsx
54
+ <Label htmlFor="username">
55
+ Username
56
+ <span className="text-destructive ml-1">*</span>
57
+ </Label>
58
+ <Input id="username" required />
59
+ ```
60
+
61
+ ### Label with Helper Icon
62
+
63
+ ```tsx
64
+ import { InfoIcon } from "lucide-react"
65
+
66
+ <Label htmlFor="api-key">
67
+ API Key
68
+ <InfoIcon className="text-muted-foreground ml-1 size-3.5" />
69
+ </Label>
70
+ <Input id="api-key" />
71
+ <p className="text-muted-foreground text-sm">
72
+ Find your API key in the dashboard settings
73
+ </p>
74
+ ```
75
+
76
+ ### Checkbox Label Pattern
77
+
78
+ ```tsx
79
+ <div className="flex items-center space-x-2">
80
+ <Checkbox id="terms" />
81
+ <Label htmlFor="terms" className="font-normal cursor-pointer">
82
+ I agree to the terms and conditions
83
+ </Label>
84
+ </div>
85
+ ```
86
+
87
+ ### Radio Group Label Pattern
88
+
89
+ ```tsx
90
+ <div className="space-y-3">
91
+ <Label className="font-medium">Choose an option</Label>
92
+ <RadioGroup defaultValue="option-1">
93
+ <div className="flex items-center space-x-2">
94
+ <RadioGroupItem value="option-1" id="opt-1" />
95
+ <Label htmlFor="opt-1" className="font-normal cursor-pointer">
96
+ Option 1
97
+ </Label>
98
+ </div>
99
+ <div className="flex items-center space-x-2">
100
+ <RadioGroupItem value="option-2" id="opt-2" />
101
+ <Label htmlFor="opt-2" className="font-normal cursor-pointer">
102
+ Option 2
103
+ </Label>
104
+ </div>
105
+ </RadioGroup>
106
+ </div>
107
+ ```
108
+
109
+ ### Switch with Description
110
+
111
+ ```tsx
112
+ <div className="flex items-center justify-between">
113
+ <div className="space-y-0.5">
114
+ <Label htmlFor="notifications">Email Notifications</Label>
115
+ <p className="text-muted-foreground text-sm">
116
+ Receive email alerts for updates
117
+ </p>
118
+ </div>
119
+ <Switch id="notifications" />
120
+ </div>
121
+ ```
122
+
123
+ ### Disabled State
124
+
125
+ ```tsx
126
+ <div className="space-y-2">
127
+ <Label htmlFor="disabled-input" className="opacity-50">
128
+ Disabled Field
129
+ </Label>
130
+ <Input id="disabled-input" disabled />
131
+ </div>
132
+ ```
133
+
134
+ ### Error State
135
+
136
+ ```tsx
137
+ <div className="space-y-2">
138
+ <Label htmlFor="error-input" className="text-destructive">
139
+ Invalid Field
140
+ </Label>
141
+ <Input id="error-input" aria-invalid="true" />
142
+ <p className="text-destructive text-sm">This field is required</p>
143
+ </div>
144
+ ```
145
+
146
+ ### Horizontal Form Layout
147
+
148
+ ```tsx
149
+ <div className="grid grid-cols-3 items-center gap-4">
150
+ <Label htmlFor="username" className="text-right">
151
+ Username
152
+ </Label>
153
+ <Input id="username" className="col-span-2" />
154
+ </div>
155
+ ```
156
+
157
+ ### Complex Label with Badge
158
+
159
+ ```tsx
160
+ <Label htmlFor="api-endpoint" className="flex items-center gap-2">
161
+ API Endpoint
162
+ <span className="bg-primary/10 text-primary rounded px-1.5 py-0.5 text-xs font-medium">
163
+ Required
164
+ </span>
165
+ </Label>
166
+ <Input id="api-endpoint" required />
167
+ ```
168
+
169
+ ### Label with Link
170
+
171
+ ```tsx
172
+ <Label htmlFor="webhook">
173
+ Webhook URL
174
+ <a href="/docs/webhooks" className="text-primary hover:underline ml-1 text-xs font-normal">
175
+ (Learn more)
176
+ </a>
177
+ </Label>
178
+ <Input id="webhook" type="url" />
179
+ ```
180
+
181
+ ## Accessibility
182
+
183
+ - Uses native `<label>` element for proper form control association
184
+ - Clicking the label focuses/activates the associated control via `htmlFor` prop
185
+ - Automatically handles disabled state styling via `peer-disabled` and `group-data-[disabled]`
186
+ - Screen readers announce the label text when the associated control receives focus
187
+ - Supports nested content (icons, badges, links) while maintaining accessibility
188
+
189
+ ## Styling Patterns
190
+
191
+ ### Font Weight Variations
192
+
193
+ ```tsx
194
+ {/* Default: font-medium */}
195
+ <Label htmlFor="default">Default Weight</Label>
196
+
197
+ {/* Normal weight for checkbox/radio labels */}
198
+ <Label htmlFor="checkbox" className="font-normal">
199
+ Checkbox Option
200
+ </Label>
201
+ ```
202
+
203
+ ### Cursor Styles
204
+
205
+ ```tsx
206
+ {/* Clickable for checkbox/radio */}
207
+ <Label htmlFor="check" className="cursor-pointer">
208
+
209
+ {/* Not allowed for disabled */}
210
+ <Label htmlFor="disabled" className="cursor-not-allowed">
211
+ ```
212
+
213
+ ## Related
214
+
215
+ - [Input](./input.llm.md) - Text input component
216
+ - [Checkbox](./checkbox.llm.md) - Checkbox component
217
+ - [Radio Group](./radio-group.llm.md) - Radio button group
218
+ - [Switch](./switch.llm.md) - Toggle switch
219
+ - [Textarea](./textarea.llm.md) - Multi-line text input