ratatui_kit/components/
view.rs

1use ratatui_kit_macros::{Props, with_layout_style};
2
3use crate::{AnyElement, Component};
4
5#[with_layout_style]
6#[derive(Default, Props)]
7pub struct ViewProps<'a> {
8    pub children: Vec<AnyElement<'a>>,
9}
10
11pub struct View;
12
13impl Component for View {
14    type Props<'a> = ViewProps<'a>;
15
16    fn new(_props: &Self::Props<'_>) -> Self {
17        Self
18    }
19
20    fn update(
21        &mut self,
22        props: &mut Self::Props<'_>,
23        _hooks: crate::Hooks,
24        updater: &mut crate::ComponentUpdater,
25    ) {
26        updater.set_layout_style(props.layout_style());
27        updater.update_children(&mut props.children, None);
28    }
29}