docs(modal): fix small typos and add clarifying language (#4629)

This commit is contained in:
millmason 2025-01-28 07:52:05 -05:00 committed by GitHub
parent cddba8281c
commit 11b939d166
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 9 deletions

View File

@ -0,0 +1,2 @@
---
---

View File

@ -1,13 +1,13 @@
--- ---
title: "Modal" title: "Modal"
description: "Display a dialog with a custom content that requires attention or provides additional information." description: "Display a dialog with custom content that requires attention or provides additional information."
--- ---
import {modalContent} from "@/content/components/modal"; import {modalContent} from "@/content/components/modal";
# Modal # Modal
Displays a dialog with a custom content that requires attention or provides additional information. Displays a dialog with custom content that requires attention or provides additional information.
<ComponentLinks component="modal" reactAriaHook="useModal" /> <ComponentLinks component="modal" reactAriaHook="useModal" />
@ -64,7 +64,7 @@ HeroUI exports 5 modal-related components:
When the modal opens: When the modal opens:
- Focus is bounded within the modal and set to the first tabbable element. - Focus is bounded within the modal and set to the first tabbable element.
- Content behind a modal dialog is inert, meaning that users cannot interact with it. - Content behind the modal dialog is inert, meaning that users cannot interact with it.
<CodeDemo title="Usage" files={modalContent.usage} /> <CodeDemo title="Usage" files={modalContent.usage} />
@ -78,13 +78,13 @@ By default, the modal can be closed by clicking on the overlay or pressing the <
You can disable this behavior by setting the following properties: You can disable this behavior by setting the following properties:
- Set the `isDismissable` property to `false` to prevent the modal from closing when clicking on the overlay. - Set the `isDismissable` property to `false` to prevent the modal from closing when clicking on the overlay.
- Set the `isKeyboardDismissDisabled` property to `true` to prevent the modal from closing when pressing the Esc key. - Set the `isKeyboardDismissDisabled` property to `true` to prevent the modal from closing when pressing the <Kbd>Esc</Kbd> key.
<CodeDemo title="Non-dissmissible" files={modalContent.nonDismissable} /> <CodeDemo title="Non-dissmissible" files={modalContent.nonDismissable} />
### Modal placement ### Modal placement
By default the modal is centered on screens higher than `sm` and is at the `bottom` of the screen on mobile. This placement is called `auto`, but By default the modal is centered on screens larger than `sm` and is at the `bottom` of the screen on mobile. This placement is called `auto`, but
you can change it by using the `placement` prop. you can change it by using the `placement` prop.
<CodeDemo <CodeDemo
@ -97,7 +97,7 @@ you can change it by using the `placement` prop.
/> />
> **Note**: The `top-center` and `bottom-center` positions mean that the modal is positioned at the top / bottom of the screen > **Note**: The `top-center` and `bottom-center` positions mean that the modal is positioned at the top / bottom of the screen
> on mobile and at the center of the screen on desktop. > on mobile, and at the center of the screen on desktop.
### Overflow scroll ### Overflow scroll
@ -111,7 +111,7 @@ You can use the `scrollBehavior` prop to set the scroll behavior of the modal.
### With Form ### With Form
The `Modal` handles the focus within the modal content. It means that you can use the modal with The `Modal` handles the focus within the modal content. It means that you can use the modal with
form elements without any problem. the focus returns to the trigger when the modal closes. form elements without any problem. The focus returns to the trigger when the modal closes.
<CodeDemo title="With Form" files={modalContent.form} /> <CodeDemo title="With Form" files={modalContent.form} />
@ -140,13 +140,13 @@ Modal offers a `motionProps` property to customize the `enter` / `exit` animatio
### Draggable ### Draggable
Try to drag the header part. Try to drag the modal by clicking on the modal header and dragging.
<CodeDemo title="Draggable" files={modalContent.draggable} /> <CodeDemo title="Draggable" files={modalContent.draggable} />
### Draggable Overflow ### Draggable Overflow
Set overflow to true can drag overflow the viewport. Setting overflow to `true` allows users to drag the modal to a position where it overflows the viewport.
<CodeDemo title="Draggable Overflow" files={modalContent.draggableOverflow} /> <CodeDemo title="Draggable Overflow" files={modalContent.draggableOverflow} />