export const title = "Modal components" export const description = "Powerful and customizable React modal components built for modern applications and websites. These modals are built using React Aria and styled with Tailwind CSS." export const links = { github: "https://github.com/untitleduico/react/tree/main/components/application/modals/modal.tsx", rac: "https://react-spectrum.adobe.com/react-aria/Modal.html" }
## Installation You can add this modal component using our CLI or manually: ```bash npx untitledui add modal ``` Copy the files below into your project: Great! Now you can start using the calendar components in your project by just copy/pasting our examples below. ## Modals examples Below are examples and variations of this modals component: ### Stacked left aligned {{ tocOnly:true }}
### Warning stacked left aligned {{ tocOnly:true }}
### Destructive stacked left aligned {{ tocOnly:true }}
### Horizontal {{ tocOnly:true }}
### Warning horizontal {{ tocOnly:true }}
### Destructive horizontal {{ tocOnly:true }}
### Login {{ tocOnly:true }}
### Signup 01 {{ tocOnly:true }}
### Signup 02 {{ tocOnly:true }}
### Checkboxes {{ tocOnly:true }}
### Toggles {{ tocOnly:true }}
### Link field {{ tocOnly:true }}
### Dropdown {{ tocOnly:true }}
### Input field {{ tocOnly:true }}
### Labels {{ tocOnly:true }}
### Access request {{ tocOnly:true }}
### Email invite {{ tocOnly:true }}
### User invite {{ tocOnly:true }}
### Stacked with team {{ tocOnly:true }}
### Stacked with team and link {{ tocOnly:true }}
### Stacked with team and invites {{ tocOnly:true }}
### Verification code {{ tocOnly:true }}
### Two-factor code {{ tocOnly:true }}
### Password prompt {{ tocOnly:true }}
### Centered photo {{ tocOnly:true }}
### Centered photo carousel {{ tocOnly:true }}
### Centered video carousel {{ tocOnly:true }}
### Payment details {{ tocOnly:true }}
### Payment details with image {{ tocOnly:true }}
### Plan 01 {{ tocOnly:true }}
### Plan 02 {{ tocOnly:true }}
### Payment method {{ tocOnly:true }}
### Date Picker {{ tocOnly:true }}
### File upload {{ tocOnly:true }}
### Profile settings {{ tocOnly:true }}
### User selection {{ tocOnly:true }}
### Form 01 {{ tocOnly:true }}
### Form 02 {{ tocOnly:true }}
### Image crop {{ tocOnly:true }}
### Calendar event {{ tocOnly:true }}
### Banner appearance {{ tocOnly:true }}
### Appearance settings {{ tocOnly:true }}
### AI assistant {{ tocOnly:true }}
### User settings {{ tocOnly:true }}
### New project {{ tocOnly:true }}
### Text editor {{ tocOnly:true }}
### Share project {{ tocOnly:true }}
### Create event {{ tocOnly:true }}
### Integration {{ tocOnly:true }}
### New message empty state {{ tocOnly:true }}
### New message filled {{ tocOnly:true }}
## API reference `. Anything inside the modal can then close it by calling `setIsOpen(false)`, and a `CloseButton` closes it without a handler because it fills React Aria's `\"close\"` slot.", }, { question: "What components make up a modal?", answer: "Three components from `modal.tsx`, nested in this order: `ModalOverlay` (holds the open state through `isOpen`/`onOpenChange` and renders the backdrop and positioning), `Modal` (the container, including the zoom animations), and `Dialog` (the content wrapper). Add a `CloseButton` inside the `Dialog` yourself if you want a close icon in the corner.", }, { question: "How do I prevent users from closing a modal?", answer: "Leave `isDismissable` off `ModalOverlay` (it defaults to `false`) so clicking the backdrop does nothing, and pass `isKeyboardDismissDisabled` to stop Escape from closing it. Neither prop affects a `CloseButton`, so remove that too if the examples you copied include one.", }, { question: "How do I customize modal animations?", answer: "`ModalOverlay` fades in over 300ms and out over 200ms, and `Modal` zooms in from and out to 95% scale with the same timings. Both accept a `className` function that receives `isEntering` and `isExiting`, and your classes are merged last with `tailwind-merge`, so they override the defaults.", }, { question: "How do modals behave on small screens?", answer: "Below the `sm` breakpoint the overlay aligns the modal to the bottom of the screen; from `sm` up it is centered. The modal's max height is capped to the visible viewport minus the overlay padding, and `Dialog` scrolls its content when it is taller than that.", }, { question: "What do I need to do to make a modal accessible?", answer: "Give each `Dialog` an accessible name, either with a React Aria `Heading` using `slot=\"title\"`, as the examples do, or with `aria-label`. React Aria handles the rest: focus is contained inside the modal while it is open and returns to the previously focused element when it closes, and Escape closes it unless `isKeyboardDismissDisabled` is set.", }, ]} />