@lglab/compose-ui-mcp 0.0.1
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/README.md +11 -0
- package/dist/assets/llms/accordion.md +184 -0
- package/dist/assets/llms/alert-dialog.md +306 -0
- package/dist/assets/llms/autocomplete.md +756 -0
- package/dist/assets/llms/avatar.md +166 -0
- package/dist/assets/llms/badge.md +478 -0
- package/dist/assets/llms/button.md +238 -0
- package/dist/assets/llms/card.md +264 -0
- package/dist/assets/llms/checkbox-group.md +158 -0
- package/dist/assets/llms/checkbox.md +83 -0
- package/dist/assets/llms/collapsible.md +165 -0
- package/dist/assets/llms/combobox.md +1255 -0
- package/dist/assets/llms/context-menu.md +371 -0
- package/dist/assets/llms/dialog.md +592 -0
- package/dist/assets/llms/drawer.md +437 -0
- package/dist/assets/llms/field.md +74 -0
- package/dist/assets/llms/form.md +1931 -0
- package/dist/assets/llms/input.md +47 -0
- package/dist/assets/llms/menu.md +484 -0
- package/dist/assets/llms/menubar.md +804 -0
- package/dist/assets/llms/meter.md +181 -0
- package/dist/assets/llms/navigation-menu.md +187 -0
- package/dist/assets/llms/number-field.md +243 -0
- package/dist/assets/llms/pagination.md +514 -0
- package/dist/assets/llms/popover.md +206 -0
- package/dist/assets/llms/preview-card.md +146 -0
- package/dist/assets/llms/progress.md +60 -0
- package/dist/assets/llms/radio-group.md +105 -0
- package/dist/assets/llms/scroll-area.md +132 -0
- package/dist/assets/llms/select.md +276 -0
- package/dist/assets/llms/separator.md +49 -0
- package/dist/assets/llms/skeleton.md +96 -0
- package/dist/assets/llms/slider.md +161 -0
- package/dist/assets/llms/switch.md +101 -0
- package/dist/assets/llms/table.md +1325 -0
- package/dist/assets/llms/tabs.md +327 -0
- package/dist/assets/llms/textarea.md +38 -0
- package/dist/assets/llms/toast.md +349 -0
- package/dist/assets/llms/toggle-group.md +261 -0
- package/dist/assets/llms/toggle.md +161 -0
- package/dist/assets/llms/toolbar.md +148 -0
- package/dist/assets/llms/tooltip.md +486 -0
- package/dist/assets/llms-full.txt +14515 -0
- package/dist/assets/llms.txt +65 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +161 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,592 @@
|
|
|
1
|
+
# Dialog
|
|
2
|
+
|
|
3
|
+
A popup that opens on top of the entire page with a backdrop, commonly used for confirmations, forms, and important messages.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @lglab/compose-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Import
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { DialogRoot, DialogTrigger, DialogPortal, DialogBackdrop, DialogPopup, DialogTitle, DialogDescription, DialogClose, DialogHeader, DialogFooter } from '@lglab/compose-ui'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### Basic
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import {
|
|
23
|
+
DialogBackdrop,
|
|
24
|
+
DialogClose,
|
|
25
|
+
DialogDescription,
|
|
26
|
+
DialogFooter,
|
|
27
|
+
DialogHeader,
|
|
28
|
+
DialogPopup,
|
|
29
|
+
DialogPortal,
|
|
30
|
+
DialogRoot,
|
|
31
|
+
DialogTitle,
|
|
32
|
+
DialogTrigger,
|
|
33
|
+
} from '@lglab/compose-ui/dialog'
|
|
34
|
+
|
|
35
|
+
export default function BasicExample() {
|
|
36
|
+
return (
|
|
37
|
+
<DialogRoot>
|
|
38
|
+
<DialogTrigger>Open Dialog</DialogTrigger>
|
|
39
|
+
<DialogPortal>
|
|
40
|
+
<DialogBackdrop />
|
|
41
|
+
<DialogPopup>
|
|
42
|
+
<DialogHeader>
|
|
43
|
+
<DialogTitle>Notifications</DialogTitle>
|
|
44
|
+
<DialogDescription>You are all caught up. Good job!</DialogDescription>
|
|
45
|
+
</DialogHeader>
|
|
46
|
+
<DialogFooter>
|
|
47
|
+
<DialogClose>Close</DialogClose>
|
|
48
|
+
</DialogFooter>
|
|
49
|
+
</DialogPopup>
|
|
50
|
+
</DialogPortal>
|
|
51
|
+
</DialogRoot>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Trigger Variants
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import {
|
|
60
|
+
DialogBackdrop,
|
|
61
|
+
DialogClose,
|
|
62
|
+
DialogDescription,
|
|
63
|
+
DialogFooter,
|
|
64
|
+
DialogHeader,
|
|
65
|
+
DialogPopup,
|
|
66
|
+
DialogPortal,
|
|
67
|
+
DialogRoot,
|
|
68
|
+
DialogTitle,
|
|
69
|
+
DialogTrigger,
|
|
70
|
+
} from '@lglab/compose-ui/dialog'
|
|
71
|
+
|
|
72
|
+
export default function VariantsExample() {
|
|
73
|
+
return (
|
|
74
|
+
<div className='flex flex-wrap gap-2'>
|
|
75
|
+
<DialogRoot>
|
|
76
|
+
<DialogTrigger variant='default'>Default</DialogTrigger>
|
|
77
|
+
<DialogPortal>
|
|
78
|
+
<DialogBackdrop />
|
|
79
|
+
<DialogPopup>
|
|
80
|
+
<DialogHeader>
|
|
81
|
+
<DialogTitle>Default Variant</DialogTitle>
|
|
82
|
+
<DialogDescription>Triggered with default button style.</DialogDescription>
|
|
83
|
+
</DialogHeader>
|
|
84
|
+
<DialogFooter>
|
|
85
|
+
<DialogClose>Close</DialogClose>
|
|
86
|
+
</DialogFooter>
|
|
87
|
+
</DialogPopup>
|
|
88
|
+
</DialogPortal>
|
|
89
|
+
</DialogRoot>
|
|
90
|
+
|
|
91
|
+
<DialogRoot>
|
|
92
|
+
<DialogTrigger variant='secondary'>Secondary</DialogTrigger>
|
|
93
|
+
<DialogPortal>
|
|
94
|
+
<DialogBackdrop />
|
|
95
|
+
<DialogPopup>
|
|
96
|
+
<DialogHeader>
|
|
97
|
+
<DialogTitle>Secondary Variant</DialogTitle>
|
|
98
|
+
<DialogDescription>
|
|
99
|
+
Triggered with secondary button style.
|
|
100
|
+
</DialogDescription>
|
|
101
|
+
</DialogHeader>
|
|
102
|
+
<DialogFooter>
|
|
103
|
+
<DialogClose>Close</DialogClose>
|
|
104
|
+
</DialogFooter>
|
|
105
|
+
</DialogPopup>
|
|
106
|
+
</DialogPortal>
|
|
107
|
+
</DialogRoot>
|
|
108
|
+
|
|
109
|
+
<DialogRoot>
|
|
110
|
+
<DialogTrigger variant='outline'>Outline</DialogTrigger>
|
|
111
|
+
<DialogPortal>
|
|
112
|
+
<DialogBackdrop />
|
|
113
|
+
<DialogPopup>
|
|
114
|
+
<DialogHeader>
|
|
115
|
+
<DialogTitle>Outline Variant</DialogTitle>
|
|
116
|
+
<DialogDescription>Triggered with outline button style.</DialogDescription>
|
|
117
|
+
</DialogHeader>
|
|
118
|
+
<DialogFooter>
|
|
119
|
+
<DialogClose>Close</DialogClose>
|
|
120
|
+
</DialogFooter>
|
|
121
|
+
</DialogPopup>
|
|
122
|
+
</DialogPortal>
|
|
123
|
+
</DialogRoot>
|
|
124
|
+
|
|
125
|
+
<DialogRoot>
|
|
126
|
+
<DialogTrigger variant='ghost'>Ghost</DialogTrigger>
|
|
127
|
+
<DialogPortal>
|
|
128
|
+
<DialogBackdrop />
|
|
129
|
+
<DialogPopup>
|
|
130
|
+
<DialogHeader>
|
|
131
|
+
<DialogTitle>Ghost Variant</DialogTitle>
|
|
132
|
+
<DialogDescription>Triggered with ghost button style.</DialogDescription>
|
|
133
|
+
</DialogHeader>
|
|
134
|
+
<DialogFooter>
|
|
135
|
+
<DialogClose>Close</DialogClose>
|
|
136
|
+
</DialogFooter>
|
|
137
|
+
</DialogPopup>
|
|
138
|
+
</DialogPortal>
|
|
139
|
+
</DialogRoot>
|
|
140
|
+
</div>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Sizes
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
import {
|
|
149
|
+
DialogBackdrop,
|
|
150
|
+
DialogClose,
|
|
151
|
+
DialogDescription,
|
|
152
|
+
DialogFooter,
|
|
153
|
+
DialogHeader,
|
|
154
|
+
DialogPopup,
|
|
155
|
+
DialogPortal,
|
|
156
|
+
DialogRoot,
|
|
157
|
+
DialogTitle,
|
|
158
|
+
DialogTrigger,
|
|
159
|
+
} from '@lglab/compose-ui/dialog'
|
|
160
|
+
|
|
161
|
+
export default function SizesExample() {
|
|
162
|
+
return (
|
|
163
|
+
<div className='flex flex-wrap gap-2'>
|
|
164
|
+
<DialogRoot>
|
|
165
|
+
<DialogTrigger>Small</DialogTrigger>
|
|
166
|
+
<DialogPortal>
|
|
167
|
+
<DialogBackdrop />
|
|
168
|
+
<DialogPopup size='sm'>
|
|
169
|
+
<DialogHeader>
|
|
170
|
+
<DialogTitle>Small Dialog</DialogTitle>
|
|
171
|
+
<DialogDescription>
|
|
172
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos.
|
|
173
|
+
</DialogDescription>
|
|
174
|
+
</DialogHeader>
|
|
175
|
+
<DialogFooter>
|
|
176
|
+
<DialogClose>Close</DialogClose>
|
|
177
|
+
</DialogFooter>
|
|
178
|
+
</DialogPopup>
|
|
179
|
+
</DialogPortal>
|
|
180
|
+
</DialogRoot>
|
|
181
|
+
|
|
182
|
+
<DialogRoot>
|
|
183
|
+
<DialogTrigger>Default</DialogTrigger>
|
|
184
|
+
<DialogPortal>
|
|
185
|
+
<DialogBackdrop />
|
|
186
|
+
<DialogPopup>
|
|
187
|
+
<DialogHeader>
|
|
188
|
+
<DialogTitle>Default Dialog</DialogTitle>
|
|
189
|
+
<DialogDescription>
|
|
190
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos.
|
|
191
|
+
</DialogDescription>
|
|
192
|
+
</DialogHeader>
|
|
193
|
+
<DialogFooter>
|
|
194
|
+
<DialogClose>Close</DialogClose>
|
|
195
|
+
</DialogFooter>
|
|
196
|
+
</DialogPopup>
|
|
197
|
+
</DialogPortal>
|
|
198
|
+
</DialogRoot>
|
|
199
|
+
|
|
200
|
+
<DialogRoot>
|
|
201
|
+
<DialogTrigger>Large</DialogTrigger>
|
|
202
|
+
<DialogPortal>
|
|
203
|
+
<DialogBackdrop />
|
|
204
|
+
<DialogPopup size='lg'>
|
|
205
|
+
<DialogHeader>
|
|
206
|
+
<DialogTitle>Large Dialog</DialogTitle>
|
|
207
|
+
<DialogDescription>
|
|
208
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos.
|
|
209
|
+
</DialogDescription>
|
|
210
|
+
</DialogHeader>
|
|
211
|
+
<DialogFooter>
|
|
212
|
+
<DialogClose>Close</DialogClose>
|
|
213
|
+
</DialogFooter>
|
|
214
|
+
</DialogPopup>
|
|
215
|
+
</DialogPortal>
|
|
216
|
+
</DialogRoot>
|
|
217
|
+
|
|
218
|
+
<DialogRoot>
|
|
219
|
+
<DialogTrigger>Extra Large</DialogTrigger>
|
|
220
|
+
<DialogPortal>
|
|
221
|
+
<DialogBackdrop />
|
|
222
|
+
<DialogPopup size='xl'>
|
|
223
|
+
<DialogHeader>
|
|
224
|
+
<DialogTitle>Extra Large Dialog</DialogTitle>
|
|
225
|
+
<DialogDescription>
|
|
226
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos.
|
|
227
|
+
</DialogDescription>
|
|
228
|
+
</DialogHeader>
|
|
229
|
+
<DialogFooter>
|
|
230
|
+
<DialogClose>Close</DialogClose>
|
|
231
|
+
</DialogFooter>
|
|
232
|
+
</DialogPopup>
|
|
233
|
+
</DialogPortal>
|
|
234
|
+
</DialogRoot>
|
|
235
|
+
|
|
236
|
+
<DialogRoot>
|
|
237
|
+
<DialogTrigger>Full Screen</DialogTrigger>
|
|
238
|
+
<DialogPortal>
|
|
239
|
+
<DialogBackdrop />
|
|
240
|
+
<DialogPopup size='full'>
|
|
241
|
+
<DialogHeader>
|
|
242
|
+
<DialogTitle>Full Screen Dialog</DialogTitle>
|
|
243
|
+
<DialogDescription>
|
|
244
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos.
|
|
245
|
+
</DialogDescription>
|
|
246
|
+
</DialogHeader>
|
|
247
|
+
<DialogFooter>
|
|
248
|
+
<DialogClose>Close</DialogClose>
|
|
249
|
+
</DialogFooter>
|
|
250
|
+
</DialogPopup>
|
|
251
|
+
</DialogPortal>
|
|
252
|
+
</DialogRoot>
|
|
253
|
+
|
|
254
|
+
<DialogRoot>
|
|
255
|
+
<DialogTrigger>Custom</DialogTrigger>
|
|
256
|
+
<DialogPortal>
|
|
257
|
+
<DialogBackdrop />
|
|
258
|
+
<DialogPopup className='w-1/2'>
|
|
259
|
+
<DialogHeader>
|
|
260
|
+
<DialogTitle>Custom Size</DialogTitle>
|
|
261
|
+
<DialogDescription>
|
|
262
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos.
|
|
263
|
+
</DialogDescription>
|
|
264
|
+
</DialogHeader>
|
|
265
|
+
<DialogFooter>
|
|
266
|
+
<DialogClose>Close</DialogClose>
|
|
267
|
+
</DialogFooter>
|
|
268
|
+
</DialogPopup>
|
|
269
|
+
</DialogPortal>
|
|
270
|
+
</DialogRoot>
|
|
271
|
+
</div>
|
|
272
|
+
)
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### With Form
|
|
277
|
+
|
|
278
|
+
```tsx
|
|
279
|
+
import {
|
|
280
|
+
DialogBackdrop,
|
|
281
|
+
DialogClose,
|
|
282
|
+
DialogDescription,
|
|
283
|
+
DialogFooter,
|
|
284
|
+
DialogHeader,
|
|
285
|
+
DialogPopup,
|
|
286
|
+
DialogPortal,
|
|
287
|
+
DialogRoot,
|
|
288
|
+
DialogTitle,
|
|
289
|
+
DialogTrigger,
|
|
290
|
+
} from '@lglab/compose-ui/dialog'
|
|
291
|
+
import { MailIcon } from 'lucide-react'
|
|
292
|
+
import * as React from 'react'
|
|
293
|
+
|
|
294
|
+
export default function FormDialogExample() {
|
|
295
|
+
const [open, setOpen] = React.useState(false)
|
|
296
|
+
|
|
297
|
+
return (
|
|
298
|
+
<DialogRoot open={open} onOpenChange={setOpen}>
|
|
299
|
+
<DialogTrigger className='gap-1.5'>
|
|
300
|
+
<MailIcon className='size-4' />
|
|
301
|
+
Contact Us
|
|
302
|
+
</DialogTrigger>
|
|
303
|
+
<DialogPortal>
|
|
304
|
+
<DialogBackdrop />
|
|
305
|
+
<DialogPopup>
|
|
306
|
+
<DialogHeader>
|
|
307
|
+
<DialogTitle>Send a Message</DialogTitle>
|
|
308
|
+
<DialogDescription>
|
|
309
|
+
Fill out the form below and we'll get back to you as soon as possible.
|
|
310
|
+
</DialogDescription>
|
|
311
|
+
</DialogHeader>
|
|
312
|
+
<form
|
|
313
|
+
onSubmit={(e) => {
|
|
314
|
+
e.preventDefault()
|
|
315
|
+
setOpen(false)
|
|
316
|
+
}}
|
|
317
|
+
>
|
|
318
|
+
<div className='mt-4 space-y-4'>
|
|
319
|
+
<div>
|
|
320
|
+
<label htmlFor='email' className='mb-1.5 block text-sm font-medium'>
|
|
321
|
+
Email
|
|
322
|
+
</label>
|
|
323
|
+
<input
|
|
324
|
+
id='email'
|
|
325
|
+
type='email'
|
|
326
|
+
placeholder='you@example.com'
|
|
327
|
+
className='w-full rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring'
|
|
328
|
+
/>
|
|
329
|
+
</div>
|
|
330
|
+
<div>
|
|
331
|
+
<label htmlFor='message' className='mb-1.5 block text-sm font-medium'>
|
|
332
|
+
Message
|
|
333
|
+
</label>
|
|
334
|
+
<textarea
|
|
335
|
+
id='message'
|
|
336
|
+
placeholder='How can we help?'
|
|
337
|
+
rows={4}
|
|
338
|
+
className='w-full resize-none rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring'
|
|
339
|
+
/>
|
|
340
|
+
</div>
|
|
341
|
+
</div>
|
|
342
|
+
<DialogFooter>
|
|
343
|
+
<DialogClose variant='ghost'>Cancel</DialogClose>
|
|
344
|
+
<button
|
|
345
|
+
type='submit'
|
|
346
|
+
className='inline-flex h-9 items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'
|
|
347
|
+
>
|
|
348
|
+
Send Message
|
|
349
|
+
</button>
|
|
350
|
+
</DialogFooter>
|
|
351
|
+
</form>
|
|
352
|
+
</DialogPopup>
|
|
353
|
+
</DialogPortal>
|
|
354
|
+
</DialogRoot>
|
|
355
|
+
)
|
|
356
|
+
}
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
### Destructive Action
|
|
360
|
+
|
|
361
|
+
```tsx
|
|
362
|
+
import {
|
|
363
|
+
DialogBackdrop,
|
|
364
|
+
DialogClose,
|
|
365
|
+
DialogDescription,
|
|
366
|
+
DialogFooter,
|
|
367
|
+
DialogHeader,
|
|
368
|
+
DialogPopup,
|
|
369
|
+
DialogPortal,
|
|
370
|
+
DialogRoot,
|
|
371
|
+
DialogTitle,
|
|
372
|
+
DialogTrigger,
|
|
373
|
+
} from '@lglab/compose-ui/dialog'
|
|
374
|
+
import { Trash2Icon } from 'lucide-react'
|
|
375
|
+
|
|
376
|
+
export default function DestructiveExample() {
|
|
377
|
+
return (
|
|
378
|
+
<DialogRoot>
|
|
379
|
+
<DialogTrigger variant='outline' className='gap-1.5'>
|
|
380
|
+
<Trash2Icon className='size-4' />
|
|
381
|
+
Delete Account
|
|
382
|
+
</DialogTrigger>
|
|
383
|
+
<DialogPortal>
|
|
384
|
+
<DialogBackdrop />
|
|
385
|
+
<DialogPopup size='sm'>
|
|
386
|
+
<DialogHeader>
|
|
387
|
+
<DialogTitle>Delete Account</DialogTitle>
|
|
388
|
+
<DialogDescription>
|
|
389
|
+
Are you sure you want to delete your account? This action cannot be undone
|
|
390
|
+
and all your data will be permanently removed.
|
|
391
|
+
</DialogDescription>
|
|
392
|
+
</DialogHeader>
|
|
393
|
+
<DialogFooter>
|
|
394
|
+
<DialogClose variant='ghost'>Cancel</DialogClose>
|
|
395
|
+
<DialogClose className='bg-destructive text-white hover:bg-destructive/90'>
|
|
396
|
+
Delete
|
|
397
|
+
</DialogClose>
|
|
398
|
+
</DialogFooter>
|
|
399
|
+
</DialogPopup>
|
|
400
|
+
</DialogPortal>
|
|
401
|
+
</DialogRoot>
|
|
402
|
+
)
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### Scrollable
|
|
407
|
+
|
|
408
|
+
```tsx
|
|
409
|
+
import {
|
|
410
|
+
DrawerBackdrop,
|
|
411
|
+
DrawerClose,
|
|
412
|
+
DrawerContent,
|
|
413
|
+
DrawerDescription,
|
|
414
|
+
DrawerFooter,
|
|
415
|
+
DrawerHeader,
|
|
416
|
+
DrawerPopup,
|
|
417
|
+
DrawerPortal,
|
|
418
|
+
DrawerRoot,
|
|
419
|
+
DrawerTitle,
|
|
420
|
+
DrawerTrigger,
|
|
421
|
+
} from '@lglab/compose-ui/drawer'
|
|
422
|
+
import {
|
|
423
|
+
ScrollAreaContent,
|
|
424
|
+
ScrollAreaRoot,
|
|
425
|
+
ScrollAreaScrollbar,
|
|
426
|
+
ScrollAreaThumb,
|
|
427
|
+
ScrollAreaViewport,
|
|
428
|
+
} from '@lglab/compose-ui/scroll-area'
|
|
429
|
+
|
|
430
|
+
export default function ScrollableExample() {
|
|
431
|
+
return (
|
|
432
|
+
<DrawerRoot>
|
|
433
|
+
<DrawerTrigger>Open Drawer</DrawerTrigger>
|
|
434
|
+
<DrawerPortal>
|
|
435
|
+
<DrawerBackdrop />
|
|
436
|
+
<DrawerPopup>
|
|
437
|
+
<DrawerHeader>
|
|
438
|
+
<DrawerTitle>Drawer</DrawerTitle>
|
|
439
|
+
<DrawerDescription>Lorem ipsum dolor sit amet</DrawerDescription>
|
|
440
|
+
</DrawerHeader>
|
|
441
|
+
<DrawerContent className='flex-1 min-h-0'>
|
|
442
|
+
<ScrollAreaRoot className='h-full'>
|
|
443
|
+
<ScrollAreaViewport>
|
|
444
|
+
<ScrollAreaContent>
|
|
445
|
+
<div className='space-y-4'>
|
|
446
|
+
{Array.from({ length: 20 }).map((_, i) => (
|
|
447
|
+
<p key={i}>
|
|
448
|
+
Curabitur non dui rhoncus, cursus turpis fermentum, cursus elit.
|
|
449
|
+
Nulla bibendum est aliquam mauris laoreet interdum.
|
|
450
|
+
</p>
|
|
451
|
+
))}
|
|
452
|
+
</div>
|
|
453
|
+
</ScrollAreaContent>
|
|
454
|
+
</ScrollAreaViewport>
|
|
455
|
+
<ScrollAreaScrollbar orientation='vertical'>
|
|
456
|
+
<ScrollAreaThumb />
|
|
457
|
+
</ScrollAreaScrollbar>
|
|
458
|
+
</ScrollAreaRoot>
|
|
459
|
+
</DrawerContent>
|
|
460
|
+
<DrawerFooter className='flex justify-end'>
|
|
461
|
+
<DrawerClose>Close</DrawerClose>
|
|
462
|
+
</DrawerFooter>
|
|
463
|
+
</DrawerPopup>
|
|
464
|
+
</DrawerPortal>
|
|
465
|
+
</DrawerRoot>
|
|
466
|
+
)
|
|
467
|
+
}
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
### Controlled
|
|
471
|
+
|
|
472
|
+
```tsx
|
|
473
|
+
import { Button } from '@lglab/compose-ui/button'
|
|
474
|
+
import {
|
|
475
|
+
DialogBackdrop,
|
|
476
|
+
DialogClose,
|
|
477
|
+
DialogDescription,
|
|
478
|
+
DialogFooter,
|
|
479
|
+
DialogHeader,
|
|
480
|
+
DialogPopup,
|
|
481
|
+
DialogPortal,
|
|
482
|
+
DialogRoot,
|
|
483
|
+
DialogTitle,
|
|
484
|
+
} from '@lglab/compose-ui/dialog'
|
|
485
|
+
import { SettingsIcon } from 'lucide-react'
|
|
486
|
+
import * as React from 'react'
|
|
487
|
+
|
|
488
|
+
export default function ControlledDialogExample() {
|
|
489
|
+
const [open, setOpen] = React.useState(false)
|
|
490
|
+
|
|
491
|
+
return (
|
|
492
|
+
<>
|
|
493
|
+
<Button onClick={() => setOpen(true)} variant='outline'>
|
|
494
|
+
<SettingsIcon /> Settings
|
|
495
|
+
</Button>
|
|
496
|
+
<DialogRoot open={open} onOpenChange={setOpen}>
|
|
497
|
+
<DialogPortal>
|
|
498
|
+
<DialogBackdrop />
|
|
499
|
+
<DialogPopup>
|
|
500
|
+
<DialogHeader>
|
|
501
|
+
<DialogTitle>Settings</DialogTitle>
|
|
502
|
+
<DialogDescription>
|
|
503
|
+
Manage your account settings and preferences.
|
|
504
|
+
</DialogDescription>
|
|
505
|
+
</DialogHeader>
|
|
506
|
+
<div className='mt-4 space-y-4'>
|
|
507
|
+
<div className='flex items-center justify-between rounded-lg border border-border p-4'>
|
|
508
|
+
<div>
|
|
509
|
+
<p className='font-medium'>Email Notifications</p>
|
|
510
|
+
<p>Receive email updates about your account</p>
|
|
511
|
+
</div>
|
|
512
|
+
<div className='h-5 w-9 rounded-full bg-primary' />
|
|
513
|
+
</div>
|
|
514
|
+
<div className='flex items-center justify-between rounded-lg border border-border p-4'>
|
|
515
|
+
<div>
|
|
516
|
+
<p className='font-medium'>Marketing Emails</p>
|
|
517
|
+
<p>Receive emails about new features and offers</p>
|
|
518
|
+
</div>
|
|
519
|
+
<div className='h-5 w-9 rounded-full bg-muted' />
|
|
520
|
+
</div>
|
|
521
|
+
</div>
|
|
522
|
+
<DialogFooter>
|
|
523
|
+
<DialogClose variant='ghost'>Cancel</DialogClose>
|
|
524
|
+
<DialogClose>Save Changes</DialogClose>
|
|
525
|
+
</DialogFooter>
|
|
526
|
+
</DialogPopup>
|
|
527
|
+
</DialogPortal>
|
|
528
|
+
</DialogRoot>
|
|
529
|
+
</>
|
|
530
|
+
)
|
|
531
|
+
}
|
|
532
|
+
```
|
|
533
|
+
|
|
534
|
+
### Nested
|
|
535
|
+
|
|
536
|
+
```tsx
|
|
537
|
+
import {
|
|
538
|
+
DialogBackdrop,
|
|
539
|
+
DialogClose,
|
|
540
|
+
DialogDescription,
|
|
541
|
+
DialogFooter,
|
|
542
|
+
DialogHeader,
|
|
543
|
+
DialogPopup,
|
|
544
|
+
DialogPortal,
|
|
545
|
+
DialogRoot,
|
|
546
|
+
DialogTitle,
|
|
547
|
+
DialogTrigger,
|
|
548
|
+
} from '@lglab/compose-ui/dialog'
|
|
549
|
+
|
|
550
|
+
export default function NestedExample() {
|
|
551
|
+
return (
|
|
552
|
+
<DialogRoot>
|
|
553
|
+
<DialogTrigger>Open Dialog</DialogTrigger>
|
|
554
|
+
<DialogPortal>
|
|
555
|
+
<DialogBackdrop />
|
|
556
|
+
<DialogPopup>
|
|
557
|
+
<DialogHeader>
|
|
558
|
+
<DialogTitle>Notifications</DialogTitle>
|
|
559
|
+
<DialogDescription>
|
|
560
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos.
|
|
561
|
+
</DialogDescription>
|
|
562
|
+
</DialogHeader>
|
|
563
|
+
<DialogFooter>
|
|
564
|
+
<DialogRoot>
|
|
565
|
+
<DialogTrigger>Nested Dialog</DialogTrigger>
|
|
566
|
+
<DialogPortal>
|
|
567
|
+
<DialogBackdrop />
|
|
568
|
+
<DialogPopup>
|
|
569
|
+
<DialogTitle>Nested Dialog</DialogTitle>
|
|
570
|
+
<DialogDescription>
|
|
571
|
+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam,
|
|
572
|
+
quos.
|
|
573
|
+
</DialogDescription>
|
|
574
|
+
<DialogFooter>
|
|
575
|
+
<DialogClose>Close</DialogClose>
|
|
576
|
+
</DialogFooter>
|
|
577
|
+
</DialogPopup>
|
|
578
|
+
</DialogPortal>
|
|
579
|
+
</DialogRoot>
|
|
580
|
+
<DialogClose>Close</DialogClose>
|
|
581
|
+
</DialogFooter>
|
|
582
|
+
</DialogPopup>
|
|
583
|
+
</DialogPortal>
|
|
584
|
+
</DialogRoot>
|
|
585
|
+
)
|
|
586
|
+
}
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
## Resources
|
|
590
|
+
|
|
591
|
+
- [Base UI Dialog Documentation](https://base-ui.com/react/components/dialog)
|
|
592
|
+
- [API Reference](https://base-ui.com/react/components/dialog#api-reference)
|