HextaUI

Dialog: Sizes

size sets the maximum width on larger screens: sm, default or lg.

import { Button } from "@/components/ui/button"
import {
  Dialog,
  DialogClose,
  DialogContent,
  DialogDescription,
  DialogFooter,
  DialogHeader,
  DialogTitle,
  DialogTrigger,
} from "@/components/ui/dialog"

const sizes = [
  { size: "sm", label: "Small" },
  { size: "default", label: "Default" },
  { size: "lg", label: "Large" },
] as const

export function DialogSizes() {
  return (
    <div className="flex flex-wrap justify-center gap-2">
      {sizes.map(({ size, label }) => (
        <Dialog key={size}>
          <DialogTrigger render={<Button variant="outline" />}>
            {label}
          </DialogTrigger>
          <DialogContent size={size}>
            <DialogHeader>
              <DialogTitle>{label} dialog</DialogTitle>
              <DialogDescription>
                On phones every size becomes a full-width bottom sheet.
              </DialogDescription>
            </DialogHeader>
            <DialogFooter>
              <DialogClose render={<Button />}>Done</DialogClose>
            </DialogFooter>
          </DialogContent>
        </Dialog>
      ))}
    </div>
  )
}

This adds the example as components/examples/dialog/sizes.tsx, together with the Dialog component and the HextaUI theme tokens it needs.

pnpm dlx shadcn@latest add https://hextaui.com/r/dialog-sizes.json

To add only the component, follow the Dialog installation.

Props in this example

The Dialog props this example sets, from the API reference.

PropTypeDefault
render
ReactElement | (props, state) => ReactElement<button>
PropTypeDefault
size
"sm" | "default" | "lg""default"
PropTypeDefault
render
ReactElement | (props, state) => ReactElement<button>

Every prop is in the Dialog API reference.

See them all, with keyboard support and accessibility notes, on the Dialog page.