Dialog
Spring Dialog
A modal dialog whose panel springs up over a backdrop that fades and blurs in.
npx motionsnack add spring-dialogCustomize
Accent
<SpringDialog />Props
22 properties
| Property | Type | Default | Description |
|---|---|---|---|
| trigger | ReactNode | 'Publish release' | Content of the button that opens the dialog. |
| open | boolean | - | Controlled open state. Leave undefined to let the component manage it. |
| defaultOpen | boolean | false | Open state on first render when uncontrolled. |
| onOpenChange | (open: boolean) => void | - | Called whenever the dialog wants to open or close. |
| onConfirm | () => void | - | Called when the confirming button is pressed, before the dialog closes. |
| onCancel | () => void | - | Called when the dialog is dismissed without confirming. |
| className | string | '' | Extra classes on the wrapper around the trigger. |
| triggerLabel | string | 'Publish release' | Text of the button that opens the dialog. Empty hides the button. |
| title | string | 'Publish this release?' | Heading of the dialog. |
| description | string | 'Version 2.4 goes live for all 1,280 workspaces right away. You can roll back from the release history at any time.' | Paragraph under the heading. |
| confirmLabel | string | 'Publish' | Label of the confirming button. Empty hides it. |
| cancelLabel | string | 'Not yet' | Label of the cancelling button. Empty hides it. |
| variant | 'default' | 'destructive' | 'default' | Destructive turns it into a confirm (alert dialog): no close button, the confirm carries an error-coloured icon. |
| icon | 'spark' | 'info' | 'trash' | 'none' | 'spark' | Icon in the coloured badge above the heading. |
| showClose | boolean | true | Round close button in the top right corner. |
| closeOnBackdrop | boolean | true | A click on the backdrop closes the dialog. |
| closeOnEscape | boolean | true | The Escape key closes the dialog. |
| lockScroll | boolean | true | Stop the page behind from scrolling while the dialog is open. |
| accent | string | '' | Colour of the icon tile. Empty keeps it monochrome. |
| startScale | number | 0.9 | Scale the panel starts from. 1 turns the scaling off. |
| bounce | number | 0.35 | Bounce of the spring that scales the panel up. |
| duration | number | 0.5 | Seconds the spring takes to settle. |
About Spring Dialog
Spring Dialog pairs a trigger button with an accessible modal: icon badge, title, text, confirm and cancel buttons and a close button. When it opens, the backdrop fades in and blurs the page while the panel scales up on a spring with a bounce you can tune. Closing is a quick, quiet fade so the dialog gets out of the way. Focus moves into the panel, Tab stays trapped inside it and focus returns to the trigger afterwards. Escape and a click on the backdrop dismiss it, and both can be switched off. It works controlled or uncontrolled and falls back to a plain fade for reduced motion.
What's included
- Spring scale-in with adjustable bounce, duration and start scale
- Backdrop that fades and blurs the page
- Focus trap with focus returned to the trigger
- Escape and backdrop click to dismiss
- Controlled and uncontrolled open state
- Default and danger confirm button, optional icon badge
- Light and dark looks, reduced motion support
- Type
- Animated React dialog component
- Library
- Components · Dialog
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-09-20
- Install