Dialog overlay for focused user interactions and important content.
isKeyboardDismissDisabled
1<Modal>
2 <Modal.Trigger>
3 Click me to open modal
4 </Modal.Trigger>
5 <Modal.Content>
6 Hello, I'm the content!
7 </Modal.Content>
8</Modal>1<Modal>
2 <Modal.Trigger></Modal.Trigger>
3 <Modal.Content></Modal.Content>
4</Modal>npm install @rootui/modal1import { Modal } from "@rootui/modal";
2
3export default function Page() {
4 return (
5 <Modal>
6 <Modal.Trigger>
7 This is the trigger
8 </Modal.Trigger>
9 <Modal.Content>
10 This is the content
11 </Modal.Content>
12 </Modal>
13 )
14}See the React Aria documentation for more information.
Prop | Type | Default |
|---|---|---|
| | |
Whether the modal is open by default (controlled). | ||
| | |
Whether the modal is open by default (uncontrolled). | ||
| | |
Handler that is called when the overlay's open state changes. | ||
Prop | Type | Default |
|---|---|---|
| | |
Prop | Type | Default |
|---|---|---|
| | |
Whether to close the modal when the user interacts outside it. | ||
| | |
Whether pressing the escape key to close the modal should be disabled. | ||
| | |
When user interacts with the argument element outside of the overlay ref, return true if onClose should be called. This gives you a chance to filter out interaction with elements that should not dismiss the overlay. By default, onClose will always be called on interaction outside the overlay ref. | ||
Attribute | Description |
|---|---|
| Whether the modal is currently entering. Use this to apply animations. |
| Whether the modal is currently exiting. Use this to apply animations. |