Skip to main content

euv_ui/component/toc/view/
struct.rs

1use super::*;
2
3/// One entry of the [`euv_toc`] anchor list.
4#[derive(Clone, Copy, CustomDebug, Data, Default, New)]
5pub struct EuvTocItem {
6    /// The heading level (levels deeper than 2 render indented).
7    #[get(type(copy))]
8    pub level: u8,
9    /// The display text.
10    #[get(type(copy))]
11    pub text: &'static str,
12    /// The full href (for hash routers typically `#<route>#<anchor>`).
13    #[get(type(copy))]
14    pub href: &'static str,
15}
16
17/// Props for the [`euv_toc`] component.
18#[derive(Clone, Copy, CustomDebug, Data, Default, New)]
19pub struct EuvTocProps {
20    /// The list title (for example `On this page`).
21    #[get(type(copy))]
22    pub title: &'static str,
23    /// The anchor items.
24    #[get(type(copy))]
25    pub items: &'static [EuvTocItem],
26}