Skip to main content

vizia_core/views/
divider.rs

1use crate::prelude::*;
2
3/// The Divider view provides a thin, unobtrusive line for visually separating views.
4pub struct Divider {}
5
6impl Divider {
7    /// Creates a dividing line. Orientation is determined by context.
8    pub fn new(cx: &mut Context) -> Handle<Self> {
9        Self {}.build(cx, |cx| {
10            Element::new(cx).class("divider-line");
11        })
12    }
13
14    /// Creates a horizontal dividing line.
15    pub fn horizontal(cx: &mut Context) -> Handle<Self> {
16        Self::new(cx).class("horizontal")
17    }
18
19    /// Creates a vertical dividing line.
20    pub fn vertical(cx: &mut Context) -> Handle<Self> {
21        Self::new(cx).class("vertical")
22    }
23}
24
25impl View for Divider {
26    fn element(&self) -> Option<&'static str> {
27        Some("divider")
28    }
29}
30
31impl Handle<'_, Divider> {}