Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(showcase): showcase tabs widget #391

Merged
merged 3 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/widget-showcase/src/examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ pub mod list;
pub mod paragraph;
pub mod sparkline;
pub mod table;
pub mod tabs;
13 changes: 13 additions & 0 deletions code/widget-showcase/src/examples/tabs.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use ratatui::{prelude::*, widgets::*};

pub fn render(frame: &mut Frame) {
let tabs = Tabs::new(vec!["TODO", "IN PROGRESS", "DONE"])
.block(Block::default().title("Project").borders(Borders::ALL))
.style(Style::default().white())
.highlight_style(Style::default().underlined().bold().yellow())
.select(1)
.divider(symbols::DOT)
.padding(" ", " ");

frame.render_widget(tabs, frame.size());
}
2 changes: 2 additions & 0 deletions code/widget-showcase/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ enum Widget {
Paragraph,
Sparkline,
Table,
Tabs,
}

fn main() -> color_eyre::Result<()> {
Expand Down Expand Up @@ -109,6 +110,7 @@ impl App {
Widget::Paragraph => paragraph::render(frame),
Widget::Sparkline => sparkline::render(frame),
Widget::Table => table::render(frame),
Widget::Tabs => tabs::render(frame),
}
Ok(())
}
Expand Down
9 changes: 9 additions & 0 deletions code/widget-showcase/tabs.tape
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# A VHS tape. See https://github.com/charmbracelet/vhs
Output "../../src/content/docs/showcase/widgets/tabs.gif"
Set Theme "Aardvark Blue"
Set Width 600
Set Height 260
Type "cargo run -- -w tabs" Enter
Sleep 5s
Screenshot "../../src/content/docs/showcase/widgets/tabs.png"
Sleep 1s
4 changes: 3 additions & 1 deletion src/content/docs/showcase/widgets/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ https://github.com/ratatui-org/website/issues/249 for information about how to c

![Table](./table.png)

## Tabs <LinkBadge href="https://docs.rs/ratatui/latest/ratatui/widgets/struct.Tabs.html" text="Docs" /> <LinkBadge text="Help Wanted" href="https://github.com/ratatui-org/website/issues/249" variant="caution" />
## Tabs <LinkBadge href="https://docs.rs/ratatui/latest/ratatui/widgets/struct.Tabs.html" text="Docs" />

![Tabs(./tabs.png)

## Third Party Widgets

Expand Down
3 changes: 3 additions & 0 deletions src/content/docs/showcase/widgets/tabs.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/content/docs/showcase/widgets/tabs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading