torch-glare 2.4.1 → 2.4.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/apps/lib/components/Button.tsx +1 -1
- package/apps/lib/components/Card.tsx +47 -20
- package/apps/lib/components/ColorPicker.tsx +441 -0
- package/apps/lib/components/ConclusionHeader.tsx +148 -0
- package/apps/lib/components/DatePicker.tsx +2 -0
- package/apps/lib/components/Drawer.tsx +66 -24
- package/apps/lib/components/FormBuilder/DisplayField.tsx +40 -0
- package/apps/lib/components/FormBuilder/context.ts +71 -0
- package/apps/lib/components/FormBuilder/fields/ChoiceFields.tsx +65 -0
- package/apps/lib/components/FormBuilder/fields/ColorField.tsx +76 -0
- package/apps/lib/components/FormBuilder/fields/CustomField.tsx +16 -0
- package/apps/lib/components/FormBuilder/fields/DateField.tsx +34 -0
- package/apps/lib/components/FormBuilder/fields/FieldArray.tsx +79 -0
- package/apps/lib/components/FormBuilder/fields/FieldShell.tsx +174 -0
- package/apps/lib/components/FormBuilder/fields/FileField.tsx +40 -0
- package/apps/lib/components/FormBuilder/fields/OptionListFields.tsx +139 -0
- package/apps/lib/components/FormBuilder/fields/OtpField.tsx +32 -0
- package/apps/lib/components/FormBuilder/fields/PhoneField.tsx +82 -0
- package/apps/lib/components/FormBuilder/fields/RichTextEditorField.tsx +37 -0
- package/apps/lib/components/FormBuilder/fields/SelectField.tsx +101 -0
- package/apps/lib/components/FormBuilder/fields/SignatureField.tsx +175 -0
- package/apps/lib/components/FormBuilder/fields/SliderField.tsx +72 -0
- package/apps/lib/components/FormBuilder/fields/SwitchBoxField.tsx +42 -0
- package/apps/lib/components/FormBuilder/fields/TableField.tsx +312 -0
- package/apps/lib/components/FormBuilder/fields/TextField.tsx +222 -0
- package/apps/lib/components/FormBuilder/fields/TreeSelectField.tsx +49 -0
- package/apps/lib/components/FormBuilder/fields/countries.ts +303 -0
- package/apps/lib/components/FormBuilder/fields/index.ts +25 -0
- package/apps/lib/components/FormBuilder/form-builder.tsx +292 -0
- package/apps/lib/components/FormBuilder/header.tsx +105 -0
- package/apps/lib/components/FormBuilder/index.ts +37 -0
- package/apps/lib/components/FormBuilder/numberFormat.ts +16 -0
- package/apps/lib/components/FormBuilder/stepper.tsx +217 -0
- package/apps/lib/components/FormBuilder/submit.tsx +41 -0
- package/apps/lib/components/FormBuilder/types.ts +264 -0
- package/apps/lib/components/FormBuilder/viewFormat.tsx +137 -0
- package/apps/lib/components/FormRenderer/FormDrawer.tsx +121 -0
- package/apps/lib/components/FormRenderer/form-renderer.tsx +113 -0
- package/apps/lib/components/FormRenderer/index.ts +9 -0
- package/apps/lib/components/FormRenderer/types.ts +79 -0
- package/apps/lib/components/FormSummary.tsx +282 -0
- package/apps/lib/components/ImageAttachment.tsx +36 -61
- package/apps/lib/components/Label.tsx +49 -42
- package/apps/lib/components/RadioCard.tsx +2 -0
- package/apps/lib/components/SearchableSelect.tsx +9 -3
- package/apps/lib/components/SectionBlock.tsx +16 -8
- package/apps/lib/components/Select.tsx +41 -120
- package/apps/lib/components/TextEditor/RichTextField.tsx +46 -0
- package/apps/lib/components/{TextEditor.tsx → TextEditor/TextEditor.tsx} +63 -9
- package/apps/lib/components/TextEditor/TextEditorToolbar.tsx +429 -0
- package/apps/lib/components/TextEditor/editor-tools/AlignmentTune.ts +70 -0
- package/apps/lib/components/TextEditor/editor-tools/ColorInlineTool.ts +50 -0
- package/apps/lib/components/TextEditor/editor-tools/StrikethroughInlineTool.ts +48 -0
- package/apps/lib/components/TextEditor/editor-tools/inlineFormat.ts +98 -0
- package/apps/lib/{types → components/TextEditor}/editorjs.d.ts +19 -0
- package/apps/lib/components/TextEditor/index.ts +7 -0
- package/apps/lib/components/Textarea.tsx +1 -1
- package/apps/lib/registry.json +51 -58
- package/apps/lib/tsconfig.tsbuildinfo +1 -0
- package/apps/lib/utils/color.ts +175 -0
- package/docs/components/card.md +4 -2
- package/docs/components/chart-block-tool.md +5 -4
- package/docs/components/color-picker.md +101 -0
- package/docs/components/conclusion-header.md +80 -0
- package/docs/components/drawer.md +153 -102
- package/docs/components/form-builder.md +270 -0
- package/docs/components/form-renderer.md +228 -0
- package/docs/components/form-summary.md +123 -0
- package/docs/components/image-attachment.md +10 -4
- package/docs/components/table-dnd-wrapper.md +5 -3
- package/docs/components/text-editor.md +18 -0
- package/docs/how-to/form-and-list-recipes.md +26 -19
- package/docs/how-to/forms-with-form-builder.md +408 -0
- package/docs/how-to/guides.md +153 -179
- package/docs/tutorials/building-first-form.md +150 -159
- package/package.json +1 -1
- /package/apps/lib/components/{ChartBlockTool.ts → TextEditor/ChartBlockTool.ts} +0 -0
- /package/apps/lib/components/{TableDnDWrapper.ts → TextEditor/TableDnDWrapper.ts} +0 -0
- /package/apps/lib/{utils → components/TextEditor}/markdownParser.ts +0 -0
|
@@ -10,7 +10,22 @@ keywords: [drawer, sheet, side-panel, bottom-sheet, slide, vaul, form, create, e
|
|
|
10
10
|
> A gesture-based sliding panel built on [Vaul](https://vaul.emilkowal.ski/). It can slide up from the **bottom**, in from the **right**, or in from the **left**. It supports drag-to-dismiss, nested/stacked drawers with an iOS-style scale-back effect, an optional "notch" tab on the top edge, and a dark framed "tray" look. It is the recommended surface for create / edit forms, filter panels, side navigation, action sheets, and full-screen editors.
|
|
11
11
|
|
|
12
12
|
> [!IMPORTANT]
|
|
13
|
-
> The Drawer is **composed**, not configured. There is no single `direction` style switch on `DrawerContent`. You pick the anchor on the root `<Drawer direction="...">` and then pass layout classes (`wrapperClassName`, `className
|
|
13
|
+
> The Drawer is **composed**, not configured. There is no single `direction` style switch on `DrawerContent`. You pick the anchor on the root `<Drawer direction="...">` and then pass layout classes (`wrapperClassName`, `className`) plus a few flags (`framed`, `notch`, `notchSide`) to get the bottom / right / left look. The recipes below give you exact, copy-paste class strings for each direction.
|
|
14
|
+
|
|
15
|
+
> [!WARNING]
|
|
16
|
+
> **Changed in 3.0.** `DrawerContent` no longer paints the light content surface — wrap your
|
|
17
|
+
> content in a [`DrawerPanel`](#drawerpanel). This is what lets a drawer hold a form panel and
|
|
18
|
+
> a dark summary panel side by side, each with its own background. Two knock-on changes:
|
|
19
|
+
> `className` now targets the **tray** (the old inner-surface meaning moves to `DrawerPanel`),
|
|
20
|
+
> and `showHandle` moves to `DrawerPanel` where it defaults to `false`. `trayClassName` still
|
|
21
|
+
> works as a deprecated alias for `className`.
|
|
22
|
+
>
|
|
23
|
+
> ```diff
|
|
24
|
+
> - <DrawerContent className="rounded-[10px]">…</DrawerContent>
|
|
25
|
+
> + <DrawerContent>
|
|
26
|
+
> + <DrawerPanel className="rounded-[10px]">…</DrawerPanel>
|
|
27
|
+
> + </DrawerContent>
|
|
28
|
+
> ```
|
|
14
29
|
|
|
15
30
|
## Installation
|
|
16
31
|
|
|
@@ -37,20 +52,25 @@ import { Drawer } from "@/components/Drawer";
|
|
|
37
52
|
```tsx
|
|
38
53
|
<Drawer> {/* root — owns open state + direction */}
|
|
39
54
|
<DrawerTrigger /> {/* what opens the drawer (use asChild) */}
|
|
40
|
-
<DrawerContent>
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
<
|
|
53
|
-
|
|
55
|
+
<DrawerContent> {/* the dark tray; frame / positioning / notch */}
|
|
56
|
+
<DrawerPanel> {/* the light content surface */}
|
|
57
|
+
<DrawerHeader>
|
|
58
|
+
<DrawerHeaderTitle> {/* dark pill holding the title + a badge */}
|
|
59
|
+
<DrawerBadge />
|
|
60
|
+
<DrawerTitle />
|
|
61
|
+
</DrawerHeaderTitle>
|
|
62
|
+
<DrawerHeaderActions /> {/* dark pill holding header buttons */}
|
|
63
|
+
</DrawerHeader>
|
|
64
|
+
|
|
65
|
+
{/* ...your body content... */}
|
|
66
|
+
|
|
67
|
+
<DrawerFooter>
|
|
68
|
+
<DrawerClose /> {/* anything that should close the drawer */}
|
|
69
|
+
</DrawerFooter>
|
|
70
|
+
</DrawerPanel>
|
|
71
|
+
|
|
72
|
+
{/* Anything else here sits BESIDE the panel, with its own background —
|
|
73
|
+
e.g. a <FormSummary />. Give the tray a `gap-*` to space them. */}
|
|
54
74
|
</DrawerContent>
|
|
55
75
|
</Drawer>
|
|
56
76
|
```
|
|
@@ -67,27 +87,29 @@ The default. Slides up from the bottom with a drag handle. Use `framed={false}`
|
|
|
67
87
|
<Button variant="PrimeStyle">Open drawer</Button>
|
|
68
88
|
</DrawerTrigger>
|
|
69
89
|
<DrawerContent framed={false}>
|
|
70
|
-
<
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
90
|
+
<DrawerPanel framed={false} showHandle>
|
|
91
|
+
<DrawerHeader>
|
|
92
|
+
<DrawerTitle>Basic drawer</DrawerTitle>
|
|
93
|
+
<DrawerDescription>
|
|
94
|
+
Drag the handle down or press Escape to close.
|
|
95
|
+
</DrawerDescription>
|
|
96
|
+
</DrawerHeader>
|
|
97
|
+
|
|
98
|
+
<div className="px-4 pb-4">
|
|
99
|
+
<p className="typography-body-small-regular text-content-presentation-action-light-secondary">
|
|
100
|
+
Put any content here — forms, lists, settings.
|
|
101
|
+
</p>
|
|
102
|
+
</div>
|
|
82
103
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
104
|
+
<DrawerFooter>
|
|
105
|
+
<DrawerClose asChild>
|
|
106
|
+
<Button variant="PrimeStyle">Done</Button>
|
|
107
|
+
</DrawerClose>
|
|
108
|
+
<DrawerClose asChild>
|
|
109
|
+
<Button variant="BorderStyle">Cancel</Button>
|
|
110
|
+
</DrawerClose>
|
|
111
|
+
</DrawerFooter>
|
|
112
|
+
</DrawerPanel>
|
|
91
113
|
</DrawerContent>
|
|
92
114
|
</Drawer>
|
|
93
115
|
```
|
|
@@ -127,7 +149,6 @@ function ContactDrawer({ mode = "create", contact }) {
|
|
|
127
149
|
</DrawerTrigger>
|
|
128
150
|
|
|
129
151
|
<DrawerContent
|
|
130
|
-
showHandle={false}
|
|
131
152
|
/* The top-edge notch: close button + "Open in new tab" pill. */
|
|
132
153
|
notch={
|
|
133
154
|
<DrawerNotch>
|
|
@@ -141,9 +162,9 @@ function ContactDrawer({ mode = "create", contact }) {
|
|
|
141
162
|
</DrawerNotch>
|
|
142
163
|
}
|
|
143
164
|
wrapperClassName="top-2 right-2 bottom-2 left-auto mt-0 h-auto w-[1046px] max-w-[calc(100vw-16px)]"
|
|
144
|
-
/* With a notch, round all corners EXCEPT the top one the notch sits on. */
|
|
145
|
-
className="rounded-tr-[16px] rounded-b-[16px]"
|
|
146
165
|
>
|
|
166
|
+
{/* With a notch, round all corners EXCEPT the top one the notch sits on. */}
|
|
167
|
+
<DrawerPanel className="rounded-tr-[16px] rounded-b-[16px]">
|
|
147
168
|
{/* Header: badge flips New / Edit, actions live in their own dark pill */}
|
|
148
169
|
<DrawerHeader>
|
|
149
170
|
<DrawerHeaderTitle>
|
|
@@ -234,6 +255,7 @@ function ContactDrawer({ mode = "create", contact }) {
|
|
|
234
255
|
/>
|
|
235
256
|
</SectionBlock>
|
|
236
257
|
</div>
|
|
258
|
+
</DrawerPanel>
|
|
237
259
|
</DrawerContent>
|
|
238
260
|
</Drawer>
|
|
239
261
|
);
|
|
@@ -279,38 +301,40 @@ function RowDivider() {
|
|
|
279
301
|
<Button variant="PrimeStyle">Checkout</Button>
|
|
280
302
|
</DrawerTrigger>
|
|
281
303
|
<DrawerContent framed={false}>
|
|
282
|
-
<
|
|
283
|
-
<
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
<
|
|
289
|
-
<
|
|
290
|
-
<
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
<
|
|
294
|
-
<
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
304
|
+
<DrawerPanel framed={false} showHandle>
|
|
305
|
+
<DrawerHeader>
|
|
306
|
+
<DrawerTitle>Your cart</DrawerTitle>
|
|
307
|
+
<DrawerDescription>1 item — $129.00</DrawerDescription>
|
|
308
|
+
</DrawerHeader>
|
|
309
|
+
|
|
310
|
+
<DrawerFooter>
|
|
311
|
+
<DrawerNested>
|
|
312
|
+
<DrawerTrigger asChild>
|
|
313
|
+
<Button variant="PrimeStyle">Continue to shipping</Button>
|
|
314
|
+
</DrawerTrigger>
|
|
315
|
+
<DrawerContent framed={false}>
|
|
316
|
+
<DrawerPanel framed={false} showHandle>
|
|
317
|
+
<DrawerHeader>
|
|
318
|
+
<DrawerTitle>Shipping</DrawerTitle>
|
|
319
|
+
</DrawerHeader>
|
|
320
|
+
{/* ...another DrawerNested inside here for payment... */}
|
|
321
|
+
</DrawerPanel>
|
|
322
|
+
</DrawerContent>
|
|
323
|
+
</DrawerNested>
|
|
324
|
+
</DrawerFooter>
|
|
325
|
+
</DrawerPanel>
|
|
300
326
|
</DrawerContent>
|
|
301
327
|
</Drawer>
|
|
302
328
|
```
|
|
303
329
|
|
|
304
330
|
### Notch (top-edge tab)
|
|
305
331
|
|
|
306
|
-
The notch is an optional tab that sticks out of the top edge of the drawer — used for a close button plus an "Open in new tab" / "Open in the app" affordance. Pass it to `DrawerContent` via the `notch` prop. When a notch is present,
|
|
332
|
+
The notch is an optional tab that sticks out of the top edge of the drawer — used for a close button plus an "Open in new tab" / "Open in the app" affordance. Pass it to `DrawerContent` via the `notch` prop. When a notch is present, leave the drag handle off (`DrawerPanel`'s `showHandle` defaults to `false`) and use the asymmetric corner rounding on the panel (`className="rounded-tr-[16px] rounded-b-[16px]"` for a right drawer) so it tucks under the notch.
|
|
307
333
|
|
|
308
334
|
**Simple notch** — close button + "Open in new tab" pill. This is the most common form, used on the create/edit drawer above:
|
|
309
335
|
|
|
310
336
|
```tsx
|
|
311
337
|
<DrawerContent
|
|
312
|
-
showHandle={false}
|
|
313
|
-
className="rounded-tr-[16px] rounded-b-[16px]"
|
|
314
338
|
notch={
|
|
315
339
|
<DrawerNotch>
|
|
316
340
|
<DrawerClose asChild>
|
|
@@ -323,7 +347,9 @@ The notch is an optional tab that sticks out of the top edge of the drawer — u
|
|
|
323
347
|
</DrawerNotch>
|
|
324
348
|
}
|
|
325
349
|
>
|
|
326
|
-
|
|
350
|
+
<DrawerPanel className="rounded-tr-[16px] rounded-b-[16px]">
|
|
351
|
+
{/* ... */}
|
|
352
|
+
</DrawerPanel>
|
|
327
353
|
</DrawerContent>
|
|
328
354
|
```
|
|
329
355
|
|
|
@@ -331,8 +357,6 @@ The notch is an optional tab that sticks out of the top edge of the drawer — u
|
|
|
331
357
|
|
|
332
358
|
```tsx
|
|
333
359
|
<DrawerContent
|
|
334
|
-
showHandle={false}
|
|
335
|
-
className="rounded-tr-[16px] rounded-b-[16px]"
|
|
336
360
|
notch={
|
|
337
361
|
<DrawerNotch>
|
|
338
362
|
<DrawerClose asChild>
|
|
@@ -350,7 +374,9 @@ The notch is an optional tab that sticks out of the top edge of the drawer — u
|
|
|
350
374
|
</DrawerNotch>
|
|
351
375
|
}
|
|
352
376
|
>
|
|
353
|
-
|
|
377
|
+
<DrawerPanel className="rounded-tr-[16px] rounded-b-[16px]">
|
|
378
|
+
{/* ... */}
|
|
379
|
+
</DrawerPanel>
|
|
354
380
|
</DrawerContent>
|
|
355
381
|
```
|
|
356
382
|
|
|
@@ -404,7 +430,7 @@ There is **no automatic per-direction styling**. The anchor is set on the root w
|
|
|
404
430
|
|---|---|---|---|
|
|
405
431
|
| Root prop | _(none)_ | `direction="right"` | `direction="left"` |
|
|
406
432
|
| Sits at | full width, pinned to bottom | floating panel on the right | floating panel on the left |
|
|
407
|
-
| Drag handle |
|
|
433
|
+
| Drag handle | on — `<DrawerPanel showHandle>` | off (the default) | off (the default) |
|
|
408
434
|
| Frame / tray | usually off (`framed={false}`) for clean sheet | on (default) for the dark tray | on (default) |
|
|
409
435
|
| Rounded corners | top corners only | all/left corners | top-left + bottom corners |
|
|
410
436
|
| Notch side | top-left (`notchSide="left"`) | top-left | mirror to `notchSide="right"` |
|
|
@@ -420,11 +446,12 @@ No `direction` prop. Keep the drag handle; drop the frame for a clean sheet.
|
|
|
420
446
|
<Button variant="PrimeStyle">Open bottom sheet</Button>
|
|
421
447
|
</DrawerTrigger>
|
|
422
448
|
<DrawerContent framed={false}>
|
|
423
|
-
{
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
449
|
+
<DrawerPanel framed={false} showHandle>
|
|
450
|
+
<DrawerHeader>
|
|
451
|
+
<DrawerTitle>Comments</DrawerTitle>
|
|
452
|
+
</DrawerHeader>
|
|
453
|
+
{/* ... */}
|
|
454
|
+
</DrawerPanel>
|
|
428
455
|
</DrawerContent>
|
|
429
456
|
</Drawer>
|
|
430
457
|
```
|
|
@@ -437,7 +464,9 @@ No `direction` prop. Keep the drag handle; drop the frame for a clean sheet.
|
|
|
437
464
|
<Button variant="PrimeStyle">Open half-screen</Button>
|
|
438
465
|
</DrawerTrigger>
|
|
439
466
|
<DrawerContent framed={false} wrapperClassName="h-full max-h-[97vh]">
|
|
440
|
-
{
|
|
467
|
+
<DrawerPanel framed={false} showHandle>
|
|
468
|
+
{/* ... */}
|
|
469
|
+
</DrawerPanel>
|
|
441
470
|
</DrawerContent>
|
|
442
471
|
</Drawer>
|
|
443
472
|
```
|
|
@@ -452,26 +481,26 @@ A floating panel anchored to the right edge — the canonical home for create/ed
|
|
|
452
481
|
<Button variant="PrimeStyle">Open right drawer</Button>
|
|
453
482
|
</DrawerTrigger>
|
|
454
483
|
<DrawerContent
|
|
455
|
-
showHandle={false}
|
|
456
484
|
wrapperClassName="top-2 right-2 bottom-2 left-auto mt-0 h-auto w-[420px] max-w-[calc(100vw-16px)]"
|
|
457
|
-
|
|
458
|
-
className="rounded-[10px]"
|
|
485
|
+
className="rounded-[16px]"
|
|
459
486
|
>
|
|
460
|
-
<
|
|
461
|
-
<
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
<
|
|
469
|
-
<
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
<
|
|
473
|
-
|
|
474
|
-
|
|
487
|
+
<DrawerPanel className="rounded-[10px]">
|
|
488
|
+
<DrawerHeader>
|
|
489
|
+
<DrawerTitle>Filters</DrawerTitle>
|
|
490
|
+
<DrawerDescription>Status, owner, tags, priority…</DrawerDescription>
|
|
491
|
+
</DrawerHeader>
|
|
492
|
+
<div className="px-4 pb-4 space-y-3 flex-1 overflow-y-auto">
|
|
493
|
+
{/* ...filter rows... */}
|
|
494
|
+
</div>
|
|
495
|
+
<DrawerFooter>
|
|
496
|
+
<DrawerClose asChild>
|
|
497
|
+
<Button variant="PrimeStyle">Apply</Button>
|
|
498
|
+
</DrawerClose>
|
|
499
|
+
<DrawerClose asChild>
|
|
500
|
+
<Button variant="BorderStyle">Reset</Button>
|
|
501
|
+
</DrawerClose>
|
|
502
|
+
</DrawerFooter>
|
|
503
|
+
</DrawerPanel>
|
|
475
504
|
</DrawerContent>
|
|
476
505
|
</Drawer>
|
|
477
506
|
```
|
|
@@ -488,10 +517,8 @@ Mirror of the right recipe: `direction="left"`, anchor to the left edge, and if
|
|
|
488
517
|
<Button variant="PrimeStyle">Open left drawer</Button>
|
|
489
518
|
</DrawerTrigger>
|
|
490
519
|
<DrawerContent
|
|
491
|
-
showHandle={false}
|
|
492
520
|
notchSide="right"
|
|
493
521
|
wrapperClassName="top-2 left-2 bottom-2 right-auto mt-0 h-auto w-[420px] max-w-[calc(100vw-16px)]"
|
|
494
|
-
className="rounded-tl-[16px] rounded-b-[16px]"
|
|
495
522
|
notch={
|
|
496
523
|
<DrawerNotch>
|
|
497
524
|
<DrawerClose asChild>
|
|
@@ -504,13 +531,15 @@ Mirror of the right recipe: `direction="left"`, anchor to the left edge, and if
|
|
|
504
531
|
</DrawerNotch>
|
|
505
532
|
}
|
|
506
533
|
>
|
|
507
|
-
<
|
|
508
|
-
<
|
|
509
|
-
<
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
534
|
+
<DrawerPanel className="rounded-tl-[16px] rounded-b-[16px]">
|
|
535
|
+
<DrawerHeader>
|
|
536
|
+
<DrawerHeaderTitle>
|
|
537
|
+
<DrawerBadge color="Purple">Menu</DrawerBadge>
|
|
538
|
+
<DrawerTitle>Navigation</DrawerTitle>
|
|
539
|
+
</DrawerHeaderTitle>
|
|
540
|
+
</DrawerHeader>
|
|
541
|
+
{/* ...nav items... */}
|
|
542
|
+
</DrawerPanel>
|
|
514
543
|
</DrawerContent>
|
|
515
544
|
</Drawer>
|
|
516
545
|
```
|
|
@@ -528,7 +557,9 @@ Anchor a bottom drawer to every edge via `wrapperClassName`.
|
|
|
528
557
|
framed={false}
|
|
529
558
|
wrapperClassName="inset-x-0 top-0 bottom-0 m-0 h-screen w-screen max-w-none"
|
|
530
559
|
>
|
|
531
|
-
{
|
|
560
|
+
<DrawerPanel framed={false} showHandle>
|
|
561
|
+
{/* immersive editor / media viewer */}
|
|
562
|
+
</DrawerPanel>
|
|
532
563
|
</DrawerContent>
|
|
533
564
|
</Drawer>
|
|
534
565
|
```
|
|
@@ -551,25 +582,45 @@ Wraps Vaul's `Drawer.Root` and defaults `shouldScaleBackground` to `true`. Accep
|
|
|
551
582
|
|
|
552
583
|
### `DrawerContent`
|
|
553
584
|
|
|
554
|
-
The
|
|
585
|
+
The dark tray. It frames and positions, but paints nothing over its children — each child
|
|
586
|
+
brings its own background. This is where direction-specific styling is applied.
|
|
555
587
|
|
|
556
588
|
| Prop | Type | Default | Description |
|
|
557
589
|
|---|---|---|---|
|
|
558
590
|
| `framed` | `boolean` | `true` | Show the dark "tray" frame (border + inset shadow) around the panel. Set `false` for clean bottom sheets. |
|
|
559
|
-
| `showHandle` | `boolean` | `true` | Show the centered drag handle. Auto-hidden when a `notch` is present. Set `false` for side drawers. |
|
|
560
591
|
| `notch` | `ReactNode` | — | A `DrawerNotch` tab rendered on the top edge. |
|
|
561
592
|
| `notchSide` | `"left" \| "right"` | `"left"` | Which side the notch attaches to (and which corner stays square). Use `"right"` for left-anchored drawers. |
|
|
562
593
|
| `wrapperClassName` | `string` | — | Classes on the outer positioned element — this is how you anchor/size the panel per direction. |
|
|
563
|
-
| `
|
|
564
|
-
| `
|
|
594
|
+
| `className` | `string` | — | Classes on the **dark tray**. Add a `gap-*` here when the tray holds more than one child. |
|
|
595
|
+
| `trayClassName` | `string` | — | **Deprecated** — an alias for `className` (merged last, so it still wins). |
|
|
565
596
|
| `...props` | Vaul `Content` props | — | Forwarded to `Drawer.Content`. |
|
|
566
597
|
|
|
598
|
+
### `DrawerPanel`
|
|
599
|
+
|
|
600
|
+
The light `#F0F0F0` content surface. The tray paints nothing over its children, so a drawer
|
|
601
|
+
can hold a panel **plus something else beside it** — a [FormSummary](./form-summary.md), say —
|
|
602
|
+
with each bringing its own background.
|
|
603
|
+
|
|
604
|
+
```tsx
|
|
605
|
+
<DrawerContent className="gap-[6px]">
|
|
606
|
+
<DrawerPanel>…form…</DrawerPanel>
|
|
607
|
+
<FormSummary … /> {/* dark, sits beside the panel */}
|
|
608
|
+
</DrawerContent>
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
| Prop | Type | Default | Description |
|
|
612
|
+
|---|---|---|---|
|
|
613
|
+
| `framed` | `boolean` | `true` | Panel border + inset shadow that pairs with the tray's frame. Match the tray's `framed`. |
|
|
614
|
+
| `showHandle` | `boolean` | `false` | Show the centered drag handle. Turn on for bottom sheets; leave off when there's a `notch`. |
|
|
615
|
+
| `className` | `string` | — | Classes on the surface (e.g. corner rounding). |
|
|
616
|
+
|
|
567
617
|
### Sub-components
|
|
568
618
|
|
|
569
619
|
| Component | Description |
|
|
570
620
|
|---|---|
|
|
571
621
|
| `DrawerTrigger` | Opens the drawer. Use `asChild` to wrap your own button. |
|
|
572
622
|
| `DrawerClose` | Closes the drawer. Use `asChild` to wrap any element. |
|
|
623
|
+
| `DrawerPanel` | The light content surface. Wrap your body in it — see above. |
|
|
573
624
|
| `DrawerNested` | A nested/stacked drawer. Must be rendered inside an open `DrawerContent`. |
|
|
574
625
|
| `DrawerHeader` | Header row (space-between layout) holding title + actions. |
|
|
575
626
|
| `DrawerHeaderTitle` | Dark rounded pill that groups a `DrawerBadge` + `DrawerTitle`. |
|