euv_ui/component/list/view/struct.rs
1use super::*;
2
3/// One row of the [`euv_list`] component.
4///
5/// A row is a title, an optional description line, and optional trailing
6/// meta text. The two optional fields are skipped at render time, so a
7/// terse one-line row leaves no empty gap in the row body.
8#[derive(Clone, CustomDebug, Data, Default, New)]
9pub struct EuvListItem {
10 /// The row headline rendered in `c_euv_list_item_title`.
11 pub title: ::euv::CowText,
12 /// The optional row description rendered in `c_euv_list_item_desc`
13 /// (skipped when empty).
14 pub desc: ::euv::CowText,
15 /// The optional trailing meta text rendered in `c_euv_list_item_meta`
16 /// (skipped when empty).
17 pub meta: ::euv::CowText,
18}
19
20/// Props for the [`euv_list`] component.
21///
22/// Defines the strongly-typed interface for a list of titled rows. The
23/// rows are ordered top to bottom, matching the reading direction of the
24/// column they are rendered in.
25#[derive(Clone, CustomDebug, Default)]
26pub struct EuvListProps {
27 /// The rows to render; an empty list renders the empty state instead.
28 pub items: Vec<EuvListItem>,
29 /// The empty-state text rendered when there are no items (skipped when
30 /// empty, leaving the list blank instead).
31 pub empty_text: &'static str,
32}