pub struct List<'a> { /* private fields */ }Expand description
A widget to display a list of items.
Implementations§
Source§impl<'a> List<'a>
impl<'a> List<'a>
Sourcepub fn new(items: impl IntoIterator<Item = impl Into<ListItem<'a>>>) -> Self
pub fn new(items: impl IntoIterator<Item = impl Into<ListItem<'a>>>) -> Self
Create a new list from the given items.
Sourcepub fn data_hash(self, hash: u64) -> Self
pub fn data_hash(self, hash: u64) -> Self
Set an explicit data hash to enable caching of filtered indices.
This is highly recommended for large lists. When provided, the list widget
will cache the result of filtering in the ListState, skipping expensive
O(N) string processing on frames where the hash and filter query have not changed.
Sourcepub fn highlight_style(self, style: Style) -> Self
pub fn highlight_style(self, style: Style) -> Self
Set the style applied to the selected item.
Sourcepub fn hover_style(self, style: Style) -> Self
pub fn hover_style(self, style: Style) -> Self
Set the style applied to the hovered item (mouse move).
Sourcepub fn highlight_symbol(self, symbol: &'a str) -> Self
pub fn highlight_symbol(self, symbol: &'a str) -> Self
Set a symbol displayed before the selected item.
Sourcepub fn hit_id(self, id: HitId) -> Self
pub fn hit_id(self, id: HitId) -> Self
Set a hit ID for mouse interaction.
When set, each list item will register a hit region with the frame’s hit grid (if enabled). The hit data will be the item’s index, allowing click handlers to determine which item was clicked.
Sourcepub fn handle_key(&self, state: &mut ListState, key: &KeyEvent) -> bool
pub fn handle_key(&self, state: &mut ListState, key: &KeyEvent) -> bool
Handle keyboard navigation and incremental filtering for this list.
Supported keys:
- Navigation:
Up/Down,k/j(vi-style, always navigate — never appended to the filter query) - Incremental filter input: printable chars (except
j/k) - Filter editing:
Backspace,Escape - Multi-select toggle (when enabled):
Space