Fusuma

Components / Composite

search_bar

A search field in a pill with the icon before it (usually Icon::Search) and on_submit for Enter.

Try it

This is the Bars page of the gallery, running in your browser: search_bar is on it, and it is the real widget. Press Run, then use it.

Live: Bars, where search_bar is usedOpen full size

Also on this pagetop_bartoolbaricon_badgefabmarksnavigation_bartoggle_groupchip_groupbutton_groupavatar_group

A search field in a pill with the icon before it (usually Icon::Search) and on_submit for Enter.

The app keeps the text: on_input is sent with the whole new text on every edit, on_submit on Enter.

Signature

pub fn search_bar<'a, M: Clone + 'a>( icon: Icon, value: &'a str, on_input: fn(&str) -> M, on_submit: M, ) -> impl View<M> + 'a

Example

use fusuma::{Icon, search_bar};
let query = "jazz";
let view = search_bar(Icon::Search, query, |_| 0, 1);
let built = fusuma::doc::built::<i32, _>(&view);
assert!(built.nodes() >= 2);

All components · Source