Ship-It Designv0.0.20

GitHub

Lightbox

Fullscreen photo viewer. Built on Dialog (focus trap, portal, Escape closes). Adds keyboard ←/→ between items and a counter overlay.

Default#

Loop#

Set loop to wrap the prev / next buttons and ←/→ keyboard navigation past the boundaries. Pairs with Carousel's loop prop for marketplace photo galleries — ListingDetail forwards a single loop prop to both surfaces.

Props#

Props for Lightbox
PropTypeDefaultDescription
openboolean | undefined
defaultOpenboolean | undefined
onOpenChange((open: boolean) => void) | undefined
items *readonly unknown[]Items to view — usually image URLs but anything renderable is fine.
renderItem *(item: unknown, index: number) => ReactNodeRenderer for the active item.
indexnumber | undefinedCurrent index (controlled).
defaultIndexnumber | undefinedDefault index (uncontrolled).
onIndexChange((index: number) => void) | undefinedFires when the index changes.
loopboolean | undefinedfalseWrap prev / next (buttons and ←/→ keys) past the boundaries. Default `false`. When `true`, "next" on the last item goes to the first and vice versa, and the arrow buttons never disable while there's more than one item.
titleReactNodePhoto viewerAccessible title (visually hidden).

Accessibility#

  • The dialog has role="dialog" and a visually hidden title (override via the title prop).
  • Keyboard: Escape closes; Left / Right move between items; Tab cycles through the focusable controls (prev, next, close).
  • The active photo is the only one rendered in the viewport — there is no reflow when moving between items.

Composition#

Lightbox is the modal shell — pair it with Carousel for a listing detail's photo gallery: thumbnails in Carousel, on-click open Lightbox.