label.rs

 1use ui::prelude::*;
 2use ui::Label;
 3
 4use crate::story::Story;
 5
 6#[derive(Element, Default)]
 7pub struct LabelStory {}
 8
 9impl LabelStory {
10    fn render<V: 'static>(&mut self, _: &mut V, cx: &mut ViewContext<V>) -> impl IntoElement<V> {
11        Story::container(cx)
12            .child(Story::title_for::<_, Label>(cx))
13            .child(Story::label(cx, "Default"))
14            .child(Label::new("Hello, world!"))
15            .child(Story::label(cx, "Highlighted"))
16            .child(Label::new("Hello, world!").with_highlights(vec![0, 1, 2, 7, 8, 12]))
17    }
18}