@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,234 @@
1
+ # Checkbox
2
+
3
+ Binary selection component for forms, settings, and multi-select interfaces.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { Checkbox } from "@neynar/ui/checkbox"
9
+ ```
10
+
11
+ ## Anatomy
12
+
13
+ ```tsx
14
+ <Checkbox />
15
+ ```
16
+
17
+ The component includes a built-in indicator with check icon - no need for separate child components.
18
+
19
+ ## Props
20
+
21
+ All Base UI Checkbox.Root props are supported. Common props:
22
+
23
+ | Prop | Type | Default | Description |
24
+ |------|------|---------|-------------|
25
+ | checked | boolean | - | Controlled checked state |
26
+ | defaultChecked | boolean | false | Initial checked state (uncontrolled) |
27
+ | onCheckedChange | (checked: boolean) => void | - | Called when state changes |
28
+ | disabled | boolean | false | Prevents user interaction |
29
+ | required | boolean | false | Must be checked before form submission |
30
+ | name | string | - | Form field name |
31
+ | value | string | - | Form value when checked |
32
+ | indeterminate | boolean | false | Show indeterminate/mixed state |
33
+ | readOnly | boolean | false | Prevents state changes but shows value |
34
+
35
+ ### Styling Props
36
+
37
+ | Prop | Type | Description |
38
+ |------|------|-------------|
39
+ | className | string | Additional CSS classes |
40
+
41
+ ## Data Attributes
42
+
43
+ Use these for custom styling:
44
+
45
+ | Attribute | When Present |
46
+ |-----------|--------------|
47
+ | data-checked | Checkbox is checked |
48
+ | data-unchecked | Checkbox is unchecked |
49
+ | data-disabled | Component is disabled |
50
+ | data-readonly | Component is readonly |
51
+ | data-required | Field is required |
52
+ | data-invalid | Validation failed (with Field) |
53
+ | data-focused | Checkbox has focus |
54
+
55
+ ## Examples
56
+
57
+ ### Basic Usage
58
+
59
+ ```tsx
60
+ <label className="flex items-center gap-2">
61
+ <Checkbox />
62
+ <span>Accept terms and conditions</span>
63
+ </label>
64
+ ```
65
+
66
+ ### Controlled State
67
+
68
+ ```tsx
69
+ function NewsletterSubscription() {
70
+ const [subscribed, setSubscribed] = useState(false)
71
+
72
+ return (
73
+ <label className="flex items-center gap-2">
74
+ <Checkbox
75
+ checked={subscribed}
76
+ onCheckedChange={(checked) => setSubscribed(checked as boolean)}
77
+ />
78
+ <span>Subscribe to newsletter</span>
79
+ </label>
80
+ )
81
+ }
82
+ ```
83
+
84
+ ### With Label Component
85
+
86
+ ```tsx
87
+ import { Label } from "@neynar/ui/label"
88
+
89
+ <label className="flex items-center gap-2">
90
+ <Checkbox defaultChecked />
91
+ <Label>Enable notifications</Label>
92
+ </label>
93
+ ```
94
+
95
+ ### With Description
96
+
97
+ ```tsx
98
+ <label className="flex items-start gap-3">
99
+ <Checkbox defaultChecked />
100
+ <div className="flex-1">
101
+ <Label>Email notifications</Label>
102
+ <p className="text-muted-foreground text-xs">
103
+ Receive email updates about your account activity
104
+ </p>
105
+ </div>
106
+ </label>
107
+ ```
108
+
109
+ ### Form Integration
110
+
111
+ ```tsx
112
+ <form>
113
+ <fieldset className="space-y-3">
114
+ <legend className="text-sm font-medium">Preferences</legend>
115
+
116
+ <label className="flex items-center gap-2">
117
+ <Checkbox name="weekly-summary" defaultChecked />
118
+ <Label>Send weekly summaries</Label>
119
+ </label>
120
+
121
+ <label className="flex items-center gap-2">
122
+ <Checkbox name="dark-mode" />
123
+ <Label>Enable dark mode</Label>
124
+ </label>
125
+
126
+ <label className="flex items-center gap-2">
127
+ <Checkbox name="public-profile" required />
128
+ <Label>I accept the terms of service *</Label>
129
+ </label>
130
+ </fieldset>
131
+ </form>
132
+ ```
133
+
134
+ ### Disabled State
135
+
136
+ ```tsx
137
+ <label className="flex items-center gap-2">
138
+ <Checkbox disabled defaultChecked />
139
+ <Label>Admin access (requires Pro plan)</Label>
140
+ </label>
141
+ ```
142
+
143
+ ### Permission Settings Example
144
+
145
+ ```tsx
146
+ function APIPermissions() {
147
+ const [permissions, setPermissions] = useState({
148
+ readAccess: true,
149
+ writeAccess: false,
150
+ adminAccess: false,
151
+ })
152
+
153
+ const togglePermission = (key: keyof typeof permissions) => {
154
+ setPermissions(prev => ({ ...prev, [key]: !prev[key] }))
155
+ }
156
+
157
+ return (
158
+ <div className="space-y-3">
159
+ <label className="flex items-start gap-3">
160
+ <Checkbox
161
+ checked={permissions.readAccess}
162
+ onCheckedChange={() => togglePermission('readAccess')}
163
+ />
164
+ <div className="flex-1">
165
+ <Label>Read Access</Label>
166
+ <p className="text-muted-foreground text-xs">
167
+ Fetch casts, users, and channel data
168
+ </p>
169
+ </div>
170
+ </label>
171
+
172
+ <label className="flex items-start gap-3">
173
+ <Checkbox
174
+ checked={permissions.writeAccess}
175
+ onCheckedChange={() => togglePermission('writeAccess')}
176
+ />
177
+ <div className="flex-1">
178
+ <Label>Write Access</Label>
179
+ <p className="text-muted-foreground text-xs">
180
+ Publish casts and update profiles
181
+ </p>
182
+ </div>
183
+ </label>
184
+
185
+ <label className="flex items-start gap-3">
186
+ <Checkbox
187
+ checked={permissions.adminAccess}
188
+ onCheckedChange={() => togglePermission('adminAccess')}
189
+ disabled
190
+ />
191
+ <div className="flex-1">
192
+ <Label>Admin Access</Label>
193
+ <p className="text-muted-foreground text-xs">
194
+ Full administrative permissions (Enterprise only)
195
+ </p>
196
+ </div>
197
+ </label>
198
+ </div>
199
+ )
200
+ }
201
+ ```
202
+
203
+ ## Keyboard
204
+
205
+ | Key | Action |
206
+ |-----|--------|
207
+ | Space | Toggle checked state |
208
+ | Enter | Toggle checked state (in forms) |
209
+ | Tab | Move focus to next element |
210
+ | Shift + Tab | Move focus to previous element |
211
+
212
+ ## Accessibility
213
+
214
+ - Renders semantic HTML with hidden native checkbox input
215
+ - Full keyboard navigation support
216
+ - Proper ARIA attributes automatically applied
217
+ - Works with form labels via native label element
218
+ - Supports required field validation
219
+ - Focus visible states for keyboard users
220
+
221
+ ## Styling Notes
222
+
223
+ - Size: 16px × 16px (size-4)
224
+ - Border radius: 4px
225
+ - Checked state shows primary color background
226
+ - Includes focus ring on keyboard focus
227
+ - Disabled state reduces opacity to 50%
228
+ - Peer class allows styling adjacent elements based on state
229
+
230
+ ## Related
231
+
232
+ - [Label](./label.llm.md) - Accessible labels for form fields
233
+ - [Switch](./switch.llm.md) - Alternative for on/off toggles
234
+ - [Radio Group](./radio-group.llm.md) - Single selection from multiple options
@@ -0,0 +1,75 @@
1
+ # Code
2
+
3
+ Inline code component with monospace font and subtle background.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { Code } from "@neynar/ui/typography"
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```tsx
14
+ <Text>
15
+ Use the <Code>useState</Code> hook for local state.
16
+ </Text>
17
+ ```
18
+
19
+ ## Props
20
+
21
+ | Prop | Type | Default | Description |
22
+ |------|------|---------|-------------|
23
+ | color | "default" \| "muted" \| "subtle" \| "destructive" \| "success" \| "warning" \| "info" | "default" | Text color |
24
+ | className | string | - | Additional CSS classes |
25
+
26
+ ## Examples
27
+
28
+ ### Basic
29
+
30
+ ```tsx
31
+ <Code>npm install @neynar/ui</Code>
32
+ ```
33
+
34
+ ### Inline with Text
35
+
36
+ ```tsx
37
+ <Text>
38
+ The <Code>Button</Code> component accepts a <Code>variant</Code> prop.
39
+ </Text>
40
+ ```
41
+
42
+ ### With Colors
43
+
44
+ ```tsx
45
+ <Code color="destructive">error.message</Code>
46
+ <Code color="success">response.data</Code>
47
+ ```
48
+
49
+ ### In Lists
50
+
51
+ ```tsx
52
+ <ul>
53
+ <li><Code>variant</Code> - Visual style</li>
54
+ <li><Code>size</Code> - Component size</li>
55
+ <li><Code>disabled</Code> - Disable interaction</li>
56
+ </ul>
57
+ ```
58
+
59
+ ## Styling
60
+
61
+ Default styling:
62
+ - Monospace font (`font-mono`)
63
+ - Small text size (`text-sm`)
64
+ - Muted background (`bg-muted`)
65
+ - Rounded corners
66
+ - Horizontal padding
67
+
68
+ ## Note
69
+
70
+ For multi-line code blocks with syntax highlighting, use a dedicated solution like `prism-react-renderer` or `shiki`.
71
+
72
+ ## Related
73
+
74
+ - [Text](./text.llm.md) - Paragraph text
75
+ - [Kbd](./kbd.llm.md) - Keyboard shortcuts
@@ -0,0 +1,271 @@
1
+ # Collapsible
2
+
3
+ Expandable sections that show and hide content with smooth animations.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { Collapsible, CollapsibleTrigger, CollapsibleContent } from "@neynar/ui/collapsible"
9
+ ```
10
+
11
+ ## Anatomy
12
+
13
+ ```tsx
14
+ <Collapsible>
15
+ <CollapsibleTrigger />
16
+ <CollapsibleContent />
17
+ </Collapsible>
18
+ ```
19
+
20
+ ## Components
21
+
22
+ | Component | Description |
23
+ |-----------|-------------|
24
+ | Collapsible | Root container, manages open/closed state |
25
+ | CollapsibleTrigger | Button that toggles the content visibility |
26
+ | CollapsibleContent | Panel that shows/hides with animation |
27
+
28
+ ## Props
29
+
30
+ ### Collapsible
31
+
32
+ | Prop | Type | Default | Description |
33
+ |------|------|---------|-------------|
34
+ | open | boolean | - | Controlled open state |
35
+ | defaultOpen | boolean | - | Initial open state (uncontrolled) |
36
+ | onOpenChange | (open: boolean, details: object) => void | - | Called when open state changes |
37
+ | disabled | boolean | - | Disables all interactions |
38
+ | className | string \| function | - | CSS class or function returning class based on state |
39
+ | style | CSSProperties \| function | - | Style object or function returning styles based on state |
40
+ | render | ReactElement \| function | - | Custom render element or function |
41
+
42
+ ### CollapsibleTrigger
43
+
44
+ | Prop | Type | Default | Description |
45
+ |------|------|---------|-------------|
46
+ | nativeButton | boolean | true | Whether to render a native `<button>` element |
47
+ | className | string \| function | - | CSS class or function returning class based on state |
48
+ | style | CSSProperties \| function | - | Style object or function returning styles based on state |
49
+ | render | ReactElement \| function | - | Custom render element or function |
50
+
51
+ **Note**: Set `nativeButton={false}` if using `render` to replace with a non-button element (e.g., `<div>`).
52
+
53
+ ### CollapsibleContent
54
+
55
+ Automatically animates height when opening/closing using CSS variables.
56
+
57
+ | Prop | Type | Default | Description |
58
+ |------|------|---------|-------------|
59
+ | keepMounted | boolean | false | Keep element in DOM when closed |
60
+ | hiddenUntilFound | boolean | false | Enable browser's page search to find and expand content |
61
+ | className | string \| function | - | CSS class or function returning class based on state |
62
+ | style | CSSProperties \| function | - | Style object or function returning styles based on state |
63
+ | render | ReactElement \| function | - | Custom render element or function |
64
+
65
+ **Note**: `hiddenUntilFound` overrides `keepMounted` and uses `hidden="until-found"` attribute.
66
+
67
+ ### Render Prop
68
+
69
+ All components support the `render` prop to customize the rendered element:
70
+
71
+ ```tsx
72
+ <CollapsibleTrigger render={<Button variant="outline" />}>
73
+ Toggle Settings
74
+ </CollapsibleTrigger>
75
+ ```
76
+
77
+ ## Data Attributes
78
+
79
+ Use these for styling based on component state:
80
+
81
+ | Attribute | When Present | Where |
82
+ |-----------|--------------|-------|
83
+ | data-panel-open | Collapsible is open | Trigger |
84
+ | data-starting-style | Panel is animating in | Content |
85
+ | data-ending-style | Panel is animating out | Content |
86
+
87
+ ## CSS Variables
88
+
89
+ Available for custom animations:
90
+
91
+ | Variable | Description | Where |
92
+ |----------|-------------|-------|
93
+ | --collapsible-panel-height | Current panel height | Content |
94
+ | --collapsible-panel-width | Current panel width | Content |
95
+
96
+ ## Examples
97
+
98
+ ### Basic Usage
99
+
100
+ ```tsx
101
+ <Collapsible defaultOpen>
102
+ <CollapsibleTrigger className="flex items-center justify-between border rounded-lg p-4">
103
+ <span>Click to toggle</span>
104
+ <ChevronDownIcon />
105
+ </CollapsibleTrigger>
106
+ <CollapsibleContent>
107
+ <div className="border-x border-b p-4">
108
+ Hidden content that slides open
109
+ </div>
110
+ </CollapsibleContent>
111
+ </Collapsible>
112
+ ```
113
+
114
+ ### Controlled State
115
+
116
+ ```tsx
117
+ function Settings() {
118
+ const [open, setOpen] = useState(false)
119
+
120
+ return (
121
+ <div>
122
+ <Button onClick={() => setOpen(!open)}>Toggle</Button>
123
+
124
+ <Collapsible open={open} onOpenChange={setOpen}>
125
+ <CollapsibleTrigger>
126
+ Settings {open ? <ChevronUpIcon /> : <ChevronDownIcon />}
127
+ </CollapsibleTrigger>
128
+ <CollapsibleContent>
129
+ <div>Advanced settings panel</div>
130
+ </CollapsibleContent>
131
+ </Collapsible>
132
+ </div>
133
+ )
134
+ }
135
+ ```
136
+
137
+ ### Settings Panel with Icons
138
+
139
+ ```tsx
140
+ <Collapsible>
141
+ <CollapsibleTrigger className="flex items-center justify-between border rounded-lg p-4">
142
+ <div className="flex items-center gap-3">
143
+ <div className="bg-primary/10 text-primary rounded-md p-2">
144
+ <SettingsIcon className="size-5" />
145
+ </div>
146
+ <div>
147
+ <p className="font-medium">API Settings</p>
148
+ <p className="text-sm text-muted-foreground">Configure rate limits</p>
149
+ </div>
150
+ </div>
151
+ <ChevronDownIcon className="size-5" />
152
+ </CollapsibleTrigger>
153
+ <CollapsibleContent>
154
+ <div className="border-x border-b p-4">
155
+ <Label htmlFor="rate-limit">Rate Limit</Label>
156
+ <Input id="rate-limit" type="number" defaultValue="10000" />
157
+ </div>
158
+ </CollapsibleContent>
159
+ </Collapsible>
160
+ ```
161
+
162
+ ### Multiple Independent Sections
163
+
164
+ ```tsx
165
+ function AdvancedSettings() {
166
+ return (
167
+ <div className="space-y-3">
168
+ <Collapsible>
169
+ <CollapsibleTrigger className="w-full border rounded-lg p-4">
170
+ API Settings
171
+ </CollapsibleTrigger>
172
+ <CollapsibleContent>
173
+ <div className="border-x border-b p-4">API configuration</div>
174
+ </CollapsibleContent>
175
+ </Collapsible>
176
+
177
+ <Collapsible>
178
+ <CollapsibleTrigger className="w-full border rounded-lg p-4">
179
+ Security
180
+ </CollapsibleTrigger>
181
+ <CollapsibleContent>
182
+ <div className="border-x border-b p-4">Security settings</div>
183
+ </CollapsibleContent>
184
+ </Collapsible>
185
+ </div>
186
+ )
187
+ }
188
+ ```
189
+
190
+ ### Nested Collapsibles
191
+
192
+ ```tsx
193
+ <Collapsible defaultOpen>
194
+ <CollapsibleTrigger className="border rounded-lg p-4">
195
+ Integrations
196
+ </CollapsibleTrigger>
197
+ <CollapsibleContent>
198
+ <div className="border-x border-b p-4 space-y-2">
199
+ <Collapsible>
200
+ <CollapsibleTrigger className="border rounded p-3 text-sm">
201
+ Email Integration
202
+ </CollapsibleTrigger>
203
+ <CollapsibleContent>
204
+ <div className="mt-1 border rounded p-3">
205
+ Configure email settings
206
+ </div>
207
+ </CollapsibleContent>
208
+ </Collapsible>
209
+
210
+ <Collapsible>
211
+ <CollapsibleTrigger className="border rounded p-3 text-sm">
212
+ Webhooks
213
+ </CollapsibleTrigger>
214
+ <CollapsibleContent>
215
+ <div className="mt-1 border rounded p-3">
216
+ Configure webhooks
217
+ </div>
218
+ </CollapsibleContent>
219
+ </Collapsible>
220
+ </div>
221
+ </CollapsibleContent>
222
+ </Collapsible>
223
+ ```
224
+
225
+ ### Animated Chevron with Data Attributes
226
+
227
+ ```tsx
228
+ <Collapsible>
229
+ <CollapsibleTrigger className="group border rounded-lg p-4">
230
+ <ChevronDownIcon className="transition-transform group-data-[panel-open]:rotate-180" />
231
+ Expand Section
232
+ </CollapsibleTrigger>
233
+ <CollapsibleContent>
234
+ <div className="border-x border-b p-4">Content</div>
235
+ </CollapsibleContent>
236
+ </Collapsible>
237
+ ```
238
+
239
+ ### Disabled State
240
+
241
+ ```tsx
242
+ <Collapsible disabled>
243
+ <CollapsibleTrigger className="border rounded-lg p-4 opacity-50 cursor-not-allowed">
244
+ Disabled Section
245
+ </CollapsibleTrigger>
246
+ <CollapsibleContent>
247
+ <div className="border-x border-b p-4">Cannot be opened</div>
248
+ </CollapsibleContent>
249
+ </Collapsible>
250
+ ```
251
+
252
+ ## Keyboard
253
+
254
+ | Key | Action |
255
+ |-----|--------|
256
+ | Space | Toggle when trigger is focused |
257
+ | Enter | Toggle when trigger is focused |
258
+
259
+ ## Accessibility
260
+
261
+ - Trigger automatically receives `role="button"` and proper ARIA attributes
262
+ - Content visibility controlled with proper ARIA states
263
+ - Focus management handled automatically
264
+ - Keyboard navigation fully supported with Space/Enter keys
265
+ - Use `hiddenUntilFound` prop to enable browser's Ctrl+F/Cmd+F page search to find and expand collapsed content
266
+
267
+ ## Related
268
+
269
+ - [Accordion](/components/accordion.llm.md) - For mutually exclusive collapsible sections
270
+ - [Dialog](/components/dialog.llm.md) - For modal content overlays
271
+ - [Tabs](/components/tabs.llm.md) - For switching between different views