Velora UI

Animated Modal

Native dialog whose panel springs in with a tilt over a blurred backdrop.

  • 3.0 KB gzipped
  • Deps: motion/react
  • Reduced-motion safe
  • Base UI & Radix compatible
Open in v0

Installation

pnpm dlx shadcn@latest add https://velora.colorlib.com/r/animated-modal.json

Adds components/velora/animated-modal.tsx, installs motion.

Examples

Book your trip

A travel booking modal with a photo strip, trip details and a CTA footer.

Props

Modal

PropTypeDefault
open

Controlled open state

boolean—
defaultOpen

Initial open state when uncontrolled

booleanfalse
onOpenChange

Called whenever the modal asks to open or close

(open: boolean) => void—
children*

ModalTrigger, ModalContent and anything else

React.ReactNode—

ModalTrigger

Also accepts every <button> attribute, forwarded to the root element.

ModalContent

PropTypeDefault
title

Heading rendered at the top; it becomes the dialog's accessible name

React.ReactNode—
description

Supporting text under the title, announced as the dialog's description

React.ReactNode—
showCloseButton

Show the × button in the top-right corner

booleantrue

Also accepts every <div> attribute, forwarded to the root element.

ModalFooter

Also accepts every <div> attribute, forwarded to the root element.

ModalClose

Also accepts every <button> attribute, forwarded to the root element.

Accessibility

Reduced motion
The spring, scale and tilt are dropped; the panel and backdrop fade in and out over 150–200ms.
Keyboard
The trigger is a native button. Opening moves focus into the dialog and Tab stays inside it (native showModal); Escape, the × button and ModalClose close it, and focus returns to the element that opened it.
Screen readers
A native modal <dialog> named by its title (or aria-labelledby) and described by its description; the page behind is inert while it is open.