Reference
VisuallyHidden
Words for a screen reader only: Link(…) { Text("Docs") VisuallyHidden("(opens in a new tab)") }.
VisuallyHidden(_ text: String) { … }
Since 6.2.0
text
Read more
about the referenceExample
Row(gap: .md, align: .center) {
Link(to: "/reference") {
Text("Read more")
VisuallyHidden("about the reference")
}
Row {
Text("★★★★☆", aria-hidden: "true")
VisuallyHidden("Rated 4 out of 5")
}
}
A label only a screen reader needs
Stack(gap: .xs) {
VisuallyHidden { Heading("Search results").h3 }
Text("12 pages match.")
}
Props
| Prop | Type | Unset | Meaning |
|---|---|---|---|
text | String (positional) | none | The words a screen reader reads and the page does not show; unset, its block |
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-visually-hidden, stable across releases, so a stylesheet may target it.