Reference

Sheet

A modal <dialog> that comes in from an edge: the bottom (a phone's filters, a share list) or the start or end of the line. Dragged by its handle or heading toward its edge it closes; a bottom sheet with snap: points settles at the nearest.

Sheet(visible: State, title: String, closable: Bool, …) { … }

Since 6.2.0

title

side

bottom

start

end

dismiss

any

escape

none

Filters

Sorted by new

Example

wf

state filters = false state sort = "new" state inStock = true Button("Filters") { on click { filters = true } } Sheet(visible: filters, title: "Filters", snap: [0.5, 1]).closable { Radio(bind: sort, value: "new", label: "Newest first") Radio(bind: sort, value: "price", label: "Lowest price") Switch(bind: inStock, label: "In stock only") Sheet.Footer { Button("Show results").primary.full { on click { filters = false } } } } Text("Sorted by {sort}").muted

From the end of the page

wf

state details = false Button("Details") { on click { details = true } } Sheet(visible: details, side: .end, title: "Deploy #418").closable { Text("Opened 3 days ago by Ada") }

From the start, named by a label

wf

state nav = false Button("Menu") { on click { nav = true } } Sheet(visible: nav, side: .start, label: "Navigation") { Link("Learn", to: "/learn") Link("Reference", to: "/reference") }

Props

Props of Sheet
PropTypeUnsetMeaning

visible:

State

none: it never opens

Whether it is open: a Bool state, written back false when Escape, a press on the backdrop or its close button shuts it; a condition opens it but is not written

title:

String

none

The heading at the top, and the accessible name; a value that reads state follows it; a Sheet.Title block draws the heading instead

closable:

Bool

false

A close button (×) in the heading row, which closes it as Escape does; with no title: the row holds the button alone. Written as a flag, .closable, or closable: true.

side:

one of its cases

bottom

The edge it slides in from, and is dragged back toward to close. Written as a flag, .bottom, or by name, side: .bottom.

  • .bottom (the default): From the bottom of the window, with a drag handle
  • .start: From where a line starts: the left, the right in a right-to-left page
  • .end: From where a line ends: the right, the left in a right-to-left page

snap:

[Number]

none: as tall as its content, up to 90% of the window

A bottom sheet's heights, as fractions of the window's ([0.5, 1]): it opens at the first written, a drag settles at the nearest; values outside 0–1 are dropped

label:

String

none

Its accessible name when it has no title:; ignored when it has one

dismiss:

one of its cases

any

What closes it besides the page's own button and visible:. Written as a flag, .any, or by name, dismiss: .any.

  • .any (the default): Escape, or a press outside it
  • .escape: Escape only: a press outside is the page's
  • .none: Neither, and its handle does not drag it shut: only the page's own button closes it, for what must be answered

initialFocus:

Element

none

What takes the focus when it opens, by its ref:; unset, what says autofocus, else its first control; when it closes the focus goes back where it was

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.

.closable

.bottom

.start

.end

.any

.escape

.none

Events

Events of Sheet
EventSendsMeaning
on close—

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

Slots

children

Parts

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

Sheet.Title

What the sheet's heading draws, in place of its title:'s words, which stay its name.

Sheet.Title { … }

The sheet's action row, kept in view below what scrolls.

Sheet.Footer { … }

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