@neynar/ui 1.0.1 → 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.
- package/context7.json +17 -0
- package/llm/components/accordion.llm.md +205 -0
- package/llm/components/alert-dialog.llm.md +289 -0
- package/llm/components/alert.llm.md +310 -0
- package/llm/components/aspect-ratio.llm.md +110 -0
- package/llm/components/avatar.llm.md +282 -0
- package/llm/components/badge.llm.md +185 -0
- package/llm/components/blockquote.llm.md +86 -0
- package/llm/components/breadcrumb.llm.md +245 -0
- package/llm/components/button-group.llm.md +248 -0
- package/llm/components/button.llm.md +247 -0
- package/llm/components/calendar.llm.md +252 -0
- package/llm/components/card.llm.md +356 -0
- package/llm/components/carousel.llm.md +281 -0
- package/llm/components/chart.llm.md +278 -0
- package/llm/components/checkbox.llm.md +234 -0
- package/llm/components/code.llm.md +75 -0
- package/llm/components/collapsible.llm.md +271 -0
- package/llm/components/color-mode.llm.md +196 -0
- package/llm/components/combobox.llm.md +346 -0
- package/llm/components/command.llm.md +353 -0
- package/llm/components/context-menu.llm.md +368 -0
- package/llm/components/dialog.llm.md +283 -0
- package/llm/components/drawer.llm.md +326 -0
- package/llm/components/dropdown-menu.llm.md +404 -0
- package/llm/components/empty.llm.md +282 -0
- package/llm/components/field.llm.md +303 -0
- package/llm/components/first-light.llm.md +129 -0
- package/llm/components/hover-card.llm.md +278 -0
- package/llm/components/input-group.llm.md +334 -0
- package/llm/components/input-otp.llm.md +270 -0
- package/llm/components/input.llm.md +197 -0
- package/llm/components/item.llm.md +347 -0
- package/llm/components/kbd.llm.md +221 -0
- package/llm/components/label.llm.md +219 -0
- package/llm/components/menubar.llm.md +378 -0
- package/llm/components/navigation-menu.llm.md +320 -0
- package/llm/components/pagination.llm.md +337 -0
- package/llm/components/popover.llm.md +278 -0
- package/llm/components/progress.llm.md +259 -0
- package/llm/components/radio-group.llm.md +269 -0
- package/llm/components/resizable.llm.md +222 -0
- package/llm/components/scroll-area.llm.md +290 -0
- package/llm/components/select.llm.md +338 -0
- package/llm/components/separator.llm.md +129 -0
- package/llm/components/sheet.llm.md +275 -0
- package/llm/components/sidebar.llm.md +528 -0
- package/llm/components/skeleton.llm.md +140 -0
- package/llm/components/slider.llm.md +213 -0
- package/llm/components/sonner.llm.md +299 -0
- package/llm/components/spinner.llm.md +187 -0
- package/llm/components/switch.llm.md +258 -0
- package/llm/components/table.llm.md +334 -0
- package/llm/components/tabs.llm.md +245 -0
- package/llm/components/text.llm.md +108 -0
- package/llm/components/textarea.llm.md +236 -0
- package/llm/components/title.llm.md +88 -0
- package/llm/components/toggle-group.llm.md +228 -0
- package/llm/components/toggle.llm.md +235 -0
- package/llm/components/tooltip.llm.md +191 -0
- package/llm/contributing.llm.md +273 -0
- package/llm/hooks.llm.md +91 -0
- package/llm/index.llm.md +178 -0
- package/llm/theming.llm.md +381 -0
- package/llm/utilities.llm.md +97 -0
- package/llms-full.txt +15995 -0
- package/llms.txt +182 -0
- package/package.json +5 -1
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
# Drawer
|
|
2
|
+
|
|
3
|
+
A sliding panel that appears from any screen edge (top, bottom, left, right) with drag-to-dismiss support, frosted glass overlay, and flexible composition.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import {
|
|
9
|
+
Drawer,
|
|
10
|
+
DrawerTrigger,
|
|
11
|
+
DrawerContent,
|
|
12
|
+
DrawerHeader,
|
|
13
|
+
DrawerTitle,
|
|
14
|
+
DrawerDescription,
|
|
15
|
+
DrawerFooter,
|
|
16
|
+
DrawerClose,
|
|
17
|
+
DrawerPortal,
|
|
18
|
+
DrawerOverlay,
|
|
19
|
+
} from "@neynar/ui/drawer"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Anatomy
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
<Drawer direction="right">
|
|
26
|
+
<DrawerTrigger>Open</DrawerTrigger>
|
|
27
|
+
<DrawerContent>
|
|
28
|
+
<DrawerHeader>
|
|
29
|
+
<DrawerTitle>Title</DrawerTitle>
|
|
30
|
+
<DrawerDescription>Description</DrawerDescription>
|
|
31
|
+
</DrawerHeader>
|
|
32
|
+
{/* Content */}
|
|
33
|
+
<DrawerFooter>
|
|
34
|
+
<DrawerClose>Cancel</DrawerClose>
|
|
35
|
+
</DrawerFooter>
|
|
36
|
+
</DrawerContent>
|
|
37
|
+
</Drawer>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Components
|
|
41
|
+
|
|
42
|
+
| Component | Description |
|
|
43
|
+
|-----------|-------------|
|
|
44
|
+
| Drawer | Root container, manages open/close state |
|
|
45
|
+
| DrawerTrigger | Button or element that opens the drawer |
|
|
46
|
+
| DrawerContent | Panel with auto-portal, overlay, and drag handle (bottom drawers) |
|
|
47
|
+
| DrawerHeader | Header section, centered on top/bottom drawers |
|
|
48
|
+
| DrawerTitle | Accessible title announced when opened |
|
|
49
|
+
| DrawerDescription | Accessible description for screen readers |
|
|
50
|
+
| DrawerFooter | Footer with actions, auto-positioned at bottom |
|
|
51
|
+
| DrawerClose | Button or element that closes the drawer |
|
|
52
|
+
| DrawerPortal | Manual portal container (auto-used by DrawerContent) |
|
|
53
|
+
| DrawerOverlay | Frosted backdrop (auto-rendered by DrawerContent) |
|
|
54
|
+
|
|
55
|
+
## Props
|
|
56
|
+
|
|
57
|
+
### Drawer
|
|
58
|
+
|
|
59
|
+
| Prop | Type | Default | Description |
|
|
60
|
+
|------|------|---------|-------------|
|
|
61
|
+
| direction | "top" \| "bottom" \| "left" \| "right" | "bottom" | Edge from which drawer slides |
|
|
62
|
+
| open | boolean | - | Controlled open state |
|
|
63
|
+
| defaultOpen | boolean | - | Initial open state (uncontrolled) |
|
|
64
|
+
| onOpenChange | (open: boolean) => void | - | Called when state changes |
|
|
65
|
+
| modal | boolean | true | Whether to block interaction with content behind |
|
|
66
|
+
| dismissible | boolean | true | Whether drawer can be closed by clicking outside or dragging |
|
|
67
|
+
| shouldScaleBackground | boolean | false | Whether to scale background when open |
|
|
68
|
+
| handleOnly | boolean | false | Only allow dragging from handle (not entire drawer) |
|
|
69
|
+
|
|
70
|
+
### DrawerContent
|
|
71
|
+
|
|
72
|
+
Automatically renders portal, overlay, and drag handle (bottom drawers only). Content panel is positioned based on `direction` prop:
|
|
73
|
+
- **bottom**: Slides up from bottom, 80vh max height, rounded top corners
|
|
74
|
+
- **top**: Slides down from top, 80vh max height, rounded bottom corners
|
|
75
|
+
- **left**: Slides from left, 75% width (max 24rem), rounded right corners
|
|
76
|
+
- **right**: Slides from right, 75% width (max 24rem), rounded left corners
|
|
77
|
+
|
|
78
|
+
Extends all standard div props via `React.ComponentProps<typeof DrawerPrimitive.Content>`.
|
|
79
|
+
|
|
80
|
+
### DrawerHeader
|
|
81
|
+
|
|
82
|
+
Centered text on top/bottom drawers, left-aligned on side drawers. Extends standard div props.
|
|
83
|
+
|
|
84
|
+
### DrawerFooter
|
|
85
|
+
|
|
86
|
+
Auto-positioned at bottom with `mt-auto`. Extends standard div props.
|
|
87
|
+
|
|
88
|
+
### DrawerTrigger / DrawerClose
|
|
89
|
+
|
|
90
|
+
Both support custom rendering via Radix's `asChild` pattern:
|
|
91
|
+
|
|
92
|
+
```tsx
|
|
93
|
+
<DrawerTrigger asChild>
|
|
94
|
+
<Button>Open</Button>
|
|
95
|
+
</DrawerTrigger>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Data Attributes
|
|
99
|
+
|
|
100
|
+
| Attribute | When Present | Applied To |
|
|
101
|
+
|-----------|--------------|------------|
|
|
102
|
+
| data-slot | Always | All components (for targeting) |
|
|
103
|
+
| data-vaul-drawer-direction | Always | DrawerContent (value: "top"\|"bottom"\|"left"\|"right") |
|
|
104
|
+
| data-open | Drawer open | DrawerOverlay (for animations) |
|
|
105
|
+
| data-closed | Drawer closed | DrawerOverlay (for animations) |
|
|
106
|
+
|
|
107
|
+
## Examples
|
|
108
|
+
|
|
109
|
+
### Basic Usage
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
<Drawer>
|
|
113
|
+
<DrawerTrigger asChild>
|
|
114
|
+
<Button>Open Drawer</Button>
|
|
115
|
+
</DrawerTrigger>
|
|
116
|
+
<DrawerContent>
|
|
117
|
+
<DrawerHeader>
|
|
118
|
+
<DrawerTitle>Drawer Title</DrawerTitle>
|
|
119
|
+
<DrawerDescription>This is a description.</DrawerDescription>
|
|
120
|
+
</DrawerHeader>
|
|
121
|
+
<div className="p-4">
|
|
122
|
+
<p>Your content here.</p>
|
|
123
|
+
</div>
|
|
124
|
+
</DrawerContent>
|
|
125
|
+
</Drawer>
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Controlled State
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
function ControlledDrawer() {
|
|
132
|
+
const [open, setOpen] = useState(false)
|
|
133
|
+
|
|
134
|
+
return (
|
|
135
|
+
<>
|
|
136
|
+
<Button onClick={() => setOpen(true)}>Open</Button>
|
|
137
|
+
<Drawer open={open} onOpenChange={setOpen}>
|
|
138
|
+
<DrawerContent>
|
|
139
|
+
<DrawerHeader>
|
|
140
|
+
<DrawerTitle>Controlled Drawer</DrawerTitle>
|
|
141
|
+
</DrawerHeader>
|
|
142
|
+
<div className="p-4">
|
|
143
|
+
<Button onClick={() => setOpen(false)}>Close Programmatically</Button>
|
|
144
|
+
</div>
|
|
145
|
+
</DrawerContent>
|
|
146
|
+
</Drawer>
|
|
147
|
+
</>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Settings Panel (Right Drawer)
|
|
153
|
+
|
|
154
|
+
```tsx
|
|
155
|
+
<Drawer direction="right">
|
|
156
|
+
<DrawerTrigger asChild>
|
|
157
|
+
<Button variant="outline">
|
|
158
|
+
<SettingsIcon />
|
|
159
|
+
Settings
|
|
160
|
+
</Button>
|
|
161
|
+
</DrawerTrigger>
|
|
162
|
+
<DrawerContent>
|
|
163
|
+
<DrawerHeader>
|
|
164
|
+
<DrawerTitle>Notification Settings</DrawerTitle>
|
|
165
|
+
<DrawerDescription>Manage your notification preferences</DrawerDescription>
|
|
166
|
+
</DrawerHeader>
|
|
167
|
+
<div className="flex-1 space-y-4 overflow-y-auto p-4">
|
|
168
|
+
<div className="flex items-center justify-between">
|
|
169
|
+
<Label>Email Notifications</Label>
|
|
170
|
+
<Switch />
|
|
171
|
+
</div>
|
|
172
|
+
<div className="flex items-center justify-between">
|
|
173
|
+
<Label>Push Notifications</Label>
|
|
174
|
+
<Switch />
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
<DrawerFooter>
|
|
178
|
+
<Button>Save Changes</Button>
|
|
179
|
+
<DrawerClose asChild>
|
|
180
|
+
<Button variant="outline">Cancel</Button>
|
|
181
|
+
</DrawerClose>
|
|
182
|
+
</DrawerFooter>
|
|
183
|
+
</DrawerContent>
|
|
184
|
+
</Drawer>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Mobile Navigation (Left Drawer)
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
<Drawer direction="left">
|
|
191
|
+
<DrawerTrigger asChild>
|
|
192
|
+
<Button variant="ghost" size="icon">
|
|
193
|
+
<MenuIcon />
|
|
194
|
+
</Button>
|
|
195
|
+
</DrawerTrigger>
|
|
196
|
+
<DrawerContent>
|
|
197
|
+
<DrawerHeader>
|
|
198
|
+
<DrawerTitle>Navigation</DrawerTitle>
|
|
199
|
+
</DrawerHeader>
|
|
200
|
+
<div className="flex-1 space-y-2 p-4">
|
|
201
|
+
<Button variant="ghost" className="w-full justify-start">
|
|
202
|
+
<HomeIcon />
|
|
203
|
+
Dashboard
|
|
204
|
+
</Button>
|
|
205
|
+
<Button variant="ghost" className="w-full justify-start">
|
|
206
|
+
<UserIcon />
|
|
207
|
+
Profile
|
|
208
|
+
</Button>
|
|
209
|
+
<Button variant="ghost" className="w-full justify-start">
|
|
210
|
+
<SettingsIcon />
|
|
211
|
+
Settings
|
|
212
|
+
</Button>
|
|
213
|
+
</div>
|
|
214
|
+
</DrawerContent>
|
|
215
|
+
</Drawer>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Filter Panel (Bottom Drawer)
|
|
219
|
+
|
|
220
|
+
```tsx
|
|
221
|
+
<Drawer direction="bottom">
|
|
222
|
+
<DrawerTrigger asChild>
|
|
223
|
+
<Button variant="outline">Filters</Button>
|
|
224
|
+
</DrawerTrigger>
|
|
225
|
+
<DrawerContent>
|
|
226
|
+
<DrawerHeader>
|
|
227
|
+
<DrawerTitle>Filter Options</DrawerTitle>
|
|
228
|
+
<DrawerDescription>Refine your results</DrawerDescription>
|
|
229
|
+
</DrawerHeader>
|
|
230
|
+
<div className="space-y-4 p-4">
|
|
231
|
+
<div className="space-y-2">
|
|
232
|
+
<Label htmlFor="start-date">Start Date</Label>
|
|
233
|
+
<Input id="start-date" type="date" />
|
|
234
|
+
</div>
|
|
235
|
+
<div className="space-y-2">
|
|
236
|
+
<Label htmlFor="category">Category</Label>
|
|
237
|
+
<select id="category" className="...">
|
|
238
|
+
<option>All</option>
|
|
239
|
+
<option>Design</option>
|
|
240
|
+
<option>Engineering</option>
|
|
241
|
+
</select>
|
|
242
|
+
</div>
|
|
243
|
+
</div>
|
|
244
|
+
<DrawerFooter>
|
|
245
|
+
<div className="flex gap-2">
|
|
246
|
+
<Button className="flex-1">Apply</Button>
|
|
247
|
+
<Button variant="outline" className="flex-1">Reset</Button>
|
|
248
|
+
</div>
|
|
249
|
+
</DrawerFooter>
|
|
250
|
+
</DrawerContent>
|
|
251
|
+
</Drawer>
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Non-Dismissible Drawer
|
|
255
|
+
|
|
256
|
+
```tsx
|
|
257
|
+
<Drawer dismissible={false}>
|
|
258
|
+
<DrawerTrigger asChild>
|
|
259
|
+
<Button>Important Action</Button>
|
|
260
|
+
</DrawerTrigger>
|
|
261
|
+
<DrawerContent>
|
|
262
|
+
<DrawerHeader>
|
|
263
|
+
<DrawerTitle>Confirm Action</DrawerTitle>
|
|
264
|
+
<DrawerDescription>This action requires confirmation</DrawerDescription>
|
|
265
|
+
</DrawerHeader>
|
|
266
|
+
<div className="p-4">
|
|
267
|
+
<p>You must explicitly confirm or cancel.</p>
|
|
268
|
+
</div>
|
|
269
|
+
<DrawerFooter>
|
|
270
|
+
<Button>Confirm</Button>
|
|
271
|
+
<DrawerClose asChild>
|
|
272
|
+
<Button variant="outline">Cancel</Button>
|
|
273
|
+
</DrawerClose>
|
|
274
|
+
</DrawerFooter>
|
|
275
|
+
</DrawerContent>
|
|
276
|
+
</Drawer>
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Custom Layout (No Header)
|
|
280
|
+
|
|
281
|
+
```tsx
|
|
282
|
+
<Drawer>
|
|
283
|
+
<DrawerTrigger asChild>
|
|
284
|
+
<Button>Custom Layout</Button>
|
|
285
|
+
</DrawerTrigger>
|
|
286
|
+
<DrawerContent>
|
|
287
|
+
<div className="relative p-6">
|
|
288
|
+
<DrawerClose asChild>
|
|
289
|
+
<Button
|
|
290
|
+
variant="ghost"
|
|
291
|
+
size="icon-sm"
|
|
292
|
+
className="absolute top-4 right-4"
|
|
293
|
+
>
|
|
294
|
+
<XIcon />
|
|
295
|
+
</Button>
|
|
296
|
+
</DrawerClose>
|
|
297
|
+
<h2 className="text-lg font-semibold">Custom Layout</h2>
|
|
298
|
+
<p className="mt-2 text-sm text-muted-foreground">
|
|
299
|
+
Full control over structure
|
|
300
|
+
</p>
|
|
301
|
+
</div>
|
|
302
|
+
</DrawerContent>
|
|
303
|
+
</Drawer>
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Keyboard
|
|
307
|
+
|
|
308
|
+
| Key | Action |
|
|
309
|
+
|-----|--------|
|
|
310
|
+
| Escape | Close drawer (if dismissible) |
|
|
311
|
+
| Tab | Navigate focusable elements |
|
|
312
|
+
|
|
313
|
+
## Accessibility
|
|
314
|
+
|
|
315
|
+
- Uses Vaul library built on Radix UI primitives for ARIA compliance
|
|
316
|
+
- `DrawerTitle` sets `aria-labelledby` on content
|
|
317
|
+
- `DrawerDescription` sets `aria-describedby` on content
|
|
318
|
+
- Focus trap when modal (default), focus returns to trigger on close
|
|
319
|
+
- Drag gestures announce state changes to screen readers
|
|
320
|
+
- Overlay has proper backdrop semantics
|
|
321
|
+
|
|
322
|
+
## Related
|
|
323
|
+
|
|
324
|
+
- [Dialog](/Users/bobringer/work/neynar/worktrees/frontend-monorepo/neyn-8162-nas-baseui-upgrade./dialog.llm.md) - Modal dialog for desktop-first interactions
|
|
325
|
+
- [Sheet](https://ui.shadcn.com/docs/components/sheet) - Similar side panel component (if available)
|
|
326
|
+
- [Popover](/Users/bobringer/work/neynar/worktrees/frontend-monorepo/neyn-8162-nas-baseui-upgrade./popover.llm.md) - Floating content without blocking interaction
|