Skip to main content

Module search_field

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§

FilterCount
How many rows a filtered view shows out of how many it has.
Filtered
Content with a filter: a SearchField::filter in a band above the content, narrowing the first Filterable inside it. Ctrl+F (⌘F) focuses the field. A navigation shell’s filter slot is the same field wired with sync_filter.
SearchField
A search-styled input: magnifier + editable text + count slot + clear.

Traits§

Filterable
A view a SearchField can narrow: a list, a table, a grid of cards.

Functions§

apply_filter
Narrow the first Filterable in widget’s subtree to query, and return its count.
sync_filter
Carry field’s edits to the Filterable in content: call after routing each event. The field shows the count the view reports, and its “Search everywhere” escalation narrows to the view’s scope.