To create a fully-functional lightbox in Webflow with dynamic content from a CMS collection, follow these structured steps using Webflow's native lightbox and CMS features.
1. Create a CMS Collection for Your Images
- Go to CMS and Create a New Collection, such as “Gallery” or “Portfolio.”
- Include at least one Image field (e.g., "Main Image") and optionally Name, Description, or Category fields.
- Add a few sample entries with uploaded images.
2. Add a Collection List to the Page
- Navigate to your desired page (e.g., Gallery Page).
- Drag a Collection List from the Add panel into your layout.
- Bind the collection list to the CMS collection you created (e.g., "Gallery").
3. Insert Lightbox Links Inside the Collection List
- Inside the Collection List, drag a Lightbox element.
- Set the Lightbox Link image source to Get Image from Gallery Collection > "Main Image" (or your chosen image field).
- This turns each CMS image into its own Lightbox item.
4. Group Lightbox Items Dynamically
- In the Lightbox settings, under Group, use a static name (e.g., “GalleryGroup”) to ensure all CMS-generated items open within a single lightbox gallery.
- This is essential for proper navigation between items when opened.
5. Optional: Add Captions or Descriptions
- If your CMS includes text fields like “Title” or “Caption,” you can display them with the lightbox:
- Add a Text Block beneath or over the image in the collection item.
- Lightboxes don’t support dynamic captions natively in Webflow, but you can display captions outside the lightbox or explore custom code solutions.
6. Style the Lightbox Items
- Style the image size, borders, hover effects, etc., directly in the Collection List Item.
- Be mindful of layout (grid or flex) for responsiveness.
7. Test Functionality
- Preview the project.
- Click any image—ensure it launches in a lightbox and allows navigation between other items in the same group.
Summary
To build a CMS-powered lightbox in Webflow: set up a CMS Collection with images, bind a Collection List to it, use a Lightbox element inside the list, link the image dynamically, and assign a static Group name to connect all items. This setup allows users to view and navigate CMS images inside a fully-functional lightbox.