Actions & overlays@neumorphism-ui/dialog

Dialog

Built on Base UI Dialog to compose a Portal, Backdrop, Popup, title, description, and close actions. The primitive handles Escape, outside clicks, focus trapping, and focus restoration.

@neumorphism-ui/dialog
Registry JSON

Preview

Open it to test the focus trap and Escape-to-close behavior.

Installation

Installation: dialognpx shadcn@latest add @neumorphism-ui/dialog

The CLI resolves npm dependencies, base tokens, utilities, and component source in order.

New to this Registry? Set up the namespace before continuing.

Usage

Usage: Installationnpx shadcn@latest add @neumorphism-ui/button @neumorphism-ui/dialog

Import

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

Example

Dialog usage code
<Dialog>
  <DialogTrigger render={<Button variant="primary" />}>
    Create project
  </DialogTrigger>
  <DialogContent>
    <DialogHeader>
      <DialogTitle>New project</DialogTitle>
      <DialogDescription>
        You can change the name and description later.
      </DialogDescription>
    </DialogHeader>
    <DialogFooter>
      <DialogClose render={<Button variant="soft" />}>Cancel</DialogClose>
      <Button variant="primary">Create</Button>
    </DialogFooter>
  </DialogContent>
</Dialog>

API Reference

ComponentPropTypeDefaultDescription
Dialogopen / defaultOpenbooleanfalseThe controlled open state or initial uncontrolled open state.
DialogonOpenChange(open: boolean) => void—Called when the open state changes.
DialogmodalbooleantrueDetermines background interaction and focus-trap behavior.
DialogTrigger / DialogCloserenderReactElement | (props, state) => ReactElement—Composes trigger or close behavior onto a button or link.
DialogContentshowCloseButtonbooleantrueDisplays the default close button in the upper-right corner.
DialogContentoverlayClassNamestring | (state) => string—Extends the Backdrop color, blur, and transition independently.
DialogdisablePointerDismissalbooleanfalsePrevents an outside pointer press from closing Dialog.

Accessibility

  • 01

    Provide DialogTitle inside DialogContent and connect supporting copy with DialogDescription.

  • 02

    Base UI manages the modal focus trap, closing with Escape, and restoring focus to the trigger after close.

  • 03

    Wrap the cancel action in DialogFooter with DialogClose to provide an explicit close behavior.