Expand description
List component with filtering, pagination, contextual help, and customizable rendering.
This module exposes a generic Model<I: Item> plus supporting traits and submodules:
Item: Implement for your item type; must beDisplay + Cloneand return afilter_value()ItemDelegate: Controls itemrender,height,spacing, andupdate- Submodules:
defaultitem,keys, andstyle
§Architecture Overview
This list component uses several key architectural patterns for smooth interaction:
§🎯 Core Design Principles
- Viewport-Based Scrolling: Maintains smooth, context-preserving navigation
- Index Consistency: Uses original item indices for cursor tracking across all states
- Real-Time Filtering: Integrates textinput component for responsive filter interaction
- State-Driven UI: Clear separation between filtering, navigation, and display states
§🏗️ Key Components
- Viewport Management:
viewport_startfield tracks visible window position - Index Strategy: Delegates receive original indices for consistent highlighting
- Filter Integration: Direct textinput forwarding preserves all input features
- State Coordination: Filtering states control UI behavior and key handling
§📋 Implementation Strategy
- Viewport Scrolling: Only adjusts view when cursor moves outside visible bounds
- Index Semantics: Render delegates use original positions for cursor comparison
- Filter States:
Filteringduring typing,FilterAppliedafter acceptance - Event Handling: KeyMsg forwarding maintains textinput component consistency
§Filtering States
The list supports fuzzy filtering with three states:
Unfiltered: No filter activeFiltering: User is typing a filter; input is shown in the headerFilterApplied: Filter accepted; only matching items are displayed
When filtering is active, fuzzy match indices are stored per item and delegates can use
them to apply character-level highlighting (see defaultitem).
§Help Integration
The list implements help::KeyMap, so you can embed help::Model and get contextual
help automatically based on the current filtering state.
Re-exports§
pub use keys::ListKeyMap;pub use style::ListStyles;pub use defaultitem::DefaultDelegate;pub use defaultitem::DefaultItem;pub use defaultitem::DefaultItemStyles;
Modules§
- defaultitem
- Default item implementation and delegate for basic list functionality.
- keys
- Key bindings and keyboard input handling for list navigation.
- style
- Visual styling and theming for list components.
Structs§
- Filter
State Info - Core traits and types for list functionality.
- Model
- The main list component model.
Enums§
- Filter
State - Core traits and types for list functionality.
Traits§
- Item
- Core traits and types for list functionality.
- Item
Delegate - Core traits and types for list functionality.