Menu

Modal

Dialog with actions. 3 sizes.

Place this order?

2 tins of Darjeeling and a clay cup, ৳1,260 in total. We will send it to House 14, Dhanmondi.

Installation

$ npx uix-ui@latest add modal

This copies the file into components/ui/modal.tsx in your project. npx shadcn@latest add @uix/modal works too.

Usage

modal.tsx
import { Modal } from "@/components/ui/modal";

<>
  <Button onClick={() => setOpen(true)}>Place order</Button>
  <Modal
    open={open}
    onClose={() => setOpen(false)}
    title="Place this order?"
    footer={<><Button variant="ghost" onClick={() => setOpen(false)}>Not yet</Button><Button onClick={() => setOpen(false)}>Place order</Button></>}
  >
    2 tins of Darjeeling and a clay cup, ৳1,260 in total. We will send it to House 14, Dhanmondi.
  </Modal>
</>

Examples

Warning with an icon

Cancel order #1042?

The tea has already been packed. You will get your money back to bKash in 2 days.

Large, with a form

Gift note

Props

PropTypeDefaultDescription
sizesm | md | lg"md"
openboolean–
onClose() => void–
titleReact.ReactNode–
headerIconReact.ReactNode–Icon in a round badge above the title.
showClosebooleantrueSet to false to hide the close button in the corner.
footerReact.ReactNode–Buttons, right-aligned under the content.

Everything else is passed to the root element, so className, aria-* and event handlers work as usual.

Dependencies

Installed for you by the CLI.

  • class-variance-authority
  • clsx
  • tailwind-merge
  • lib/utils.ts
  • components/ui/icons.tsx
esc

↑↓ to navigate · ↵ to select · esc to close