Reference
TransferList
Two lists side by side — what can be chosen and what is — with buttons that move the selected across, or all of them; bind: holds the keys of the chosen.
TransferList(bind: State, options: [Item], text: (Item) -> String, …)
Since 6.2.0
label
from
Reviewers: ada
Example
state picked: [String] = ["ada"]
TransferList(bind: picked, options: [
{ id: "ada", name: "Ada Lovelace" },
{ id: "grace", name: "Grace Hopper" },
{ id: "alan", name: "Alan Turing" },
{ id: "katherine", name: "Katherine Johnson" },
], text: p => p.name, key: p => p.id, label: "Reviewers", from: "Everyone")
Text("Reviewers: {picked.join(", ")}").muted
Props
| Prop | Type | Unset | Meaning |
|---|---|---|---|
bind: | State (required) | — | A list state holding the keys of the chosen options, kept in the order of |
options: | [Item] (required) | — | Everything that can be chosen, in the order both lists show it |
text: | (Item) -> String | the option itself, as text | What an option says: |
key: | (Item) -> String or (Item) -> Number | the option itself | What identifies an option, and what |
label: | String (required) | — | What is being chosen: the name of the whole control |
from: | String |
| The heading over the list of what is not chosen |
to: | String |
| The heading over the list of what is chosen |
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-transfer-list, stable across releases, so a stylesheet may target it.