Reference

Gallery

Pictures in a grid of columns: (unset, as many as fit), each cropped to one shape — ratio:, unset square. In a Lightbox, each opens full screen.

Gallery(columns: Number, ratio: Number) { … }

Since 6.2.0

ratio

Example

wf

Gallery(columns: { base: 2, md: 4 }, ratio: 1) { Image(src: "/og.png", alt: "The sharing card") Image(src: "/icon-512.png", alt: "The app icon") Image(src: "/og.png", alt: "The sharing card, its left edge") { style { object-position: 0% 50% } } Image(src: "/og.png", alt: "The sharing card, its right edge") { style { object-position: 100% 50% } } }

Wide tiles, as many as fit

wf

Gallery(ratio: 16 / 9) { Image(src: "/og.png", alt: "The sharing card") Image(src: "/og.png", alt: "The sharing card again") }

Each opens full screen inside a Lightbox

wf

Lightbox(label: "Photos") { Gallery(columns: 2, ratio: 4 / 3) { Image(src: "/og.png", alt: "The sharing card") Image(src: "/icon-512.png", alt: "The app icon") } }

Props

Props of Gallery
PropTypeUnsetMeaning

columns:

Number

as many as fit

How many pictures across, or one per breakpoint ({ base: 2, md: 4 }); unset, as many columns at least 10rem wide as fit

ratio:

Number

1 (square)

Each picture's shape, width over height (4 / 3, 16 / 9); each is cropped to it (object-fit: cover)

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-gallery, stable across releases, so a stylesheet may target it.