Components Image Lightbox Image Lightbox Component

Image Lightbox Component

A simple, responsive, glassmorphism-styled image lightbox component with ocean/blue tones for social media, supporting dark mode.

Preview

HTML Code

<div class="flex items-center justify-center min-h-screen bg-gradient-to-br from-blue-100 via-blue-200 to-blue-300 dark:from-gray-900 dark:via-gray-800 dark:to-gray-700 p-4 font-sans">

  <!-- Lightbox Container (visible only when 'open', hidden by default using styling concepts, not direct JS) -->
  <!-- In a real scenario, this would be toggled by JS. For pure HTML/CSS, it's assumed to be 'open' for demonstration. -->
  <!-- To simulate true hidden/shown: display: none initially, display: flex on active class. -->
  <div class="fixed inset-0 z-50 flex items-center justify-center bg-blue-900 bg-opacity-30 dark:bg-black dark:bg-opacity-70 backdrop-blur-sm">
    
    <div class="relative w-full max-w-3xl mx-auto p-4 bg-white bg-opacity-20 dark:bg-gray-800 dark:bg-opacity-30 rounded-2xl shadow-xl border border-blue-500 border-opacity-30 dark:border-gray-600 dark:border-opacity-30 backdrop-filter backdrop-blur-lg">
      
      <!-- Close Button -->
      <button class="absolute top-3 right-3 text-white hover:text-blue-200 dark:text-gray-300 dark:hover:text-gray-100 text-3xl font-bold transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 rounded-full w-10 h-10 flex items-center justify-center">
        &times;
      </button>

      <!-- Lightbox Content -->
      <div class="flex flex-col md:flex-row gap-4 items-center">
        
        <!-- Image Area -->
        <div class="w-full md:w-3/5 rounded-lg overflow-hidden border border-blue-400 dark:border-gray-500 shadow-md">
          <img src="https://picsum.photos/800/600?random=1" alt="Full size image" class="w-full h-auto object-cover">
        </div>

        <!-- Details Area -->
        <div class="w-full md:w-2/5 text-white dark:text-gray-200 p-2 md:p-0">
          <h3 class="text-2xl font-semibold mb-2 text-white dark:text-white">Ocean Sunset</h3>
          <p class="text-sm mb-4 text-blue-100 dark:text-gray-300">A breathtaking view of the sunset over the serene ocean. Captured during my recent trip, truly mesmerizing.</p>

          <!-- User Info -->
          <div class="flex items-center mb-4">
            <img src="https://randomuser.me/api/portraits/women/44.jpg" alt="User Avatar" class="w-10 h-10 rounded-full mr-3 border-2 border-blue-300 dark:border-gray-400">
            <div>
              <p class="font-medium text-blue-50 dark:text-gray-100">Jane Doe</p>
              <p class="text-xs text-blue-100 dark:text-gray-300">@janedoe | 2 hours ago</p>
            </div>
          </div>

          <!-- Action Buttons -->
          <div class="flex gap-3 mt-4">
            <button class="flex-1 py-2 px-4 bg-blue-600 bg-opacity-70 dark:bg-blue-700 dark:bg-opacity-60 text-white rounded-lg hover:bg-blue-700 hover:bg-opacity-80 dark:hover:bg-blue-800 dark:hover:bg-opacity-70 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-70">
              <span class="mr-2 text-lg">&hearts;</span> Like
            </button>
            <button class="flex-1 py-2 px-4 bg-blue-600 bg-opacity-70 dark:bg-blue-700 dark:bg-opacity-60 text-white rounded-lg hover:bg-blue-700 hover:bg-opacity-80 dark:hover:bg-blue-800 dark:hover:bg-opacity-70 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-70">
              <span class="mr-2 text-lg">&#x1F4AD;</span> Comment
            </button>
          </div>
        </div>
      </div>
    </div>

  </div>
</div>

Related Components

Glassmorphism Lightbox with Sepia Tones for Real Estate

A responsive image lightbox component with a glassmorphism design, featuring frosted glass-like translucent elements and sepia/brown color tones, suitable for real estate property image galleries. Includes dark mode support.

Open

Image Lightbox Component

A responsive Image Lightbox component designed in Material Design style, featuring a triadic color scheme and support for dark mode. It's suitable for portfolio showcasing work or products.

Open

Image Lightbox Component

Image Lightbox Component with Retro/Vintage design, Analogous color scheme, Simple complexity, for Business/Corporate purpose. Responsive with dark theme support. HTML only with Tailwind CSS.

Open