Build · UI components · beginner
Reusable Modal Dialog Component
UI components General beginner v0Lovable
How to use
- Copy the prompt below
- Paste it into v0, Lovable
- Review the output and follow up with refinements
Prompt
Create a reusable modal dialog component that can be triggered by a button click. The modal should have a semi-transparent dark overlay that covers the entire screen, a centered white dialog box with a title, body content area, and a footer with Cancel and Confirm buttons. The modal should close when clicking the overlay, pressing Escape, or clicking Cancel. Add a subtle slide-in animation on open. Make it accessible with proper ARIA attributes (role="dialog", aria-modal="true", aria-labelledby pointing to the title). The Confirm button should be styled as the primary action and the Cancel button as a secondary ghost button. Accept title, children, onConfirm, and onClose as props so it can be reused throughout the app. Related prompts
Was this helpful?
Enjoying this guide?
Get weekly practical guides, plus tool updates and implementation playbooks.