Crate tui_checkbox

Crate tui_checkbox 

Source
Expand description

§tui-checkbox

A customizable checkbox widget for Ratatui TUI applications.

§Features

  • ☑️ Simple checkbox with label
  • 🎨 Customizable styling for checkbox and label separately
  • 🔤 Custom symbols (unicode, emoji, ASCII)
  • 📦 Optional block wrapper
  • ⚡ Zero-cost abstractions

§Examples

Basic usage:

use ratatui::style::{Color, Style};
use tui_checkbox::Checkbox;

let checkbox = Checkbox::new("Enable feature", true);

With custom styling:

use ratatui::style::{Color, Style, Modifier};
use tui_checkbox::Checkbox;

let checkbox = Checkbox::new("Enable feature", true)
    .style(Style::default().fg(Color::White))
    .checkbox_style(Style::default().fg(Color::Green).add_modifier(Modifier::BOLD))
    .label_style(Style::default().fg(Color::Gray));

With custom symbols:

use tui_checkbox::Checkbox;

let checkbox = Checkbox::new("Task", false)
    .checked_symbol("✅ ")
    .unchecked_symbol("⬜ ");

Modules§

symbols
Symbols for checkbox widget

Structs§

Checkbox
A widget that displays a checkbox with a label.