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, Copy, CustomDebug, Data, Default, New)]
9pub struct EuvListItem {
10 /// The row headline rendered in `c_euv_list_item_title`.
11 #[get(type(copy))]
12 pub title: &'static str,
13 /// The optional row description rendered in `c_euv_list_item_desc`
14 /// (skipped when empty).
15 #[get(type(copy))]
16 pub desc: &'static str,
17 /// The optional trailing meta text rendered in `c_euv_list_item_meta`
18 /// (skipped when empty).
19 #[get(type(copy))]
20 pub meta: &'static str,
21}
22
23/// Props for the [`euv_list`] component.
24///
25/// Defines the strongly-typed interface for a list of titled rows. The
26/// rows are ordered top to bottom, matching the reading direction of the
27/// column they are rendered in.
28#[derive(Clone, CustomDebug, Default)]
29pub struct EuvListProps {
30 /// The rows to render; an empty list renders the empty state instead.
31 pub items: Vec<EuvListItem>,
32 /// The empty-state text rendered when there are no items (skipped when
33 /// empty, leaving the list blank instead).
34 pub empty_text: &'static str,
35}