Modal

Modal is a component that is displayed over the main content to focus the user's attention solely on the information.

Usage

import { Modal } from "@yamada-ui/react"
<Modal.Root>
  <Modal.OpenTrigger />
  <Modal.Overlay />
  <Modal.Content>
    <Modal.CloseButton />
    <Modal.Header>
      <Modal.Title />
    </Modal.Header>
    <Modal.Body />
    <Modal.Footer>
      <Modal.CloseTrigger />
    </Modal.Footer>
  </Modal.Content>
</Modal.Root>

Use props

Change Size

Change Position

To change the display position, set placement to start-center, center-start, etc. By default, center-center is set.

Change Animation

To change the show or hide animation, set animation to "block-start", "inline-end", etc. By default, "scale" is set.

Change Duration

To change the duration, set duration to a numerical value (seconds).

Change Overflow Behavior

By default, "inside" is set, and scrolling only occurs within Modal.Body. If you set "outside", scrolling will occur within the Modal.Content.

Do Not Block Scroll When Modal Opens

By default, when the modal opens, it blocks the scroll of the main content to ensure accessibility. If you do not want to block the scroll of the main content, set blockScrollOnMount to false.

Customize the Overlay

If you want to customize overlay, use Modal.Overlay.

Disable the Overlay

To disable (hide) the modal's overlay, set withOverlay to false.

Customize the Close Button

If you want to customize close button, use Modal.CloseButton.

Disable the Close Button

To disable (hide) the modal's close button, set withCloseButton to false.

Nested Modals

Props

Accessibility

Currently, this section is being updated due to the migration of v2.