원클릭으로
ratatui
// Build terminal UIs in Rust with Ratatui. Use when creating TUI applications, immediate-mode rendering, high-performance terminal interfaces, or production Rust CLIs.
// Build terminal UIs in Rust with Ratatui. Use when creating TUI applications, immediate-mode rendering, high-performance terminal interfaces, or production Rust CLIs.
Expert Rust idiomatique pour développement CLI/système. Ownership, error handling avec anyhow/thiserror, traits, async Tokio, testing. Utiliser pour coder, reviewer ou refactorer du Rust.
Analyze Rust codebase for design patterns, idioms, and anti-patterns. Provides detection, suggestion, and evaluation modes for Rust code quality. Keywords: rust, patterns, analysis, idioms, anti-patterns, code-quality
Security audit toolkit for the ccboard project (Rust/Leptos/Axum stack). Use when auditing authentication flows, API endpoints, WASM security, or reviewing Rust code for unsafe usage and memory safety issues.
Optimize web performance for faster loading and better user experience. Use when asked to "speed up my site", "optimize performance", "reduce load time", "fix slow loading", "improve page speed", or "performance audit".
Expert senior en architecture backend pour accompagner le développement (conception, implémentation, review, refactoring). Architecture hexagonale, DDD, SOLID, clean code, tests. Utiliser pour concevoir de nouvelles features, développer du code, reviewer, refactorer, ou résoudre des problèmes architecturaux.
Store a fix, pattern, or context note in Brain knowledge base (~/.ccboard/insights.db). Use when you want to remember a fix, pattern, decision, or context note across sessions.
| name | ratatui |
| description | Build terminal UIs in Rust with Ratatui. Use when creating TUI applications, immediate-mode rendering, high-performance terminal interfaces, or production Rust CLIs. |
| effort | medium |
| allowed-tools | Read, Write, Edit, Bash, Grep |
Immediate-mode terminal UI framework for Rust using Crossterm backend.
Keywords: TUI, terminal UI, ratatui, crossterm, interactive CLI, dashboard, ncurses alternative
Cargo.toml (ratatui + crossterm)terminal.draw(|f| ui(f, &app)) + event::poll + key handlerLayout::split → assign chunks → render_widget per chunk[dependencies]
ratatui = "0.28"
crossterm = "0.28"
use crossterm::{
event::{self, Event, KeyCode},
execute,
terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},
};
use ratatui::{backend::CrosstermBackend, widgets::{Block, Borders, Paragraph}, Terminal};
use std::io;
struct App {
counter: i32,
}
impl App {
fn new() -> App {
App { counter: 0 }
}
fn on_key(&mut self, key: KeyCode) {
match key {
KeyCode::Up => self.counter += 1,
KeyCode::Down => self.counter -= 1,
_ => {}
}
}
}
fn main() -> Result<(), io::Error> {
enable_raw_mode()?;
let mut stdout = io::stdout();
execute!(stdout, EnterAlternateScreen)?;
let backend = CrosstermBackend::new(stdout);
let mut terminal = Terminal::new(backend)?;
let mut app = App::new();
loop {
terminal.draw(|f| {
let block = Block::default().title("Counter").borders(Borders::ALL);
let paragraph = Paragraph::new(format!("Count: {}", app.counter)).block(block);
f.render_widget(paragraph, f.area());
})?;
if let Event::Key(key) = event::read()? {
match key.code {
KeyCode::Char('q') => break,
code => app.on_key(code),
}
}
}
disable_raw_mode()?;
execute!(terminal.backend_mut(), LeaveAlternateScreen)?;
Ok(())
}
use std::time::Duration;
fn run_app<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) -> io::Result<()> {
loop {
terminal.draw(|f| ui(f, app))?;
if event::poll(Duration::from_millis(100))? {
if let Event::Key(key) = event::read()? {
match key.code {
KeyCode::Char('q') => return Ok(()),
KeyCode::Up => app.increment(),
KeyCode::Down => app.decrement(),
_ => {}
}
}
}
}
}
use ratatui::layout::{Constraint, Direction, Layout};
let chunks = Layout::default()
.direction(Direction::Vertical)
.constraints([
Constraint::Length(3), // Fixed height
Constraint::Min(0), // Fill remaining
Constraint::Length(1), // Status bar
])
.split(f.area());