Modals & Dialogs

Medium

Overlay dialogs with backdrop blur, smooth animations, and keyboard accessibility

Updated about 2 months ago
Tested & Responsive

Live Demo

Basic Modal

Simple modal dialog with backdrop blur and smooth animations

Medium
Preview:
Desktop view

Resize to see how the component adapts to different screen sizes

📖 Basic Modal Overview

This modal component provides a clean, accessible dialog overlay with backdrop blur, smooth animations, and comprehensive keyboard navigation. Perfect for confirmations, forms, and displaying additional content without leaving the current page.

Complexity: Medium

🎯 Key Features

  • Backdrop Blur - Semi-transparent overlay with visual separation
  • Keyboard Accessible - Escape key closes modal, proper focus management
  • Click Outside - Close modal by clicking backdrop area
  • Body Scroll Lock - Prevents background scrolling when modal is open
  • Focus Management - Automatically focuses first interactive element
  • Smooth Animations - Consistent transitions for opening and closing

💡 Best Practices

  • • Use for confirmations, forms, or detailed content views
  • • Always provide clear close actions (X button, Cancel, etc.)
  • • Keep modal content focused and concise
  • • Include proper ARIA labels for accessibility
  • • Test keyboard navigation and screen reader compatibility

Installation & Usage

1

Copy the ERB template

Copy the ERB code from the template tab above and paste it into your Rails view file.

2

Add the Stimulus controller

Create the Stimulus controller file in your JavaScript controllers directory.