Search — Results
Anatomy
blocks::search::results renders the query, count and native linked rows. Each row has one human identity, a quiet kind, optional reference and useful description. Exact duplicate descriptions are omitted; the caller should supply distinct snippets. Native links preserve Tab, Enter, open-in-new-tab and browser history.
use maud_ui::blocks::search::results::{self, Item, Props};
let results = results::render(Props {
query: "Leila".into(),
items: vec![Item { title: "Leila Morgan".into(), kind: "Guest".into(),
description: Some("leila.morgan@example.com".into()),
href: "/guests/G-204".into(), ..Default::default() }],
..Default::default()
});
total: None means the supplied list is complete. Supply the authoritative total for a page of results; a separate showing-count then appears. Loading, empty, error and disabled states use blocks::state::State. An empty Ready list keeps the query and offers clear_action, if supplied. Do not offer “create the first record” for an unsuccessful search; use First record only for a genuinely empty collection.
Search execution, debouncing, query preservation, filtering and authorization stay with the application. The block contains no synthetic combobox/listbox keyboard model.
maud_ui::blocks::search::results
Props
Generated from public Rust fields. Defaults are evaluated from the implementation.
| Prop | Type | Default | Description |
|---|---|---|---|
id | String | "search-results" | No description |
query | String | "" | No description |
items | Vec<Item> | [] | No description |
total | Option<usize> | None | Authoritative total when results are paginated. None means the supplied list is complete. |
clear_action | Option<Link> | None | No description |
state | State | Ready | No description |
heading | Heading | H2 | No description |
Examples
light · fictional example
2 results for “Leila”
dark · fictional example
2 results for “Leila”
Loading, empty, error and disabled
Each example uses the block’s state prop. Empty and error are separate outcomes.
loading
empty
error
disabled
0 results for “Leila”
No matching records. Try another name or reference.
Accessibility
Supply meaningful labels, choose heading levels for the surrounding page, and preserve native link and form behavior. Keyboard focus follows document order. Motion honors reduced-motion preferences.