@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,252 @@
1
+ # Calendar
2
+
3
+ Date picker component supporting single date, date range, and multiple date selection modes with customizable appearance and navigation.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { Calendar } from "@neynar/ui/calendar"
9
+ ```
10
+
11
+ ## Anatomy
12
+
13
+ ```tsx
14
+ <Calendar
15
+ mode="single"
16
+ selected={date}
17
+ onSelect={setDate}
18
+ />
19
+ ```
20
+
21
+ ## Props
22
+
23
+ ### Calendar
24
+
25
+ Built on react-day-picker's DayPicker component. All DayPicker props are supported.
26
+
27
+ | Prop | Type | Default | Description |
28
+ |------|------|---------|-------------|
29
+ | mode | "single" \| "multiple" \| "range" | - | Selection mode for dates |
30
+ | selected | Date \| Date[] \| { from: Date; to?: Date } | - | Currently selected date(s) |
31
+ | onSelect | (date) => void | - | Called when selection changes |
32
+ | buttonVariant | "default" \| "outline" \| "secondary" \| "ghost" \| "destructive" \| "link" | "ghost" | Visual style for navigation buttons |
33
+ | showOutsideDays | boolean | true | Show days from adjacent months |
34
+ | captionLayout | "label" \| "dropdown" \| "dropdown-months" \| "dropdown-years" | "label" | Layout style for month/year header |
35
+ | numberOfMonths | number | 1 | Number of months to display |
36
+ | disabled | (date: Date) => boolean \| boolean | - | Disable specific dates or all dates |
37
+ | fromDate | Date | - | Earliest selectable date |
38
+ | toDate | Date | - | Latest selectable date |
39
+ | fromYear | number | - | Earliest year for dropdown navigation |
40
+ | toYear | number | - | Latest year for dropdown navigation |
41
+ | showWeekNumber | boolean | false | Display ISO week numbers |
42
+ | formatters | Partial&lt;Formatters&gt; | - | Override default date formatting |
43
+ | footer | ReactNode | - | Content for calendar footer |
44
+ | className | string | - | Additional CSS classes |
45
+ | classNames | Record&lt;string, string&gt; | - | Class names for internal elements |
46
+
47
+ ### Selection Modes
48
+
49
+ **Single Mode** - Select one date:
50
+ ```tsx
51
+ const [date, setDate] = useState<Date | undefined>()
52
+ <Calendar mode="single" selected={date} onSelect={setDate} />
53
+ ```
54
+
55
+ **Range Mode** - Select a date range:
56
+ ```tsx
57
+ const [range, setRange] = useState<{ from: Date; to?: Date }>()
58
+ <Calendar
59
+ mode="range"
60
+ selected={range}
61
+ onSelect={(range) => range?.from && setRange(range)}
62
+ />
63
+ ```
64
+
65
+ **Multiple Mode** - Select multiple dates:
66
+ ```tsx
67
+ const [dates, setDates] = useState<Date[]>([])
68
+ <Calendar mode="multiple" selected={dates} onSelect={setDates} />
69
+ ```
70
+
71
+ ## Data Attributes
72
+
73
+ | Attribute | When Present | Applied To |
74
+ |-----------|--------------|------------|
75
+ | data-slot | Always "calendar" | Root element |
76
+ | data-selected-single | Single date selected (not in range) | Day button |
77
+ | data-range-start | First date in range selection | Day button |
78
+ | data-range-middle | Date within range | Day button |
79
+ | data-range-end | Last date in range selection | Day button |
80
+ | data-day | Always (date string) | Day button |
81
+
82
+ ## Examples
83
+
84
+ ### Basic Single Date Selection
85
+
86
+ ```tsx
87
+ function DatePicker() {
88
+ const [date, setDate] = useState<Date | undefined>(new Date())
89
+
90
+ return (
91
+ <Calendar
92
+ mode="single"
93
+ selected={date}
94
+ onSelect={setDate}
95
+ />
96
+ )
97
+ }
98
+ ```
99
+
100
+ ### Date Range with Two Months
101
+
102
+ ```tsx
103
+ function DateRangePicker() {
104
+ const [dateRange, setDateRange] = useState<{ from: Date; to?: Date }>({
105
+ from: subDays(new Date(), 7),
106
+ to: new Date(),
107
+ })
108
+
109
+ return (
110
+ <Calendar
111
+ mode="range"
112
+ selected={dateRange}
113
+ onSelect={(range) => range?.from && setDateRange(range)}
114
+ numberOfMonths={2}
115
+ />
116
+ )
117
+ }
118
+ ```
119
+
120
+ ### With Disabled Dates
121
+
122
+ ```tsx
123
+ function RestrictedCalendar() {
124
+ const [date, setDate] = useState<Date | undefined>()
125
+
126
+ return (
127
+ <Calendar
128
+ mode="single"
129
+ selected={date}
130
+ onSelect={setDate}
131
+ disabled={(date) => date < new Date() || date > addDays(new Date(), 30)}
132
+ />
133
+ )
134
+ }
135
+ ```
136
+
137
+ ### Dropdown Navigation with Year Range
138
+
139
+ ```tsx
140
+ function CalendarWithDropdown() {
141
+ const [date, setDate] = useState<Date | undefined>()
142
+
143
+ return (
144
+ <Calendar
145
+ mode="single"
146
+ selected={date}
147
+ onSelect={setDate}
148
+ captionLayout="dropdown"
149
+ fromYear={2020}
150
+ toYear={2030}
151
+ />
152
+ )
153
+ }
154
+ ```
155
+
156
+ ### With Week Numbers
157
+
158
+ ```tsx
159
+ function CalendarWithWeeks() {
160
+ const [date, setDate] = useState<Date | undefined>()
161
+
162
+ return (
163
+ <Calendar
164
+ mode="single"
165
+ selected={date}
166
+ onSelect={setDate}
167
+ showWeekNumber
168
+ />
169
+ )
170
+ }
171
+ ```
172
+
173
+ ### Multiple Date Selection
174
+
175
+ ```tsx
176
+ function MultiDatePicker() {
177
+ const [dates, setDates] = useState<Date[]>([
178
+ new Date(),
179
+ addDays(new Date(), 2),
180
+ addDays(new Date(), 5),
181
+ ])
182
+
183
+ return (
184
+ <Calendar
185
+ mode="multiple"
186
+ selected={dates}
187
+ onSelect={(dates) => dates && setDates(dates)}
188
+ />
189
+ )
190
+ }
191
+ ```
192
+
193
+ ### Custom Button Variant
194
+
195
+ ```tsx
196
+ function StyledCalendar() {
197
+ const [date, setDate] = useState<Date | undefined>()
198
+
199
+ return (
200
+ <Calendar
201
+ mode="single"
202
+ selected={date}
203
+ onSelect={setDate}
204
+ buttonVariant="outline"
205
+ />
206
+ )
207
+ }
208
+ ```
209
+
210
+ ### Hide Outside Days
211
+
212
+ ```tsx
213
+ function CompactCalendar() {
214
+ const [date, setDate] = useState<Date | undefined>()
215
+
216
+ return (
217
+ <Calendar
218
+ mode="single"
219
+ selected={date}
220
+ onSelect={setDate}
221
+ showOutsideDays={false}
222
+ />
223
+ )
224
+ }
225
+ ```
226
+
227
+ ## Keyboard
228
+
229
+ | Key | Action |
230
+ |-----|--------|
231
+ | Arrow Keys | Navigate between days |
232
+ | Enter / Space | Select focused day |
233
+ | Page Up | Previous month |
234
+ | Page Down | Next month |
235
+ | Home | First day of week |
236
+ | End | Last day of week |
237
+ | Shift + Page Up | Previous year |
238
+ | Shift + Page Down | Next year |
239
+
240
+ ## Accessibility
241
+
242
+ - Full keyboard navigation with arrow keys, Page Up/Down, and modifier keys
243
+ - ARIA labels for all navigation buttons and date selections
244
+ - Focus management with visual focus indicators
245
+ - Screen reader announcements for date selection changes
246
+ - Respects reduced-motion preferences
247
+
248
+ ## Related
249
+
250
+ - [Button](./button.llm.md) - Used for navigation controls
251
+ - [Popover](./popover.llm.md) - Often used to contain calendar in dropdown
252
+ - [Card](./card.llm.md) - Can contain calendar for date range selection UI
@@ -0,0 +1,356 @@
1
+ # Card
2
+
3
+ Flexible card container with compound components for building structured layouts with headers, content, actions, and footers.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import {
9
+ Card,
10
+ CardHeader,
11
+ CardTitle,
12
+ CardDescription,
13
+ CardAction,
14
+ CardContent,
15
+ CardFooter,
16
+ } from "@neynar/ui/card"
17
+ ```
18
+
19
+ ## Anatomy
20
+
21
+ ```tsx
22
+ <Card>
23
+ <CardHeader>
24
+ <CardTitle />
25
+ <CardDescription />
26
+ <CardAction />
27
+ </CardHeader>
28
+ <CardContent />
29
+ <CardFooter />
30
+ </Card>
31
+ ```
32
+
33
+ ## Components
34
+
35
+ | Component | Description |
36
+ |-----------|-------------|
37
+ | Card | Root container with shadow, border, rounded corners, and size variants |
38
+ | CardHeader | Grid layout header supporting title, description, and action button |
39
+ | CardTitle | Heading or name displayed in the header |
40
+ | CardDescription | Secondary text below the title with muted styling |
41
+ | CardAction | Container for buttons/controls positioned in top-right of header |
42
+ | CardContent | Main content area with consistent padding |
43
+ | CardFooter | Footer section for actions or metadata |
44
+
45
+ ## Props
46
+
47
+ ### Card
48
+
49
+ | Prop | Type | Default | Description |
50
+ |------|------|---------|-------------|
51
+ | size | "default" \| "sm" | "default" | Controls padding and spacing (default: py-6 px-6 gap-6, sm: py-4 px-4 gap-4) |
52
+ | className | string | - | Additional CSS classes |
53
+ | children | ReactNode | - | Card content |
54
+
55
+ **Standard div props**: All `React.ComponentProps<"div">` are supported.
56
+
57
+ ### CardHeader
58
+
59
+ Automatically creates a grid layout:
60
+ - **Without CardAction**: Single column for title/description
61
+ - **With CardAction**: Two columns `[1fr auto]` with action in top-right
62
+ - **With CardDescription**: Two rows for title and description
63
+
64
+ | Prop | Type | Default | Description |
65
+ |------|------|---------|-------------|
66
+ | className | string | - | Additional CSS classes |
67
+ | children | ReactNode | - | Header content (Title, Description, Action) |
68
+
69
+ **Standard div props**: All `React.ComponentProps<"div">` are supported.
70
+
71
+ ### CardTitle
72
+
73
+ | Prop | Type | Default | Description |
74
+ |------|------|---------|-------------|
75
+ | className | string | - | Additional CSS classes |
76
+ | children | ReactNode | - | Title text or content |
77
+
78
+ **Standard div props**: All `React.ComponentProps<"div">` are supported.
79
+
80
+ **Default styling**: `text-base font-medium` (default size), `text-sm font-medium` (small size)
81
+
82
+ ### CardDescription
83
+
84
+ | Prop | Type | Default | Description |
85
+ |------|------|---------|-------------|
86
+ | className | string | - | Additional CSS classes |
87
+ | children | ReactNode | - | Description text |
88
+
89
+ **Standard div props**: All `React.ComponentProps<"div">` are supported.
90
+
91
+ **Default styling**: `text-sm text-muted-foreground`
92
+
93
+ ### CardAction
94
+
95
+ Automatically positioned in the top-right corner of the header, spanning both title and description rows.
96
+
97
+ | Prop | Type | Default | Description |
98
+ |------|------|---------|-------------|
99
+ | className | string | - | Additional CSS classes |
100
+ | children | ReactNode | - | Action buttons or controls |
101
+
102
+ **Standard div props**: All `React.ComponentProps<"div">` are supported.
103
+
104
+ ### CardContent
105
+
106
+ | Prop | Type | Default | Description |
107
+ |------|------|---------|-------------|
108
+ | className | string | - | Additional CSS classes |
109
+ | children | ReactNode | - | Main card content |
110
+
111
+ **Standard div props**: All `React.ComponentProps<"div">` are supported.
112
+
113
+ ### CardFooter
114
+
115
+ Add `border-t` class for visual separation from content.
116
+
117
+ | Prop | Type | Default | Description |
118
+ |------|------|---------|-------------|
119
+ | className | string | - | Additional CSS classes |
120
+ | children | ReactNode | - | Footer content |
121
+
122
+ **Standard div props**: All `React.ComponentProps<"div">` are supported.
123
+
124
+ **Default styling**: `flex items-center`
125
+
126
+ ## Data Attributes
127
+
128
+ ### Card
129
+
130
+ | Attribute | Value | When Applied |
131
+ |-----------|-------|--------------|
132
+ | data-slot | "card" | Always |
133
+ | data-size | "default" \| "sm" | Always (matches size prop) |
134
+
135
+ ### Subcomponents
136
+
137
+ All subcomponents include `data-slot` attributes for styling:
138
+ - `data-slot="card-header"`
139
+ - `data-slot="card-title"`
140
+ - `data-slot="card-description"`
141
+ - `data-slot="card-action"`
142
+ - `data-slot="card-content"`
143
+ - `data-slot="card-footer"`
144
+
145
+ ## Variants
146
+
147
+ ### Size
148
+
149
+ | Variant | Padding | Gap | Font Size (Title) |
150
+ |---------|---------|-----|-------------------|
151
+ | default | py-6 px-6 | gap-6 | text-base |
152
+ | sm | py-4 px-4 | gap-4 | text-sm |
153
+
154
+ ## Examples
155
+
156
+ ### Basic Card
157
+
158
+ ```tsx
159
+ <Card>
160
+ <CardHeader>
161
+ <CardTitle>API Usage</CardTitle>
162
+ <CardDescription>Your current billing period</CardDescription>
163
+ </CardHeader>
164
+ <CardContent>
165
+ <p>847,231 / 1,000,000 requests used</p>
166
+ </CardContent>
167
+ </Card>
168
+ ```
169
+
170
+ ### With Action Button
171
+
172
+ ```tsx
173
+ <Card>
174
+ <CardHeader>
175
+ <CardTitle>Settings</CardTitle>
176
+ <CardDescription>Manage your preferences</CardDescription>
177
+ <CardAction>
178
+ <Button variant="outline">Edit</Button>
179
+ </CardAction>
180
+ </CardHeader>
181
+ <CardContent>
182
+ <p>Your account settings and preferences.</p>
183
+ </CardContent>
184
+ </Card>
185
+ ```
186
+
187
+ ### With Footer Actions
188
+
189
+ ```tsx
190
+ <Card>
191
+ <CardHeader>
192
+ <CardTitle>Confirm Action</CardTitle>
193
+ <CardDescription>This action cannot be undone</CardDescription>
194
+ </CardHeader>
195
+ <CardContent>
196
+ <p>Are you sure you want to delete this item?</p>
197
+ </CardContent>
198
+ <CardFooter className="border-t">
199
+ <Button variant="outline">Cancel</Button>
200
+ <Button variant="destructive">Delete</Button>
201
+ </CardFooter>
202
+ </Card>
203
+ ```
204
+
205
+ ### Small Size Card
206
+
207
+ ```tsx
208
+ <Card size="sm">
209
+ <CardHeader>
210
+ <CardTitle>Compact Card</CardTitle>
211
+ <CardDescription>Reduced padding</CardDescription>
212
+ </CardHeader>
213
+ <CardContent>
214
+ <p>Small size for dense layouts.</p>
215
+ </CardContent>
216
+ </Card>
217
+ ```
218
+
219
+ ### Content Only
220
+
221
+ ```tsx
222
+ <Card>
223
+ <CardContent>
224
+ <p>Simple card with just content, no header or footer.</p>
225
+ </CardContent>
226
+ </Card>
227
+ ```
228
+
229
+ ### With Status Indicator
230
+
231
+ ```tsx
232
+ <Card>
233
+ <CardHeader>
234
+ <div className="flex items-center gap-2">
235
+ <CheckCircle2Icon className="text-green-500 size-5" />
236
+ <CardTitle>Success</CardTitle>
237
+ </div>
238
+ <CardDescription>Operation completed successfully</CardDescription>
239
+ </CardHeader>
240
+ <CardContent>
241
+ <p>Your changes have been saved.</p>
242
+ </CardContent>
243
+ </Card>
244
+ ```
245
+
246
+ ### Dashboard Stats Card
247
+
248
+ ```tsx
249
+ <Card>
250
+ <CardHeader>
251
+ <CardTitle>Total Requests</CardTitle>
252
+ <CardDescription>Last 30 days</CardDescription>
253
+ </CardHeader>
254
+ <CardContent>
255
+ <div className="space-y-2">
256
+ <div className="text-3xl font-bold">1,284,563</div>
257
+ <div className="text-muted-foreground flex items-center gap-1 text-sm">
258
+ <TrendingUpIcon className="text-green-500 size-4" />
259
+ <span className="text-green-500">12.5%</span> from last month
260
+ </div>
261
+ </div>
262
+ </CardContent>
263
+ </Card>
264
+ ```
265
+
266
+ ### With Progress and Footer
267
+
268
+ ```tsx
269
+ <Card>
270
+ <CardHeader>
271
+ <CardTitle>API Rate Limit</CardTitle>
272
+ <CardDescription>Requests this month: 847,231 / 1,000,000</CardDescription>
273
+ <CardAction>
274
+ <Button variant="outline">Upgrade</Button>
275
+ </CardAction>
276
+ </CardHeader>
277
+ <CardContent>
278
+ <div className="space-y-2">
279
+ <Progress value={84.7} className="h-2" />
280
+ <div className="flex justify-between text-sm">
281
+ <span className="text-muted-foreground">84.7% used</span>
282
+ <span className="text-muted-foreground">152,769 remaining</span>
283
+ </div>
284
+ </div>
285
+ </CardContent>
286
+ <CardFooter className="border-t">
287
+ <p className="text-muted-foreground text-sm">
288
+ Resets on January 1, 2024
289
+ </p>
290
+ </CardFooter>
291
+ </Card>
292
+ ```
293
+
294
+ ### Complex Layout with Avatar
295
+
296
+ ```tsx
297
+ <Card>
298
+ <CardHeader>
299
+ <div className="flex items-start gap-4">
300
+ <div className="bg-primary/10 text-primary flex size-12 items-center justify-center rounded-full text-lg font-semibold">
301
+ JD
302
+ </div>
303
+ <div className="flex-1">
304
+ <div className="flex items-center gap-2">
305
+ <CardTitle>Jane Doe</CardTitle>
306
+ <Badge variant="outline">Admin</Badge>
307
+ </div>
308
+ <CardDescription>jane.doe@example.com</CardDescription>
309
+ </div>
310
+ </div>
311
+ <CardAction>
312
+ <Button variant="ghost">Edit</Button>
313
+ </CardAction>
314
+ </CardHeader>
315
+ <CardContent>
316
+ <div className="space-y-3">
317
+ <div className="flex items-center justify-between">
318
+ <span className="text-sm">API Access</span>
319
+ <CheckCircle2Icon className="text-green-500 size-5" />
320
+ </div>
321
+ </div>
322
+ </CardContent>
323
+ <CardFooter className="border-t">
324
+ <span className="text-muted-foreground text-sm">
325
+ Last active: 2 hours ago
326
+ </span>
327
+ </CardFooter>
328
+ </Card>
329
+ ```
330
+
331
+ ## Theming
332
+
333
+ The Card component uses the following CSS custom properties:
334
+
335
+ - `--card`: Background color
336
+ - `--card-foreground`: Text color
337
+ - `--border`: Ring/border color
338
+ - `--muted-foreground`: Description text color
339
+
340
+ For frosted glass effects, the component respects:
341
+ - `--surface-blur`: Backdrop blur amount
342
+ - 75% opacity on `--card` background
343
+
344
+ ## Accessibility
345
+
346
+ - Use semantic HTML elements within cards for proper structure
347
+ - CardTitle should contain heading elements when appropriate (`<h2>`, `<h3>`, etc.)
348
+ - Ensure sufficient color contrast between text and card background
349
+ - Footer buttons should have clear, actionable labels
350
+
351
+ ## Related
352
+
353
+ - [Button](./button.llm.md) - For actions in CardAction and CardFooter
354
+ - [Badge](./badge.llm.md) - For status indicators in headers
355
+ - [Progress](./progress.llm.md) - For usage stats within cards
356
+ - [Avatar](./avatar.llm.md) - For user cards with profile images