ratatui-explorer
ratatui-explorer is a simple library for creating file explorers for ratatui.
Features:
- File explorer functionality.
- Input handling (from crossterm, termion, termwiz and your own backend).
- Customizable widget theming.
Examples
Run cargo run --example
to try the different example available.
Basic usage
The simplest use of ratatui-explorer with the crossterm backend.
cargo run --example basic
Light and dark theme
Switching custom themes while running.
cargo run --example light_and_dark_theme
File preview
Adapt the interface depending on the selected file.
cargo run --example file_preview
Basic usage
Install the libraries in your Cargo.toml
file:
cargo add ratatui ratatui-explorer crossterm
Then inside your main.rs
file:
use ;
use ;
use *;
use ;
Customizing the theme
You can customize the theme of the file explorer widget by using the Theme
struct.
use ;
use Theme;
let theme = default
.add_default_title
.with_title_bottom
.with_block
.with_highlight_item_style
.with_highlight_dir_style
.with_highlight_symbol;
Bindings
The following bindings are used by default for crossterm, termion and termwiz.
Binding | Action |
---|---|
j , <DownArrow> |
Move the selection down |
k , <UpArrow> |
Move the selection up |
h , <LeftArrow> , <Backspace> |
Go to the parent directory |
l , <RightArrow> , <Enter> |
Go to the child directory* |
*if the selected item is a directory