A wider screen, please

This page features interactive demos and side-by-side code samples that need at least 340 pixels of horizontal space. Please widen your browser window, or rotate your device, to continue.

Morpheus v0.1.0
v0.1.0

Lightbox#

Component <neo-lightbox> is an overlay that expands arbitrary content from one or more triggers. Mark each opener with [data-neo-lightbox-trigger] and the body with [data-neo-lightbox-content]; the host owns the open / close animation, focus, the backdrop, and Esc dismissal. By default it rides the top layer to cover the viewport; contained confines the overlay to the host's own box.

Deactivate Rename Duplicate
Delete
New state Toggle autoplay
HTML CSS

The selected state's markup and its scoped CSS. The CSS is wrapped in <style>@scope { ... }</style> and applies to the preview only. Edits change the preview above, applied live while Sync is on, or when you click Patch or Replace. Patch morphs the preview; Replace swaps it outright.

Replace Patch

Signals

Datastar signals declared in the selected state's markup. Change a value to drive the preview, applied live while Sync is on, or when you click Patch.

Patch

Reference#

Attributes #

NameTypeDefaultDescription
openboolean reflected observedfalseOpen state.
containedboolean observedfalseWhere the overlay renders. Default promotes it to the top layer covering the viewport; contained confines it to the host's own box, which becomes the positioned containing block.
hoverbooleanfalseOpen on trigger hover (mouse only). Click still opens, instantly, for touch and keyboard.
hover-open-delayinteger (ms)100Delay before a hover opens the overlay.
hover-close-delayinteger (ms)200Delay before a hover closes it after the pointer leaves both trigger and surface.
dismissibleboolean observedtrueSet false to disable backdrop-press and Esc dismissal.
transition"zoom" | "fade" | "none""zoom"Entry / exit style. zoom morphs the surface from the opening trigger's position and size (a FLIP) and back into it on close; fade is a centered scale + opacity; none is instant. The backdrop fades in every mode. Honors reduced motion. Read when the overlay opens, so a change while it is open applies on the next open.

Slots #

NameDescription
[data-neo-lightbox-trigger]Opens the overlay. Repeat on any number of children; all open the same surface.
[data-neo-lightbox-content]Arbitrary HTML projected into the overlay surface.
[data-neo-lightbox-close]Any descendant of the content; clicking it dismisses the overlay.
[data-neo-lightbox-title]Names the dialog; the surface's aria-labelledby points at it.

Events #

NameDetailBubblesDescription
neo-lightbox-open{ trigger }yesFires when the overlay opens. trigger is the activating element.
neo-lightbox-closenoneyesFires when the overlay closes.

Parts #

NameDescription
::part(backdrop)The dimmed layer behind the surface.
::part(surface)The centered dialog panel.

CSS variables #

NameDefaultDescription
--neo-lightbox-overlay-bgrgba(0, 0, 0, 0.72)Backdrop color.
--neo-lightbox-overlay-blur0pxBackdrop blur radius.
--neo-lightbox-surface-bgtransparentSurface background.
--neo-lightbox-color--page-fgSurface text color.
--neo-lightbox-radius0Surface corner radius.
--neo-lightbox-surface-padding0Surface padding.
--neo-lightbox-shadownoneSurface shadow.
--neo-lightbox-max-width90vwSurface width cap.
--neo-lightbox-max-height90vhSurface height cap.
--neo-lightbox-screen-offset1remGap kept around the overlay.
--neo-lightbox-enter-duration200msOpen / close animation duration.
--neo-lightbox-enter-scale0.94Start scale for the fade transition.
--neo-lightbox-z-index50Overlay stacking when contained.

Examples#

Image#

A thumbnail opens its full-size image on the top layer over a dimmed backdrop. By default the image zooms out of the thumbnail and shrinks back into it on close (the transition="zoom" FLIP). Press the backdrop, the close button, or Esc to dismiss.

The Cheshire cat

Arbitrary content#

The content slot takes any HTML, not just images. This one is a panel with a heading, a description list, and its own close button. A [data-neo-lightbox-title] gives the dialog its accessible name.

Keyboard shortcuts

Scoped to a container#

contained confines the overlay to the host's box instead of the viewport, so the panel covers just this card. The host becomes the positioned containing block.

Morpheus Release Notes

Released June 2026.

View release notes

Release notes

  • New <neo-lightbox> overlay component.
  • Carousel deep-linking from gallery thumbnails.
  • Reduced-motion and forced-colors passes across the kit.

Hover to open#

With hover the overlay opens on pointer enter and closes after the pointer leaves both trigger and surface. Click still opens it, instantly, for touch and keyboard. Hover the button to see it.

Hover to preview
A glass jar

Examples: Datastar#

Every thumbnail opens the same overlay, which holds a <neo-carousel> of the full images. A $gallery_active signal tracks the last thumbnail clicked: each trigger sets it (data-on:click), and the carousel binds to it (data-attr:value) and writes back on navigation, so the photo you click opens first and the signal stays in sync as you swipe.

Settings

Theme

Default Sunshine Ocean Matrix Rose

Accessibility

Playgrounds

Server Simulator