Reference
Lightbox
Every picture in its block opens, on a press or Enter, full screen: the arrow keys and a swipe go between them, a double press or + zooms, Escape closes and the focus goes back. A picture's data-full: is the file it opens, else its largest size.
Lightbox(label: String, previous: String, next: String, …) { … }
Since 6.2.0
label
previous
next
close
zoom
of



Example
Lightbox(label: "Launch week", previous: "Previous photo", next: "Next photo", close: "Close", zoom: "Zoom", of: "of") {
Gallery(columns: 3, ratio: 4 / 3) {
Image(src: "/og.png", alt: "The launch card, as it was shared")
Image(src: "/icon-512.png", alt: "The app icon on a white tile")
Image(src: "/og.png", alt: "The launch card, cropped to its title") {
style { object-position: 20% 50% }
}
}
}
A larger picture for the full-screen view
Lightbox(label: "Screenshots") {
Image(src: "/icon-512.png", alt: "The app icon", data-full: "/og.png")
}
Pictures in a row of their own
Lightbox(label: "Brand assets") {
Row(gap: .md) {
Image(src: "/icon-512.png", alt: "The icon", width: 120, height: 120)
Image(src: "/og.png", alt: "The sharing card", width: 228, height: 120)
}
}
Props
| Prop | Type | Unset | Meaning |
|---|---|---|---|
label: | String |
| What the pictures are: the accessible name of the full-screen dialog they open in |
previous: | String |
| The previous button's accessible name, in your words |
next: | String |
| The next button's accessible name, in your words |
close: | String |
| The close button's accessible name, in your words |
zoom: | String |
| The zoom button's accessible name, in your words |
of: | String |
| The word between the two numbers of the counter, |
Attribute families: global, aria, data. Plus the 22 universal props every element takes: animate:, exit:, speed:, duration:, delay:, easing:, stagger:, on:, count:, shared:, class:, ref:, drag:, dragGroup:, dropValue:, dropAxis:, dropInside:, roving:, trapFocus:, mount:, update:, cleanup:.
Flags and cases
A flag is written after the parentheses with a dot: a Bool prop, or a case of one of the element's enum props. A case the enum lacks is an error with a hint.
No flags of its own.
Events
Every element also takes the props, the events and the attribute families listed on every element.
Slots
children
Renders with the class wf-lightbox, stable across releases, so a stylesheet may target it.