|
1
|
--- |
|
2
|
generate_toc: true |
|
3
|
--- |
|
4
|
|
|
5
|
import { ComponentExample } from "@/components/ComponentExample" |
|
6
|
import { ComponentReference } from "@/components/ComponentReference" |
|
7
|
|
|
8
|
export const metadata = { |
|
9
|
title: `Focus Modal`, |
|
10
|
} |
|
11
|
|
|
12
|
# {metadata.title} |
|
13
|
|
|
14
|
A component for rendering a modal dialog shown over the main content. |
|
15
|
|
|
16
|
In this guide, you'll learn how to use the Focus Modal component. |
|
17
|
|
|
18
|
<ComponentExample name="focus-modal-demo" /> |
|
19
|
|
|
20
|
## Usage |
|
21
|
|
|
22
|
```tsx |
|
23
|
import { FocusModal } from "@medusajs/ui" |
|
24
|
``` |
|
25
|
|
|
26
|
```tsx |
|
27
|
<FocusModal> |
|
28
|
<FocusModal.Trigger>Trigger</FocusModal.Trigger> |
|
29
|
<FocusModal.Content> |
|
30
|
<FocusModal.Header>Title</FocusModal.Header> |
|
31
|
<FocusModal.Body>Content</FocusModal.Body> |
|
32
|
</FocusModal.Content> |
|
33
|
</FocusModal> |
|
34
|
``` |
|
35
|
|
|
36
|
--- |
|
37
|
|
|
38
|
## API Reference |
|
39
|
|
|
40
|
<ComponentReference mainComponent="FocusModal" componentsToShow={[ |
|
41
|
"FocusModal", |
|
42
|
"FocusModal.Trigger", |
|
43
|
"FocusModal.Content", |
|
44
|
"FocusModal.Header", |
|
45
|
"FocusModal.Body", |
|
46
|
"FocusModal.Footer" |
|
47
|
]} /> |
|
48
|
|
|
49
|
--- |
|
50
|
|
|
51
|
|
|
52
|
## Examples |
|
53
|
|
|
54
|
### Control Focus Modal Open State |
|
55
|
|
|
56
|
<ComponentExample name="focus-modal-controlled" /> |
|
57
|
|
|
58
|
### Using Form in Focus Modal |
|
59
|
|
|
60
|
<ComponentExample name="focus-modal-form" /> |
|
61
|
|
|
62
|
### Nested Focus Modals |
|
63
|
|
|
64
|
A focus modal can open another focus modal. These focus modals will be stacked on top of each other. You can nest as many focus modals as you want. |
|
65
|
|
|
66
|
<ComponentExample name="focus-modal-nested" hideFeedback /> |