Skip to main content

euv_ui/component/descriptions/view/
struct.rs

1use super::*;
2
3/// One entry of the [`euv_descriptions`] grid.
4///
5/// A description is a label and the value it describes. The pair is
6/// rendered as a label line over a value line, so a grid cell reads the
7/// same way whether it sits alone or beside its neighbours.
8#[derive(Clone, CustomDebug, Data, Default, New)]
9pub struct EuvDescriptionsItem {
10    /// The field name rendered in `c_euv_descriptions_label`.
11    pub label: ::euv::CowText,
12    /// The field value rendered in `c_euv_descriptions_value`.
13    pub value: ::euv::CowText,
14}
15
16/// Props for the [`euv_descriptions`] component.
17///
18/// Defines the strongly-typed interface for a key/value detail grid. The
19/// entries are laid out in source order and flow across the grid row by
20/// row, so the column count decides how many entries share a row.
21#[derive(Clone, CustomDebug, Default)]
22pub struct EuvDescriptionsProps {
23    /// The label/value pairs to render; an empty list renders an empty grid.
24    pub items: Vec<EuvDescriptionsItem>,
25    /// The number of grid columns; a count of zero falls back to one column.
26    pub columns: usize,
27}