Components
Modal
Documentation for the Modal component.
Modal
Preview
The Modal component is built with React Aria and styled using StyleX.
Import
import { Modal } from '@moul-dev/ui';Usage
Here is a basic example of how to use the Modal component:
import { Modal } from '@moul-dev/ui';
export default function Example() {
return (
<Modal>
{/* Component content */}
</Modal>
);
}Sizing and Variants
The Modal component supports size variants via the size prop:
sm: Max width of400pxon desktop.md: Max width of500pxon desktop (default).lg: Max width of640pxon desktop.
<Modal size="sm">
{/* Small Modal */}
</Modal>Mobile Responsive Layout
On mobile viewports (<= 640px), the modal is optimized to behave like a bottom drawer/sheet:
- Aligned to the bottom of the screen.
- Extends to
100%viewport width. - Bottom corner radiuses are set to
0for seamless edge-to-edge styling. - Renders with a smooth, subtle fade-in and slide-up animation from the bottom of the viewport.
Props
Modal Props
Prop
Type
Default className: react-aria-Modal
| Render Prop | CSS Selector |
|---|---|
isOpen Whether the modal is open. | [data-open] |
isEntering Whether the entrance transition is animating. | [data-entering] |
isExiting Whether the exit transition is animating. | [data-exiting] |