Reference

Carousel

Slide track with named controls and dots; optional autoplay.

Carousel(label: String, autoplay: Bool, interval: Number) { … }

Since 6.2.0

label

autoplay

interval

Example

wf

Carousel(label: "Featured work", autoplay: true, interval: 6000) { Carousel.Slide { Image(src: "/og.png", alt: "The sharing card") } Carousel.Slide { Image(src: "/og.png", alt: "The sharing card, its title in close-up") { style { object-fit: cover; object-position: 15% 50%; aspect-ratio: 1200 / 630 } } } Carousel.Slide { Center { style { aspect-ratio: 1200 / 630; background: $color-surface } Image(src: "/icon-512.png", alt: "The app icon", width: 160, height: 160) } } }

Slides of words, moved by hand

wf

Carousel(label: "What readers say") { Carousel.Slide { Blockquote("It built the first time.") } Carousel.Slide { Blockquote("The errors tell you what to do.") } }

Props

Props of Carousel
PropTypeUnsetMeaning

label:

String

carousel

The region's accessible name

autoplay:

Bool

false

Advance by itself every interval:, with a pause button; it waits while hovered, focused or in a hidden tab, and never runs under reduced motion; .autoplay, or a value that reads state. Written as a flag, .autoplay, or autoplay: true.

interval:

Number

5000

Milliseconds between slides while it plays, 1 to 2147483647; under 1, 5000

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.

.autoplay

Events

Every element also takes the props, the events and the attribute families listed on every element.

Slots

children

Parts

The parts of Carousel are written under its name, inside it. Each is described here, with what it takes.

One slide of a carousel.

Carousel.Slide { … }

Renders with the class wf-carousel, stable across releases, so a stylesheet may target it.