pub fn token_field<'a, Message: Clone + 'a>(
placeholder: &str,
value: &str,
tokens: Vec<Element<'a, Message>>,
on_input: impl Fn(String) -> Message + 'a,
on_submit: Option<Message>,
id: Option<Id>,
scale: FontScale,
) -> Container<'a, Message>Expand description
A search_field holding finished tokens ahead of the text — Files’
ext:rs and modified:<7d chips, each a super::removable_chip.
The tokens sit inside the field, between the magnifier and the
cursor, because they are part of what was typed: a row of chips off
to one side would read as a second control with a meaning of its own.
The caller decides which text became a token and what removing one
does; this only draws them. With no tokens it is exactly
search_field, which is built on it so the two cannot drift apart.
The placeholder is dropped once a token is in: “Search crates” after
ext:rs would read as though the token were not part of the search.