Skip to Content
zjkm-ui
Components

Zoom Dialog

A dialog that grows out of the button that opened it.

Order #2041

3 items · Shipped Tuesday · Arrives Friday

Props
<ZoomDialog trigger="Order details" title="Order #2041">
  <OrderSummary />
</ZoomDialog>

Installation

npx shadcn@latest add https://ui.zjkm.tech/r/zoom-dialog.json
import { ZoomDialog } from "@/components/zoom-dialog"

Using JavaScript? Set tsx: false in components.json and the CLI converts it.

New to shadcn? Run npx shadcn@latest init first. The CLI needs components.json and the @/ import alias.

Usage

A button that opens a dialog which grows out of the button itself, so it's clear where it came from. It's a native modal <dialog>: focus moves in and stays there, Escape closes it, and the page behind can't be reached.

import { ZoomDialog } from "@/components/zoom-dialog";

export function OrderRow({ order }: { order: Order }) {
  return (
    <ZoomDialog trigger="Details" title={`Order #${order.id}`}>
      <OrderSummary order={order} />
    </ZoomDialog>
  );
}

Props

PropTypeDefaultDescription
triggerReactNodeThe opening button's label.
titlestringThe heading and accessible name.
childrenReactNodeThe content.
classNamestringClasses for the opening button.

With reduced motion, the dialog appears without growing.

On this page