@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,437 @@
|
|
|
1
|
+
# Drawer
|
|
2
|
+
|
|
3
|
+
A panel that slides in from the edge of the screen, commonly used for navigation, filters, or supplementary content.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @lglab/compose-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Import
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { DrawerRoot, DrawerTrigger, DrawerPortal, DrawerBackdrop, DrawerPopup, DrawerTitle, DrawerDescription, DrawerClose, DrawerHeader, DrawerContent, DrawerFooter } from '@lglab/compose-ui'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### Basic
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import {
|
|
23
|
+
DrawerBackdrop,
|
|
24
|
+
DrawerClose,
|
|
25
|
+
DrawerContent,
|
|
26
|
+
DrawerDescription,
|
|
27
|
+
DrawerFooter,
|
|
28
|
+
DrawerHeader,
|
|
29
|
+
DrawerPopup,
|
|
30
|
+
DrawerPortal,
|
|
31
|
+
DrawerRoot,
|
|
32
|
+
DrawerTitle,
|
|
33
|
+
DrawerTrigger,
|
|
34
|
+
} from '@lglab/compose-ui/drawer'
|
|
35
|
+
|
|
36
|
+
export default function BasicExample() {
|
|
37
|
+
return (
|
|
38
|
+
<DrawerRoot>
|
|
39
|
+
<DrawerTrigger>Open Drawer</DrawerTrigger>
|
|
40
|
+
<DrawerPortal>
|
|
41
|
+
<DrawerBackdrop />
|
|
42
|
+
<DrawerPopup>
|
|
43
|
+
<DrawerHeader>
|
|
44
|
+
<DrawerTitle>Drawer</DrawerTitle>
|
|
45
|
+
<DrawerDescription>Lorem ipsum dolor sit amet</DrawerDescription>
|
|
46
|
+
</DrawerHeader>
|
|
47
|
+
<DrawerContent>
|
|
48
|
+
<p>
|
|
49
|
+
Curabitur non dui rhoncus, cursus turpis fermentum, cursus elit. Nulla
|
|
50
|
+
bibendum est aliquam mauris laoreet interdum.
|
|
51
|
+
</p>
|
|
52
|
+
</DrawerContent>
|
|
53
|
+
<DrawerFooter className='flex justify-end'>
|
|
54
|
+
<DrawerClose>Close</DrawerClose>
|
|
55
|
+
</DrawerFooter>
|
|
56
|
+
</DrawerPopup>
|
|
57
|
+
</DrawerPortal>
|
|
58
|
+
</DrawerRoot>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Sides
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
import {
|
|
67
|
+
DrawerBackdrop,
|
|
68
|
+
DrawerClose,
|
|
69
|
+
DrawerContent,
|
|
70
|
+
DrawerDescription,
|
|
71
|
+
DrawerFooter,
|
|
72
|
+
DrawerHeader,
|
|
73
|
+
DrawerPopup,
|
|
74
|
+
DrawerPortal,
|
|
75
|
+
DrawerRoot,
|
|
76
|
+
DrawerTitle,
|
|
77
|
+
DrawerTrigger,
|
|
78
|
+
} from '@lglab/compose-ui/drawer'
|
|
79
|
+
|
|
80
|
+
const sides = ['top', 'right', 'bottom', 'left'] as const
|
|
81
|
+
|
|
82
|
+
export default function SidesExample() {
|
|
83
|
+
return (
|
|
84
|
+
<div className='flex flex-wrap gap-2'>
|
|
85
|
+
{sides.map((side) => (
|
|
86
|
+
<DrawerRoot key={side}>
|
|
87
|
+
<DrawerTrigger className='capitalize'>{side}</DrawerTrigger>
|
|
88
|
+
<DrawerPortal>
|
|
89
|
+
<DrawerBackdrop />
|
|
90
|
+
<DrawerPopup side={side}>
|
|
91
|
+
<DrawerHeader>
|
|
92
|
+
<DrawerTitle className='capitalize'>{side} Drawer</DrawerTitle>
|
|
93
|
+
<DrawerDescription>
|
|
94
|
+
This drawer slides in from the {side}.
|
|
95
|
+
</DrawerDescription>
|
|
96
|
+
</DrawerHeader>
|
|
97
|
+
<DrawerContent>
|
|
98
|
+
<p>
|
|
99
|
+
Curabitur non dui rhoncus, cursus turpis fermentum, cursus elit. Nulla
|
|
100
|
+
bibendum est aliquam mauris laoreet interdum.
|
|
101
|
+
</p>
|
|
102
|
+
</DrawerContent>
|
|
103
|
+
<DrawerFooter className='flex justify-end'>
|
|
104
|
+
<DrawerClose>Close</DrawerClose>
|
|
105
|
+
</DrawerFooter>
|
|
106
|
+
</DrawerPopup>
|
|
107
|
+
</DrawerPortal>
|
|
108
|
+
</DrawerRoot>
|
|
109
|
+
))}
|
|
110
|
+
</div>
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Custom size
|
|
116
|
+
|
|
117
|
+
```tsx
|
|
118
|
+
import {
|
|
119
|
+
DrawerBackdrop,
|
|
120
|
+
DrawerClose,
|
|
121
|
+
DrawerContent,
|
|
122
|
+
DrawerDescription,
|
|
123
|
+
DrawerFooter,
|
|
124
|
+
DrawerHeader,
|
|
125
|
+
DrawerPopup,
|
|
126
|
+
DrawerPortal,
|
|
127
|
+
DrawerRoot,
|
|
128
|
+
DrawerTitle,
|
|
129
|
+
DrawerTrigger,
|
|
130
|
+
} from '@lglab/compose-ui/drawer'
|
|
131
|
+
|
|
132
|
+
export default function SizeExample() {
|
|
133
|
+
return (
|
|
134
|
+
<DrawerRoot>
|
|
135
|
+
<DrawerTrigger>Open Drawer</DrawerTrigger>
|
|
136
|
+
<DrawerPortal>
|
|
137
|
+
<DrawerBackdrop />
|
|
138
|
+
<DrawerPopup className='w-1/2'>
|
|
139
|
+
<DrawerHeader>
|
|
140
|
+
<DrawerTitle>Custom Size</DrawerTitle>
|
|
141
|
+
<DrawerDescription>Lorem ipsum dolor sit amet</DrawerDescription>
|
|
142
|
+
</DrawerHeader>
|
|
143
|
+
<DrawerContent>
|
|
144
|
+
<p>
|
|
145
|
+
Curabitur non dui rhoncus, cursus turpis fermentum, cursus elit. Nulla
|
|
146
|
+
bibendum est aliquam mauris laoreet interdum.
|
|
147
|
+
</p>
|
|
148
|
+
</DrawerContent>
|
|
149
|
+
<DrawerFooter className='flex justify-end'>
|
|
150
|
+
<DrawerClose>Close</DrawerClose>
|
|
151
|
+
</DrawerFooter>
|
|
152
|
+
</DrawerPopup>
|
|
153
|
+
</DrawerPortal>
|
|
154
|
+
</DrawerRoot>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Close button
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
import {
|
|
163
|
+
DrawerBackdrop,
|
|
164
|
+
DrawerClose,
|
|
165
|
+
DrawerContent,
|
|
166
|
+
DrawerDescription,
|
|
167
|
+
DrawerHeader,
|
|
168
|
+
DrawerPopup,
|
|
169
|
+
DrawerPortal,
|
|
170
|
+
DrawerRoot,
|
|
171
|
+
DrawerTitle,
|
|
172
|
+
DrawerTrigger,
|
|
173
|
+
} from '@lglab/compose-ui/drawer'
|
|
174
|
+
import { X } from 'lucide-react'
|
|
175
|
+
|
|
176
|
+
export default function CloseButtonExample() {
|
|
177
|
+
return (
|
|
178
|
+
<DrawerRoot>
|
|
179
|
+
<DrawerTrigger>Open Drawer</DrawerTrigger>
|
|
180
|
+
<DrawerPortal>
|
|
181
|
+
<DrawerBackdrop />
|
|
182
|
+
<DrawerPopup>
|
|
183
|
+
<DrawerClose
|
|
184
|
+
aria-label='Close'
|
|
185
|
+
size='icon-sm'
|
|
186
|
+
className='absolute top-3 right-3'
|
|
187
|
+
>
|
|
188
|
+
<X className='size-4' />
|
|
189
|
+
</DrawerClose>
|
|
190
|
+
<DrawerHeader>
|
|
191
|
+
<DrawerTitle>Drawer</DrawerTitle>
|
|
192
|
+
<DrawerDescription>Lorem ipsum dolor sit amet</DrawerDescription>
|
|
193
|
+
</DrawerHeader>
|
|
194
|
+
<DrawerContent>
|
|
195
|
+
<p>
|
|
196
|
+
Curabitur non dui rhoncus, cursus turpis fermentum, cursus elit. Nulla
|
|
197
|
+
bibendum est aliquam mauris laoreet interdum.
|
|
198
|
+
</p>
|
|
199
|
+
</DrawerContent>
|
|
200
|
+
</DrawerPopup>
|
|
201
|
+
</DrawerPortal>
|
|
202
|
+
</DrawerRoot>
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Scrollable
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
import {
|
|
211
|
+
DrawerBackdrop,
|
|
212
|
+
DrawerClose,
|
|
213
|
+
DrawerContent,
|
|
214
|
+
DrawerDescription,
|
|
215
|
+
DrawerFooter,
|
|
216
|
+
DrawerHeader,
|
|
217
|
+
DrawerPopup,
|
|
218
|
+
DrawerPortal,
|
|
219
|
+
DrawerRoot,
|
|
220
|
+
DrawerTitle,
|
|
221
|
+
DrawerTrigger,
|
|
222
|
+
} from '@lglab/compose-ui/drawer'
|
|
223
|
+
import {
|
|
224
|
+
ScrollAreaContent,
|
|
225
|
+
ScrollAreaRoot,
|
|
226
|
+
ScrollAreaScrollbar,
|
|
227
|
+
ScrollAreaThumb,
|
|
228
|
+
ScrollAreaViewport,
|
|
229
|
+
} from '@lglab/compose-ui/scroll-area'
|
|
230
|
+
|
|
231
|
+
export default function ScrollableExample() {
|
|
232
|
+
return (
|
|
233
|
+
<DrawerRoot>
|
|
234
|
+
<DrawerTrigger>Open Drawer</DrawerTrigger>
|
|
235
|
+
<DrawerPortal>
|
|
236
|
+
<DrawerBackdrop />
|
|
237
|
+
<DrawerPopup>
|
|
238
|
+
<DrawerHeader>
|
|
239
|
+
<DrawerTitle>Drawer</DrawerTitle>
|
|
240
|
+
<DrawerDescription>Lorem ipsum dolor sit amet</DrawerDescription>
|
|
241
|
+
</DrawerHeader>
|
|
242
|
+
<DrawerContent className='flex-1 min-h-0'>
|
|
243
|
+
<ScrollAreaRoot className='h-full'>
|
|
244
|
+
<ScrollAreaViewport>
|
|
245
|
+
<ScrollAreaContent>
|
|
246
|
+
<div className='space-y-4'>
|
|
247
|
+
{Array.from({ length: 20 }).map((_, i) => (
|
|
248
|
+
<p key={i}>
|
|
249
|
+
Curabitur non dui rhoncus, cursus turpis fermentum, cursus elit.
|
|
250
|
+
Nulla bibendum est aliquam mauris laoreet interdum.
|
|
251
|
+
</p>
|
|
252
|
+
))}
|
|
253
|
+
</div>
|
|
254
|
+
</ScrollAreaContent>
|
|
255
|
+
</ScrollAreaViewport>
|
|
256
|
+
<ScrollAreaScrollbar orientation='vertical'>
|
|
257
|
+
<ScrollAreaThumb />
|
|
258
|
+
</ScrollAreaScrollbar>
|
|
259
|
+
</ScrollAreaRoot>
|
|
260
|
+
</DrawerContent>
|
|
261
|
+
<DrawerFooter className='flex justify-end'>
|
|
262
|
+
<DrawerClose>Close</DrawerClose>
|
|
263
|
+
</DrawerFooter>
|
|
264
|
+
</DrawerPopup>
|
|
265
|
+
</DrawerPortal>
|
|
266
|
+
</DrawerRoot>
|
|
267
|
+
)
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
### Controlled
|
|
272
|
+
|
|
273
|
+
```tsx
|
|
274
|
+
import { Button } from '@lglab/compose-ui/button'
|
|
275
|
+
import {
|
|
276
|
+
DrawerBackdrop,
|
|
277
|
+
DrawerClose,
|
|
278
|
+
DrawerContent,
|
|
279
|
+
DrawerDescription,
|
|
280
|
+
DrawerFooter,
|
|
281
|
+
DrawerHeader,
|
|
282
|
+
DrawerPopup,
|
|
283
|
+
DrawerPortal,
|
|
284
|
+
DrawerRoot,
|
|
285
|
+
DrawerTitle,
|
|
286
|
+
} from '@lglab/compose-ui/drawer'
|
|
287
|
+
import { SlidersHorizontal } from 'lucide-react'
|
|
288
|
+
import { useState } from 'react'
|
|
289
|
+
|
|
290
|
+
export default function ControlledExample() {
|
|
291
|
+
const [open, setOpen] = useState(false)
|
|
292
|
+
|
|
293
|
+
return (
|
|
294
|
+
<>
|
|
295
|
+
<Button onClick={() => setOpen(true)} variant='outline'>
|
|
296
|
+
<SlidersHorizontal />
|
|
297
|
+
Filters
|
|
298
|
+
</Button>
|
|
299
|
+
<DrawerRoot open={open} onOpenChange={setOpen}>
|
|
300
|
+
<DrawerPortal>
|
|
301
|
+
<DrawerBackdrop />
|
|
302
|
+
<DrawerPopup>
|
|
303
|
+
<DrawerHeader>
|
|
304
|
+
<DrawerTitle>Drawer</DrawerTitle>
|
|
305
|
+
<DrawerDescription>Lorem ipsum dolor sit amet</DrawerDescription>
|
|
306
|
+
</DrawerHeader>
|
|
307
|
+
<DrawerContent>
|
|
308
|
+
<p>
|
|
309
|
+
Curabitur non dui rhoncus, cursus turpis fermentum, cursus elit. Nulla
|
|
310
|
+
bibendum est aliquam mauris laoreet interdum.
|
|
311
|
+
</p>
|
|
312
|
+
</DrawerContent>
|
|
313
|
+
<DrawerFooter className='flex justify-end'>
|
|
314
|
+
<DrawerClose>Close</DrawerClose>
|
|
315
|
+
</DrawerFooter>
|
|
316
|
+
</DrawerPopup>
|
|
317
|
+
</DrawerPortal>
|
|
318
|
+
</DrawerRoot>
|
|
319
|
+
</>
|
|
320
|
+
)
|
|
321
|
+
}
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Nested
|
|
325
|
+
|
|
326
|
+
```tsx
|
|
327
|
+
import {
|
|
328
|
+
DrawerBackdrop,
|
|
329
|
+
DrawerClose,
|
|
330
|
+
DrawerContent,
|
|
331
|
+
DrawerDescription,
|
|
332
|
+
DrawerFooter,
|
|
333
|
+
DrawerHeader,
|
|
334
|
+
DrawerPopup,
|
|
335
|
+
DrawerPortal,
|
|
336
|
+
DrawerRoot,
|
|
337
|
+
DrawerTitle,
|
|
338
|
+
DrawerTrigger,
|
|
339
|
+
} from '@lglab/compose-ui/drawer'
|
|
340
|
+
|
|
341
|
+
export default function NestedExample() {
|
|
342
|
+
return (
|
|
343
|
+
<DrawerRoot>
|
|
344
|
+
<DrawerTrigger>Open Drawer</DrawerTrigger>
|
|
345
|
+
<DrawerPortal>
|
|
346
|
+
<DrawerBackdrop />
|
|
347
|
+
<DrawerPopup>
|
|
348
|
+
<DrawerHeader>
|
|
349
|
+
<DrawerTitle>Drawer</DrawerTitle>
|
|
350
|
+
<DrawerDescription>Lorem ipsum dolor sit amet</DrawerDescription>
|
|
351
|
+
</DrawerHeader>
|
|
352
|
+
<DrawerContent>
|
|
353
|
+
<p>
|
|
354
|
+
Curabitur non dui rhoncus, cursus turpis fermentum, cursus elit. Nulla
|
|
355
|
+
bibendum est aliquam mauris laoreet interdum.
|
|
356
|
+
</p>
|
|
357
|
+
</DrawerContent>
|
|
358
|
+
<DrawerFooter className='flex gap-2 justify-end'>
|
|
359
|
+
<DrawerClose>Close</DrawerClose>
|
|
360
|
+
<DrawerRoot>
|
|
361
|
+
<DrawerTrigger>Nested drawer</DrawerTrigger>
|
|
362
|
+
<DrawerPortal>
|
|
363
|
+
<DrawerPopup>
|
|
364
|
+
<DrawerHeader>
|
|
365
|
+
<DrawerTitle>Nested drawer</DrawerTitle>
|
|
366
|
+
<DrawerDescription>Lorem ipsum dolor sit amet</DrawerDescription>
|
|
367
|
+
</DrawerHeader>
|
|
368
|
+
<DrawerContent>
|
|
369
|
+
<p>
|
|
370
|
+
Curabitur non dui rhoncus, cursus turpis fermentum, cursus elit.
|
|
371
|
+
Nulla bibendum est aliquam mauris laoreet interdum.
|
|
372
|
+
</p>
|
|
373
|
+
</DrawerContent>
|
|
374
|
+
<DrawerFooter className='flex justify-end'>
|
|
375
|
+
<DrawerClose>Close</DrawerClose>
|
|
376
|
+
</DrawerFooter>
|
|
377
|
+
</DrawerPopup>
|
|
378
|
+
</DrawerPortal>
|
|
379
|
+
</DrawerRoot>
|
|
380
|
+
</DrawerFooter>
|
|
381
|
+
</DrawerPopup>
|
|
382
|
+
</DrawerPortal>
|
|
383
|
+
</DrawerRoot>
|
|
384
|
+
)
|
|
385
|
+
}
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Footer
|
|
389
|
+
|
|
390
|
+
```tsx
|
|
391
|
+
import { Button } from '@lglab/compose-ui/button'
|
|
392
|
+
import {
|
|
393
|
+
DrawerBackdrop,
|
|
394
|
+
DrawerClose,
|
|
395
|
+
DrawerContent,
|
|
396
|
+
DrawerDescription,
|
|
397
|
+
DrawerFooter,
|
|
398
|
+
DrawerHeader,
|
|
399
|
+
DrawerPopup,
|
|
400
|
+
DrawerPortal,
|
|
401
|
+
DrawerRoot,
|
|
402
|
+
DrawerTitle,
|
|
403
|
+
DrawerTrigger,
|
|
404
|
+
} from '@lglab/compose-ui/drawer'
|
|
405
|
+
|
|
406
|
+
export default function FooterExample() {
|
|
407
|
+
return (
|
|
408
|
+
<DrawerRoot>
|
|
409
|
+
<DrawerTrigger>Open Drawer</DrawerTrigger>
|
|
410
|
+
<DrawerPortal>
|
|
411
|
+
<DrawerBackdrop />
|
|
412
|
+
<DrawerPopup>
|
|
413
|
+
<DrawerHeader>
|
|
414
|
+
<DrawerTitle>Drawer</DrawerTitle>
|
|
415
|
+
<DrawerDescription>Lorem ipsum dolor sit amet</DrawerDescription>
|
|
416
|
+
</DrawerHeader>
|
|
417
|
+
<DrawerContent className='flex-1'>
|
|
418
|
+
<p>
|
|
419
|
+
Curabitur non dui rhoncus, cursus turpis fermentum, cursus elit. Nulla
|
|
420
|
+
bibendum est aliquam mauris laoreet interdum.
|
|
421
|
+
</p>
|
|
422
|
+
</DrawerContent>
|
|
423
|
+
<DrawerFooter className='flex gap-2 justify-end'>
|
|
424
|
+
<DrawerClose>Cancel</DrawerClose>
|
|
425
|
+
<Button variant='destructive'>Delete</Button>
|
|
426
|
+
</DrawerFooter>
|
|
427
|
+
</DrawerPopup>
|
|
428
|
+
</DrawerPortal>
|
|
429
|
+
</DrawerRoot>
|
|
430
|
+
)
|
|
431
|
+
}
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
## Resources
|
|
435
|
+
|
|
436
|
+
- [Base UI Drawer Documentation](https://base-ui.com/react/components/drawer)
|
|
437
|
+
- [API Reference](https://base-ui.com/react/components/drawer#api-reference)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Field
|
|
2
|
+
|
|
3
|
+
Provides accessible labeling and validation for form controls.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @lglab/compose-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Import
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { FieldRoot, FieldLabel, FieldControl, FieldDescription, FieldError, FieldItem, FieldValidity } from '@lglab/compose-ui'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### Default
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { FieldControl, FieldLabel, FieldRoot } from '@lglab/compose-ui/field'
|
|
23
|
+
|
|
24
|
+
export default function DefaultExample() {
|
|
25
|
+
return (
|
|
26
|
+
<FieldRoot name='name'>
|
|
27
|
+
<FieldLabel>Name</FieldLabel>
|
|
28
|
+
<FieldControl placeholder='Enter your name' />
|
|
29
|
+
</FieldRoot>
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### With Description
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import {
|
|
38
|
+
FieldControl,
|
|
39
|
+
FieldDescription,
|
|
40
|
+
FieldLabel,
|
|
41
|
+
FieldRoot,
|
|
42
|
+
} from '@lglab/compose-ui/field'
|
|
43
|
+
|
|
44
|
+
export default function WithDescriptionExample() {
|
|
45
|
+
return (
|
|
46
|
+
<FieldRoot name='email'>
|
|
47
|
+
<FieldLabel>Email</FieldLabel>
|
|
48
|
+
<FieldControl type='email' placeholder='Enter your email' />
|
|
49
|
+
<FieldDescription>We will never share your email with anyone.</FieldDescription>
|
|
50
|
+
</FieldRoot>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### With Error
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import { FieldControl, FieldError, FieldLabel, FieldRoot } from '@lglab/compose-ui/field'
|
|
59
|
+
|
|
60
|
+
export default function WithErrorExample() {
|
|
61
|
+
return (
|
|
62
|
+
<FieldRoot name='username' invalid>
|
|
63
|
+
<FieldLabel>Username</FieldLabel>
|
|
64
|
+
<FieldControl defaultValue='@ComposeUI' placeholder='Enter username' />
|
|
65
|
+
<FieldError match={true}>Username is already taken.</FieldError>
|
|
66
|
+
</FieldRoot>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Resources
|
|
72
|
+
|
|
73
|
+
- [Base UI Field Documentation](https://base-ui.com/react/components/field)
|
|
74
|
+
- [API Reference](https://base-ui.com/react/components/field#api-reference)
|