Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Installation

[dependencies]
tui-pages = "0.7.0"
crossterm = "0.28"

Why these two extra crates:

  • crosstermtui-pages doesn't read the keyboard for you. In your event loop you read a key with crossterm and pass it to tui.handle_key(key, …), whose parameter is a crossterm::event::KeyEvent. So crossterm has to be your own dependency — that's the type the two of you exchange. No conversion needed.
  • a renderer — the core crate ships no drawing code and doesn't depend on ratatui; you draw the screen. ratatui is the obvious pick (and all the examples use it), but nothing forces it. Only the optional dialog feature pulls ratatui in.

Features

dialog

A built-in modal dialog with a ratatui renderer. Pulls in ratatui 0.28.

tui-pages = { version = "0.7", features = ["dialog"] }

Gives you DialogData, DialogResult, DialogTheme, render_dialog, and the dialog::* helpers that drive a modal for you. See Dialogs.

serde

Derives Serialize/Deserialize on the input/mode types (ModeId, KeyChord, FocusWrap), so you can load keybindings from a config file.

tui-pages = { version = "0.7", features = ["serde"] }

Edition

The crate is built on Rust edition 2021.