Reference
InputGroup
An input drawn as one box with what goes beside it: an icon, InputGroup.Addon("https://"), a button, or InputGroup.Clear, which empties the input and gives it the focus back.
InputGroup { … }
Since 6.2.0
No props to try.
Searching for “” on https://acme.example.com
Example
state search = ""
state domain = "acme"
Stack(gap: .md) {
InputGroup {
Icon("search")
Input(bind: search, placeholder: "Search the docs", aria-label: "Search the docs")
InputGroup.Clear
}
InputGroup {
InputGroup.Addon("https://")
Input(bind: domain, aria-label: "Subdomain")
InputGroup.Addon(".example.com")
}
Text("Searching for “{search}” on https://{domain}.example.com").muted
}
Props
This element takes no props of its own.
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
Parts
The parts of InputGroup are written under its name, inside it. Each is described here, with what it takes.
InputGroup.Addon
Text beside the input: https://, .com, kg.
InputGroup.Addon(_ text: String) { … }
| Prop | Type | Unset | Meaning |
|---|---|---|---|
text | String (positional) | — | The words drawn beside the input, inside the group's box: |
InputGroup.Clear
A button that empties the input and puts the focus back in it; hidden while it is empty.
InputGroup.Clear
Renders with the class wf-input-group, 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.