Module modalkit_ratatui::list
source · Expand description
§List
§Overview
This renders a list of items that can be navigated using the Editable trait.
§Example
use modalkit::{
actions::{Editable, EditAction, EditorActions},
editing::application::EmptyInfo,
editing::context::EditContext,
editing::store::Store,
prelude::*,
};
use modalkit_ratatui::list::ListState;
let mut store = Store::default();
let ctx = EditContext::default();
// Create new list state.
let items = vec!["Alice".into(), "Bob".into(), "Eve".into()];
let mut list = ListState::<String, EmptyInfo>::new("People".into(), items);
// Jump to end of the list.
let op = EditAction::Motion;
let mv = MoveType::BufferPos(MovePosition::End);
let _ = list.edit(&op, &mv.into(), &ctx, &mut store).unwrap();
Structs§
- Widget for rendering a list of text items.
- A position within a list.
- Persistent state for List.
Traits§
- Trait for items kept in a ListState.