Skip to main content

Module list_item

Module list_item 

Source
Expand description

List Item Module - Composable list items

This module provides a flexible list item system with composable content:

  • ListItem - The main container widget
  • ListItemContent - Trait for custom content types
  • LabelContent - Simple text with optional icon
  • PropertyContent - Key-value pair display
  • ButtonContent - Clickable button content

§Usage

use egui::Color32;
use egui_charts::icons::icons;
use egui_charts::ui_kit::list_item::{ButtonContent, LabelContent, ListItem, PropertyContent};

// Simple label
let response = ListItem::new()
    .selected(is_selected)
    .show(ui, LabelContent::new("My Item"));

// Label with icon
let response = ListItem::new()
    .show(ui, LabelContent::new("Settings").with_icon(&icons::SETTINGS));

// Key-value property
let response = ListItem::new()
    .show(ui, PropertyContent::new("Price", "$1,234.56")
        .value_color(Color32::GREEN));

// Action button
if ListItem::new()
    .show(ui, ButtonContent::new(&icons::PLUS, "Add Item").primary())
    .clicked()
{
    // add the item
}

Structs§

ButtonContent
Clickable button content for list items
ContentContext
Context provided to ListItemContent implementations when rendering
LabelContent
Simple text content with optional icon
ListItem
Reference to ListItem configuration (forward declaration)
ListVisuals
Visual state information for list items with color computation methods
PropertyContent
Key-value pair content for displaying properties

Enums§

ButtonStyle
Button style variants

Traits§

ListItemContent
Trait for types that can be rendered as list item content

Functions§

simple_list
Create a simple list of items