127 Components

Modal Popup

Overlays

Animated popup modal dialog with spring scale transitions, top-level portal rendering, danger/confirm variants, and Escape dismissal.

Installation

Install directly into your project using the shadcn CLI or copy the source code manually.

Requires:framer-motionlucide-reactclsxtailwind-merge
$npx shadcn@latest add "https://boseui.site/r/modal-popup.json"

Props

TypeScript props supported by <ModalPopup />.

13 props
PropTypeDefaultDescription
openboolean—Controlled open state.
defaultOpenbooleanfalseInitial open state when used uncontrolled.
onOpenChange(open: boolean) => void—Callback fired when the modal open state changes.
titlestring"Confirm Deployment"Primary heading text inside the modal dialog.
descriptionstring—Supporting description text below the title.
size"sm" | "md" | "lg""md"Maximum width preset of the modal card.
variant"default" | "danger""default"Visual style for the primary confirmation button.
triggerLabelstring"Open Popup"Label for the default trigger button.
confirmLabelstring"Confirm"Text label for the primary action button.
cancelLabelstring"Cancel"Text label for the cancel button.
hideFooterbooleanfalseHides default Cancel/Confirm footer buttons when rendering a custom form.
onConfirm() => void—Callback executed when the user clicks the confirm button.
triggerReact.ReactNode—Custom trigger element used to toggle modal open state

Key Features

  • Renders into document.body via React portal at z-[9999] with background scroll locking.
  • Supports sm, md, and lg width presets plus default and danger confirmation variants.
  • Works both controlled and uncontrolled with custom trigger and optional hideFooter.

Keyboard & Accessibility

  • Uses semantic role='dialog' and aria-modal='true'.
  • Dismisses immediately when pressing Escape or clicking outside the dialog.
  • Disables scale/translate motion when prefers-reduced-motion is enabled.