DEV Community

Cover image for NanoBox: Accessible Lightbox Popup for Any Content
jQueryScript
jQueryScript

Posted on

NanoBox: Accessible Lightbox Popup for Any Content

NanoBox: a zero-dependency JavaScript lightbox that handles images, YouTube/Vimeo videos, iframes, and inline HTML. All from a single data-nanobox attribute.

Key highlights:

  • Auto-detects content type from the URL — no manual config
  • ~8 KB JS + ~4.5 KB CSS, zero external dependencies
  • Full accessibility: role="dialog", focus trap, ESC to close
  • CSS custom properties for theming
  • NanoBox.create() for multiple independent instances on one page
  • SPA-safe with a destroy() method for clean route teardown

Worth a look if you need a lightweight, accessible lightbox that covers multiple content types.

👉 Blog Post

👉 GitHub Repo

👉 Live Demo

Top comments (0)