]> git.proxmox.com Git - ui/proxmox-yew-widget-toolkit.git/commitdiff
docs: improve list tile example
authorDietmar Maurer <dietmar@proxmox.com>
Sat, 30 Nov 2024 08:39:33 +0000 (09:39 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Sat, 30 Nov 2024 08:39:33 +0000 (09:39 +0100)
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
src/widget/list_tile.rs

index 9a595f5b5e5c08634448227517d3d6fe52f2df2a..7d9ec979107f9c4a79521180811ea938c1be55a9 100644 (file)
@@ -7,19 +7,24 @@ use crate::props::{ListenersWrapper, WidgetStdProps};
 
 use pwt_macros::{builder, widget};
 
-/// List tile. A container with flex row layout.
+/// List tile. A container with grid/subgrid layout.
+///
+/// This is meant to be used inside [List].
 ///
 /// ```
 /// # use pwt::prelude::*;
-/// # use pwt::widget::ListTile;
-/// # fn create_list_tile() -> ListTile {
-///   ListTile::new()
-///       .with_child(html!{<span>{"A simple list tile"}</span>})
-///       .with_child(html!{<span>{"second column"}</span>})
-///       .interactive(true)
-///       .disabled(false)
-///       .style("justify-content", "space-between")
-///       .class(pwt::css::ColorScheme::Primary)
+/// # use pwt::widget::{List, ListTile};
+/// # fn create_list_tile() -> List {
+///     List::new(100, |pos| {
+///         ListTile::new()
+///             .with_child(html!{<span>{format!("{pos}")}</span>})
+///             .with_child(html!{<span>{"A simple list tile"}</span>})
+///             .with_child(html!{<span>{"third column"}</span>})
+///             .interactive(true)
+///             .disabled(false)
+///             .class(pwt::css::ColorScheme::Primary)
+///     })
+///     .grid_template_columns("auto 1fr auto")
 /// # }
 /// ```
 #[widget(pwt=crate, @element, @container)]