pub struct List<'a, Selection = RowSelection> { /* private fields */ }Expand description
List widget.
Fully compatible with ratatui List. Adds Scroll, selection models, and event-handling.
Implementations§
Source§impl<'a, Selection> List<'a, Selection>
impl<'a, Selection> List<'a, Selection>
Sourcepub fn styles_opt(self, styles: Option<ListStyle>) -> Self
pub fn styles_opt(self, styles: Option<ListStyle>) -> Self
Set all styles.
Sourcepub fn select_style<S: Into<Style>>(self, select_style: S) -> Self
pub fn select_style<S: Into<Style>>(self, select_style: S) -> Self
Select style.
Sourcepub fn focus_style<S: Into<Style>>(self, focus_style: S) -> Self
pub fn focus_style<S: Into<Style>>(self, focus_style: S) -> Self
Focused style.
Sourcepub fn varying_heights(self, varying: bool) -> Self
pub fn varying_heights(self, varying: bool) -> Self
If your list uses varying row-heights for each row calculating the correct offset to show a specific item will fail.
With this flag the row-height for each row is stored as part of the state.
Sourcepub fn direction(self, direction: ListDirection) -> Self
pub fn direction(self, direction: ListDirection) -> Self
Defines the direction how the items are displayed.
With bottom to top, the item at offset is rendered at the bottom of the area and moves up for the next items. Navigation with the arrow keys will also reverse and follows the screen directions.
Sourcepub fn highlight_symbol<L: Into<Line<'a>>>(self, highlight_symbol: L) -> Self
pub fn highlight_symbol<L: Into<Line<'a>>>(self, highlight_symbol: L) -> Self
Set the symbol to be displayed in front of the selected item. By default, there are no highlight symbol.
Sourcepub fn highlight_style<S: Into<Style>>(self, style: S) -> Self
pub fn highlight_style<S: Into<Style>>(self, style: S) -> Self
Separate style for the highlight symbol.
When no set the symbol uses the list-style and the select-style.
Sourcepub fn repeat_highlight_symbol(self, repeat: bool) -> Self
pub fn repeat_highlight_symbol(self, repeat: bool) -> Self
Set whether to repeat the highlight symbol and style over selected multi-line items. This is false by default.
Sourcepub fn highlight_spacing(self, value: HighlightSpacing) -> Self
pub fn highlight_spacing(self, value: HighlightSpacing) -> Self
Set when to show the highlight spacing
The highlight spacing is the spacing that is allocated for the selection symbol (if enabled) and is used to shift the list when an item is selected. This method allows you to configure when this spacing is allocated.
- HighlightSpacing::Always will always allocate the spacing, regardless of whether an item is selected or not. This means that the table will never change size, regardless of if an item is selected or not.
- HighlightSpacing::WhenSelected will only allocate the spacing if an item is selected. This means that the table will shift when an item is selected. This is the default setting for backwards compatibility, but it is recommended to use HighlightSpacing::Always for a better user experience.
- HighlightSpacing::Never will never allocate the spacing, regardless of whether an item is selected or not. This means that the highlight symbol will never be drawn.
Sourcepub fn scroll_padding(self, padding: usize) -> Self
pub fn scroll_padding(self, padding: usize) -> Self
Sets the number of items around the currently selected item that should be kept visible.
Trait Implementations§
Source§impl<'a, Item, Selection> FromIterator<Item> for List<'a, Selection>
impl<'a, Item, Selection> FromIterator<Item> for List<'a, Selection>
Source§fn from_iter<Iter: IntoIterator<Item = Item>>(iter: Iter) -> Self
fn from_iter<Iter: IntoIterator<Item = Item>>(iter: Iter) -> Self
Source§impl<Selection: ListSelection> StatefulWidget for List<'_, Selection>
impl<Selection: ListSelection> StatefulWidget for List<'_, Selection>
Auto Trait Implementations§
impl<'a, Selection> Forget for List<'a, Selection>
impl<'a, Selection> Freeze for List<'a, Selection>where
PhantomData<Selection>: Freeze,
impl<'a, Selection> RefUnwindSafe for List<'a, Selection>where
PhantomData<Selection>: RefUnwindSafe,
impl<'a, Selection> Send for List<'a, Selection>where
PhantomData<Selection>: Send,
impl<'a, Selection> Sync for List<'a, Selection>where
PhantomData<Selection>: Sync,
impl<'a, Selection> Unpin for List<'a, Selection>where
PhantomData<Selection>: Unpin,
impl<'a, Selection> UnsafeUnpin for List<'a, Selection>where
PhantomData<Selection>: UnsafeUnpin,
impl<'a, Selection> UnwindSafe for List<'a, Selection>where
PhantomData<Selection>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more