Module search_field
Expand description
SearchField — the in-content filter: a field with a leading magnifier,
an editable TextInput, a trailing clear button and a reserved slot for
the match count.
It narrows what a view already shows (a sidebar list, a table, a set of
cards); it never searches the app. Searching is the platform’s: Enter, or
the “Search everywhere” action shown when nothing matches, hands the same
query to the platform search (SearchRequest), and an app’s search
launcher is search_button, not a field.
Bind a field to a list through the Filterable capability: the list
narrows to the query and reports how many rows remain, which the field
shows as “3 of 120”. Filtered places a field above any content and
wires both, with Ctrl+F focusing the field; a navigation shell’s filter
slot uses sync_filter the same way.
Composes the toolkit’s own TextInput so caret, selection, IME, and
CRDT binding are shared.
Structs§
- Filter
Count - How many rows a filtered view shows out of how many it has.
- Filtered
- Content with a filter: a
SearchField::filterin a band above the content, narrowing the firstFilterableinside it. Ctrl+F (⌘F) focuses the field. A navigation shell’s filter slot is the same field wired withsync_filter. - Search
Field - A search-styled input: magnifier + editable text + count slot + clear.
Traits§
- Filterable
- A view a
SearchFieldcan narrow: a list, a table, a grid of cards.
Functions§
- apply_
filter - Narrow the first
Filterableinwidget’s subtree toquery, and return its count. - sync_
filter - Carry
field’s edits to theFilterableincontent: call after routing each event. The field shows the count the view reports, and its “Search everywhere” escalation narrows to the view’s scope.