@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,310 @@
1
+ # Alert
2
+
3
+ Displays contextual messages with optional icons and actions for notifications, warnings, errors, and informational content.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { Alert, AlertTitle, AlertDescription, AlertAction } from "@neynar/ui/alert"
9
+ ```
10
+
11
+ ## Anatomy
12
+
13
+ ```tsx
14
+ <Alert variant="default">
15
+ <InfoIcon />
16
+ <AlertTitle>Title</AlertTitle>
17
+ <AlertDescription>Description with optional links.</AlertDescription>
18
+ <AlertAction>
19
+ <Button size="xs">Action</Button>
20
+ </AlertAction>
21
+ </Alert>
22
+ ```
23
+
24
+ ## Components
25
+
26
+ | Component | Description |
27
+ |-----------|-------------|
28
+ | Alert | Root container with variant styling and grid layout |
29
+ | AlertTitle | Title heading, auto-positions next to icon |
30
+ | AlertDescription | Description content with muted foreground color |
31
+ | AlertAction | Action area positioned in top-right corner |
32
+
33
+ ## Props
34
+
35
+ ### Alert
36
+
37
+ | Prop | Type | Default | Description |
38
+ |------|------|---------|-------------|
39
+ | variant | "default" \| "destructive" \| "success" \| "warning" \| "info" | "default" | Visual style variant for different message types |
40
+ | className | string | - | Additional CSS classes |
41
+ | children | ReactNode | - | Alert content (icon, title, description, action) |
42
+
43
+ All standard HTML div props are supported.
44
+
45
+ ### AlertTitle
46
+
47
+ Standard HTML div props. Automatically positions next to icon when present using CSS grid. Supports inline links with underline styling on hover.
48
+
49
+ ### AlertDescription
50
+
51
+ Standard HTML div props. Uses muted foreground color that adapts to the alert variant. Supports paragraph spacing and inline links.
52
+
53
+ ### AlertAction
54
+
55
+ Standard HTML div props. Absolutely positioned in top-right corner (top-2.5, right-3). Use for dismiss buttons or action CTAs.
56
+
57
+ ## Data Attributes
58
+
59
+ | Attribute | Element | When Present |
60
+ |-----------|---------|--------------|
61
+ | data-slot="alert" | Alert | Always on root alert element |
62
+ | data-slot="alert-title" | AlertTitle | Always on title element |
63
+ | data-slot="alert-description" | AlertDescription | Always on description element |
64
+ | data-slot="alert-action" | AlertAction | Always on action element |
65
+
66
+ The Alert uses `has-data-[slot=alert-action]:pr-18` to add right padding when an action is present, preventing content overlap.
67
+
68
+ ## Variants
69
+
70
+ | Variant | Usage |
71
+ |---------|-------|
72
+ | default | General information, updates, neutral notifications |
73
+ | destructive | Errors, critical information requiring immediate attention |
74
+ | success | Successful actions, positive outcomes, confirmations |
75
+ | warning | Important warnings requiring attention but not critical |
76
+ | info | Informational messages, tips, helpful context |
77
+
78
+ ## Icon Handling
79
+
80
+ When an SVG icon is included as a direct child:
81
+ - Alert switches to 2-column grid layout (`has-[>svg]:grid-cols-[auto_1fr]`)
82
+ - Icon is auto-sized to 16px (`*:[svg:not([class*='size-'])]:size-4`)
83
+ - Icon color matches variant text color
84
+ - Icon spans both rows and translates slightly down for alignment
85
+ - Title and description automatically position in second column
86
+
87
+ ## Examples
88
+
89
+ ### Basic Alert
90
+
91
+ ```tsx
92
+ <Alert>
93
+ <InfoIcon />
94
+ <AlertTitle>Heads up!</AlertTitle>
95
+ <AlertDescription>
96
+ You can add components to your app using the CLI.
97
+ </AlertDescription>
98
+ </Alert>
99
+ ```
100
+
101
+ ### Destructive/Error Alert
102
+
103
+ ```tsx
104
+ <Alert variant="destructive">
105
+ <AlertTriangleIcon />
106
+ <AlertTitle>Authentication Error</AlertTitle>
107
+ <AlertDescription>
108
+ Your API key has expired or is invalid. Please generate a new key or check
109
+ your credentials in the <a href="#settings">API settings</a> page.
110
+ </AlertDescription>
111
+ </Alert>
112
+ ```
113
+
114
+ ### Success Alert
115
+
116
+ ```tsx
117
+ <Alert variant="success">
118
+ <CheckCircle2Icon />
119
+ <AlertTitle>Plan Upgrade Successful</AlertTitle>
120
+ <AlertDescription>
121
+ Your account has been upgraded to the Pro plan. Your new rate limits and
122
+ features are now active.
123
+ </AlertDescription>
124
+ </Alert>
125
+ ```
126
+
127
+ ### With Dismiss Action
128
+
129
+ ```tsx
130
+ <Alert variant="destructive">
131
+ <AlertTriangleIcon />
132
+ <AlertTitle>Rate Limit Warning</AlertTitle>
133
+ <AlertDescription>
134
+ You've used 95% of your API rate limit for this billing period. Your requests
135
+ may be throttled. Consider <a href="#upgrade">upgrading your plan</a> to
136
+ increase your limit.
137
+ </AlertDescription>
138
+ <AlertAction>
139
+ <Button variant="ghost" size="icon-xs" aria-label="Dismiss">
140
+ <XIcon />
141
+ </Button>
142
+ </AlertAction>
143
+ </Alert>
144
+ ```
145
+
146
+ ### With Primary Action Button
147
+
148
+ ```tsx
149
+ <Alert>
150
+ <InfoIcon />
151
+ <AlertTitle>API v1 Deprecation Notice</AlertTitle>
152
+ <AlertDescription>
153
+ The v1 API endpoints will be deprecated on March 31, 2025. Please migrate to
154
+ <a href="#migration">v2 endpoints</a> to avoid service disruption.
155
+ </AlertDescription>
156
+ <AlertAction>
157
+ <Button size="xs" variant="outline">
158
+ View Migration Guide
159
+ </Button>
160
+ </AlertAction>
161
+ </Alert>
162
+ ```
163
+
164
+ ### Description Only (No Title)
165
+
166
+ ```tsx
167
+ <Alert>
168
+ <InfoIcon />
169
+ <AlertDescription>
170
+ Your changes have been saved automatically.
171
+ </AlertDescription>
172
+ </Alert>
173
+ ```
174
+
175
+ ### Without Icon
176
+
177
+ ```tsx
178
+ <Alert>
179
+ <AlertTitle>Simple Alert</AlertTitle>
180
+ <AlertDescription>
181
+ This alert doesn't have an icon, useful for less critical information.
182
+ </AlertDescription>
183
+ </Alert>
184
+ ```
185
+
186
+ ### Warning Alert
187
+
188
+ ```tsx
189
+ <Alert variant="warning">
190
+ <AlertTriangleIcon />
191
+ <AlertTitle>Webhook Configuration Required</AlertTitle>
192
+ <AlertDescription>
193
+ Set up webhooks to receive real-time notifications for cast events, reactions,
194
+ and follows. <a href="#webhooks">Configure webhooks</a> in your dashboard settings.
195
+ </AlertDescription>
196
+ </Alert>
197
+ ```
198
+
199
+ ### Info Alert
200
+
201
+ ```tsx
202
+ <Alert variant="info">
203
+ <BellIcon />
204
+ <AlertTitle>Update Available</AlertTitle>
205
+ <AlertDescription>
206
+ A new version of the API is available with improved performance.
207
+ </AlertDescription>
208
+ <AlertAction>
209
+ <Button size="xs">Learn More</Button>
210
+ </AlertAction>
211
+ </Alert>
212
+ ```
213
+
214
+ ## Styling
215
+
216
+ ### Custom Variants
217
+
218
+ Use the `alertVariants` function to extend or create custom variants:
219
+
220
+ ```tsx
221
+ import { alertVariants } from "@neynar/ui/alert"
222
+
223
+ <Alert className={alertVariants({ variant: "success" })}>
224
+ {/* ... */}
225
+ </Alert>
226
+ ```
227
+
228
+ ### Custom Styling
229
+
230
+ Override styles using className:
231
+
232
+ ```tsx
233
+ <Alert className="border-2 shadow-lg">
234
+ <AlertTitle className="text-lg">Custom Styled</AlertTitle>
235
+ <AlertDescription className="text-base">
236
+ With larger text and border.
237
+ </AlertDescription>
238
+ </Alert>
239
+ ```
240
+
241
+ ## Accessibility
242
+
243
+ - Uses `role="alert"` for screen reader announcements
244
+ - Alert content is announced immediately when rendered
245
+ - Interactive elements (links, buttons) are keyboard accessible
246
+ - Link underlines and hover states provide clear affordance
247
+ - Variant colors provide additional visual context beyond text
248
+
249
+ ## Layout Behavior
250
+
251
+ The Alert uses CSS Grid for flexible layout:
252
+ - **Without icon**: Single column layout
253
+ - **With icon**: Two-column grid with icon in first column
254
+ - **With action**: Adds right padding to prevent overlap
255
+ - **Responsive text**: Uses `text-balance` on mobile and `text-pretty` on desktop for optimal readability
256
+
257
+ ## Common Patterns
258
+
259
+ ### API Dashboard Notifications
260
+
261
+ ```tsx
262
+ <div className="space-y-4">
263
+ <Alert variant="destructive">
264
+ <AlertTriangleIcon />
265
+ <AlertTitle>Rate Limit Warning</AlertTitle>
266
+ <AlertDescription>
267
+ You've used 95% of your API rate limit for this billing period.
268
+ </AlertDescription>
269
+ <AlertAction>
270
+ <Button variant="ghost" size="icon-xs">
271
+ <XIcon />
272
+ </Button>
273
+ </AlertAction>
274
+ </Alert>
275
+
276
+ <Alert>
277
+ <InfoIcon />
278
+ <AlertTitle>API v1 Deprecation Notice</AlertTitle>
279
+ <AlertDescription>
280
+ The v1 API endpoints will be deprecated on March 31, 2025.
281
+ </AlertDescription>
282
+ <AlertAction>
283
+ <Button size="xs" variant="outline">
284
+ Learn More
285
+ </Button>
286
+ </AlertAction>
287
+ </Alert>
288
+ </div>
289
+ ```
290
+
291
+ ### Inline Links
292
+
293
+ Alert descriptions automatically style links with underlines and hover states:
294
+
295
+ ```tsx
296
+ <Alert>
297
+ <InfoIcon />
298
+ <AlertTitle>Documentation Updated</AlertTitle>
299
+ <AlertDescription>
300
+ We've updated our API documentation with new examples and best practices.
301
+ <a href="#docs">View the updated docs</a> or <a href="#changelog">read the changelog</a>.
302
+ </AlertDescription>
303
+ </Alert>
304
+ ```
305
+
306
+ ## Related
307
+
308
+ - **Toast** - For temporary notifications that auto-dismiss
309
+ - **Banner** - For persistent site-wide announcements
310
+ - **Dialog** - For alerts requiring user confirmation
@@ -0,0 +1,110 @@
1
+ # AspectRatio
2
+
3
+ Container that maintains a consistent aspect ratio, automatically adjusting height based on width.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { AspectRatio } from "@neynar/ui/aspect-ratio"
9
+ ```
10
+
11
+ ## Anatomy
12
+
13
+ ```tsx
14
+ <AspectRatio ratio={16 / 9}>
15
+ <img src="..." alt="..." />
16
+ </AspectRatio>
17
+ ```
18
+
19
+ ## Props
20
+
21
+ | Prop | Type | Default | Description |
22
+ |------|------|---------|-------------|
23
+ | ratio | number | - | Aspect ratio as width/height (e.g., 16/9, 1, 4/3) |
24
+ | className | string | - | Additional CSS classes |
25
+ | children | ReactNode | - | Content to display within aspect ratio container |
26
+
27
+ All standard `div` props are supported.
28
+
29
+ ## Common Aspect Ratios
30
+
31
+ | Ratio | Value | Use Case |
32
+ |-------|-------|----------|
33
+ | 16:9 | 16/9 | Video content, YouTube thumbnails, widescreen |
34
+ | 4:3 | 4/3 | Traditional displays, some photography |
35
+ | 1:1 | 1 | Square images, Instagram posts, NFTs, profile pictures |
36
+ | 21:9 | 21/9 | Ultrawide/cinematic content, hero banners |
37
+ | 9:16 | 9/16 | Vertical video (stories, reels) |
38
+ | 2:1 | 2/1 | Panoramic images, Twitter banners |
39
+
40
+ ## Examples
41
+
42
+ ### Video Thumbnail
43
+
44
+ ```tsx
45
+ <AspectRatio ratio={16 / 9} className="overflow-hidden rounded-md">
46
+ <img
47
+ src="/video-thumbnail.jpg"
48
+ alt="Video thumbnail"
49
+ className="size-full object-cover"
50
+ />
51
+ <div className="absolute inset-0 flex items-center justify-center bg-black/30">
52
+ <PlayIcon className="size-12" />
53
+ </div>
54
+ </AspectRatio>
55
+ ```
56
+
57
+ ### NFT Gallery
58
+
59
+ ```tsx
60
+ <div className="grid grid-cols-4 gap-4">
61
+ {nfts.map((nft) => (
62
+ <AspectRatio key={nft.id} ratio={1} className="overflow-hidden rounded-md">
63
+ <img
64
+ src={nft.image}
65
+ alt={nft.name}
66
+ className="size-full object-cover hover:scale-110 transition-transform"
67
+ />
68
+ </AspectRatio>
69
+ ))}
70
+ </div>
71
+ ```
72
+
73
+ ### Profile Banner
74
+
75
+ ```tsx
76
+ <AspectRatio ratio={21 / 9} className="overflow-hidden">
77
+ <img
78
+ src="/banner.jpg"
79
+ alt="Profile banner"
80
+ className="size-full object-cover"
81
+ />
82
+ <div className="absolute inset-0 bg-gradient-to-t from-black/60 to-transparent" />
83
+ <div className="absolute bottom-6 left-6 text-white">
84
+ <h3 className="text-2xl font-bold">Channel Name</h3>
85
+ </div>
86
+ </AspectRatio>
87
+ ```
88
+
89
+ ### Placeholder Content
90
+
91
+ ```tsx
92
+ <AspectRatio ratio={16 / 9} className="bg-muted flex items-center justify-center rounded-md">
93
+ <div className="text-center">
94
+ <ImageIcon className="size-12 text-muted-foreground" />
95
+ <p className="text-sm">Upload Image</p>
96
+ </div>
97
+ </AspectRatio>
98
+ ```
99
+
100
+ ## Usage Notes
101
+
102
+ - Always use `overflow-hidden` with images to prevent content overflow
103
+ - Combine with `object-cover` for images that fill the container
104
+ - Use `object-contain` to fit entire image with possible letterboxing
105
+ - Container width is flexible; height is calculated automatically
106
+ - Works with any content type: images, video, gradients, custom elements
107
+
108
+ ## Related
109
+
110
+ - [Card](./card.llm.md) - Often used together for media cards
@@ -0,0 +1,282 @@
1
+ # Avatar
2
+
3
+ Display user profile images with automatic fallback support, status badges, and grouping.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import {
9
+ Avatar,
10
+ AvatarImage,
11
+ AvatarFallback,
12
+ AvatarBadge,
13
+ AvatarGroup,
14
+ AvatarGroupCount,
15
+ } from "@neynar/ui/avatar"
16
+ ```
17
+
18
+ ## Anatomy
19
+
20
+ ```tsx
21
+ <Avatar size="default">
22
+ <AvatarImage src="/user.jpg" alt="Username" />
23
+ <AvatarFallback>UN</AvatarFallback>
24
+ <AvatarBadge>
25
+ <CheckIcon />
26
+ </AvatarBadge>
27
+ </Avatar>
28
+
29
+ <AvatarGroup>
30
+ <Avatar>...</Avatar>
31
+ <Avatar>...</Avatar>
32
+ <AvatarGroupCount>+5</AvatarGroupCount>
33
+ </AvatarGroup>
34
+ ```
35
+
36
+ ## Components
37
+
38
+ | Component | Description |
39
+ |-----------|-------------|
40
+ | Avatar | Root container with size variants |
41
+ | AvatarImage | Image element with automatic fallback |
42
+ | AvatarFallback | Fallback content (initials or icon) shown when image unavailable |
43
+ | AvatarBadge | Status indicator positioned at bottom-right |
44
+ | AvatarGroup | Container for stacked avatars with ring borders |
45
+ | AvatarGroupCount | Counter badge showing overflow count ("+N") |
46
+
47
+ ## Props
48
+
49
+ ### Avatar
50
+
51
+ | Prop | Type | Default | Description |
52
+ |------|------|---------|-------------|
53
+ | size | "sm" \| "default" \| "lg" | "default" | Avatar size variant |
54
+
55
+ Extends all Base UI Avatar.Root props.
56
+
57
+ ### AvatarImage
58
+
59
+ Standard `img` element props via Base UI Avatar.Image.
60
+
61
+ | Prop | Type | Description |
62
+ |------|------|-------------|
63
+ | src | string | Image source URL |
64
+ | alt | string | Alternative text for accessibility |
65
+
66
+ ### AvatarFallback
67
+
68
+ Extends Base UI Avatar.Fallback props. Accepts text content (typically initials) or icon elements.
69
+
70
+ ### AvatarBadge
71
+
72
+ Standard `span` element props. Can contain icons or be used as colored dot.
73
+
74
+ ### AvatarGroup
75
+
76
+ Standard `div` element props. Automatically applies ring borders and negative spacing to child avatars.
77
+
78
+ ### AvatarGroupCount
79
+
80
+ Standard `div` element props. Display text like "+12" or icons.
81
+
82
+ ## Sizes
83
+
84
+ | Size | Dimensions | Use Case |
85
+ |------|------------|----------|
86
+ | sm | 24px | Compact lists, inline mentions |
87
+ | default | 32px | Standard UI, activity feeds |
88
+ | lg | 40px | Profile headers, featured users |
89
+
90
+ ## Data Attributes
91
+
92
+ | Attribute | Value | Applied To |
93
+ |-----------|-------|------------|
94
+ | data-slot | "avatar" | Avatar root |
95
+ | data-slot | "avatar-image" | AvatarImage |
96
+ | data-slot | "avatar-fallback" | AvatarFallback |
97
+ | data-slot | "avatar-badge" | AvatarBadge |
98
+ | data-slot | "avatar-group" | AvatarGroup |
99
+ | data-slot | "avatar-group-count" | AvatarGroupCount |
100
+ | data-size | "sm" \| "default" \| "lg" | Avatar root (for size styling) |
101
+
102
+ ## Examples
103
+
104
+ ### Basic Usage
105
+
106
+ ```tsx
107
+ <Avatar>
108
+ <AvatarImage src="https://i.imgur.com/xIe7Wlb.png" alt="@dwr.eth" />
109
+ <AvatarFallback>DW</AvatarFallback>
110
+ </Avatar>
111
+ ```
112
+
113
+ ### With Sizes
114
+
115
+ ```tsx
116
+ <Avatar size="sm">
117
+ <AvatarImage src="/user.jpg" alt="User" />
118
+ <AvatarFallback>AB</AvatarFallback>
119
+ </Avatar>
120
+
121
+ <Avatar size="default">
122
+ <AvatarImage src="/user.jpg" alt="User" />
123
+ <AvatarFallback>AB</AvatarFallback>
124
+ </Avatar>
125
+
126
+ <Avatar size="lg">
127
+ <AvatarImage src="/user.jpg" alt="User" />
128
+ <AvatarFallback>AB</AvatarFallback>
129
+ </Avatar>
130
+ ```
131
+
132
+ ### Fallback States
133
+
134
+ ```tsx
135
+ {/* Initials fallback */}
136
+ <Avatar>
137
+ <AvatarFallback>JD</AvatarFallback>
138
+ </Avatar>
139
+
140
+ {/* Icon fallback */}
141
+ <Avatar>
142
+ <AvatarFallback>
143
+ <UserIcon className="size-4" />
144
+ </AvatarFallback>
145
+ </Avatar>
146
+ ```
147
+
148
+ ### With Status Badge
149
+
150
+ ```tsx
151
+ {/* Verification badge */}
152
+ <Avatar>
153
+ <AvatarImage src="/user.jpg" alt="Verified user" />
154
+ <AvatarFallback>VU</AvatarFallback>
155
+ <AvatarBadge>
156
+ <CheckIcon />
157
+ </AvatarBadge>
158
+ </Avatar>
159
+
160
+ {/* Online status dot */}
161
+ <Avatar>
162
+ <AvatarImage src="/user.jpg" alt="Online user" />
163
+ <AvatarFallback>OU</AvatarFallback>
164
+ <AvatarBadge className="bg-green-500" />
165
+ </Avatar>
166
+
167
+ {/* Custom status */}
168
+ <Avatar>
169
+ <AvatarFallback>PU</AvatarFallback>
170
+ <AvatarBadge className="bg-yellow-500">
171
+ <ZapIcon />
172
+ </AvatarBadge>
173
+ </Avatar>
174
+ ```
175
+
176
+ ### Avatar Group
177
+
178
+ ```tsx
179
+ {/* Basic group */}
180
+ <AvatarGroup>
181
+ <Avatar>
182
+ <AvatarImage src="/user1.jpg" alt="User 1" />
183
+ <AvatarFallback>U1</AvatarFallback>
184
+ </Avatar>
185
+ <Avatar>
186
+ <AvatarImage src="/user2.jpg" alt="User 2" />
187
+ <AvatarFallback>U2</AvatarFallback>
188
+ </Avatar>
189
+ <Avatar>
190
+ <AvatarFallback>U3</AvatarFallback>
191
+ </Avatar>
192
+ </AvatarGroup>
193
+
194
+ {/* With overflow count */}
195
+ <AvatarGroup>
196
+ <Avatar size="sm">
197
+ <AvatarImage src="/user1.jpg" alt="User 1" />
198
+ <AvatarFallback>U1</AvatarFallback>
199
+ </Avatar>
200
+ <Avatar size="sm">
201
+ <AvatarImage src="/user2.jpg" alt="User 2" />
202
+ <AvatarFallback>U2</AvatarFallback>
203
+ </Avatar>
204
+ <Avatar size="sm">
205
+ <AvatarFallback>U3</AvatarFallback>
206
+ </Avatar>
207
+ <AvatarGroupCount>+8</AvatarGroupCount>
208
+ </AvatarGroup>
209
+
210
+ {/* Icon with count */}
211
+ <AvatarGroup>
212
+ <Avatar>
213
+ <AvatarFallback>
214
+ <UsersIcon className="size-4" />
215
+ </AvatarFallback>
216
+ </Avatar>
217
+ <AvatarGroupCount>24</AvatarGroupCount>
218
+ </AvatarGroup>
219
+ ```
220
+
221
+ ### User Profile
222
+
223
+ ```tsx
224
+ <div className="flex items-center gap-4">
225
+ <Avatar size="lg">
226
+ <AvatarImage
227
+ src="https://i.imgur.com/xIe7Wlb.png"
228
+ alt="@dwr.eth"
229
+ />
230
+ <AvatarFallback>DW</AvatarFallback>
231
+ <AvatarBadge>
232
+ <CheckIcon />
233
+ </AvatarBadge>
234
+ </Avatar>
235
+ <div>
236
+ <p className="font-semibold">Dan Romero</p>
237
+ <p className="text-muted-foreground text-sm">@dwr.eth</p>
238
+ </div>
239
+ </div>
240
+ ```
241
+
242
+ ### Activity Feed
243
+
244
+ ```tsx
245
+ <div className="flex items-start gap-3">
246
+ <Avatar>
247
+ <AvatarImage src="/user.jpg" alt="@username" />
248
+ <AvatarFallback>UN</AvatarFallback>
249
+ <AvatarBadge className="bg-green-500">
250
+ <ZapIcon />
251
+ </AvatarBadge>
252
+ </Avatar>
253
+ <div className="flex-1">
254
+ <p className="text-sm">
255
+ <span className="font-medium">@username</span> cast a new post
256
+ </p>
257
+ <p className="text-muted-foreground text-xs">2 minutes ago</p>
258
+ </div>
259
+ </div>
260
+ ```
261
+
262
+ ## Accessibility
263
+
264
+ - AvatarImage includes `alt` attribute for screen readers
265
+ - AvatarFallback provides text alternative when images fail to load
266
+ - Proper semantic HTML with appropriate ARIA attributes via Base UI
267
+ - Badge icons should be decorative; status communicated through other means
268
+
269
+ ## Technical Notes
270
+
271
+ - Image loading handled automatically by Base UI Avatar primitive
272
+ - Fallback displays only when image fails to load or src is missing
273
+ - Badge automatically scales with avatar size (sm shows no icon, default/lg show icons)
274
+ - AvatarGroup applies negative spacing (`-space-x-2`) and ring borders automatically
275
+ - Uses `data-size` attribute for responsive badge sizing
276
+ - Group uses `/avatar` and `/avatar-group` context for nested styling
277
+
278
+ ## Related
279
+
280
+ - [Button](./button.llm.md) - For clickable avatar actions
281
+ - [Card](./card.llm.md) - For profile cards with avatars
282
+ - [Dialog](./dialog.llm.md) - For profile modals