Reference
ConsentSettings
A button that asks the reader again — a footer's "Cookie settings": it forgets their answer and shows the ConsentBanner. A script already loaded stays until the page is loaded again.
ConsentSettings(_ label: String)
Before 5.0
No preview for this one: the example below shows how it is written.
Example
Row(gap: .md, align: .center) {
Text("© 2026 Ledger").muted.sm
Link("Privacy", to: "/learn")
ConsentSettings("Cookie settings")
}
ConsentBanner("We would like to count visits.", accept: "Allow", decline: "No thanks")
Related:
ConsentBannerProps
| Prop | Type | Unset | Meaning |
|---|---|---|---|
label | String (positional) | Cookie settings | The button's words; pressing it forgets the reader's answer and shows the page's |
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
It takes no slots.
Renders with the class wf-consent-settings, stable across releases, so a stylesheet may target it.
Codes this can raise
These controls list the props' cases; the example below shows them written.