Skip to main content

themed_widgets/
themed-widgets.rs

1use ratatui::Terminal;
2use ratatui::backend::TestBackend;
3use ratatui::layout::Margin;
4use ratatui_bubbletea_theme::BubbleTheme;
5
6fn main() -> Result<(), Box<dyn std::error::Error>> {
7    let theme = BubbleTheme::default();
8    let backend = TestBackend::new(48, 8);
9    let mut terminal = Terminal::new(backend)?;
10
11    terminal.draw(|frame| {
12        let area = frame.area();
13        let inner = area.inner(Margin::new(2, 1));
14
15        frame.render_widget(
16            theme
17                .block_with_focus(true)
18                .title(theme.title("ratatui-bubbletea")),
19            area,
20        );
21
22        frame.render_widget(
23            theme.paragraph(vec![
24                theme.bullet("Plain ratatui loop"),
25                theme.checked("Charm-like defaults"),
26                theme.help_line([("q", "quit"), ("?", "help")]),
27            ]),
28            inner,
29        );
30    })?;
31
32    Ok(())
33}