Thanks to visit codestin.com
Credit goes to lib.rs

#zero-config #terminal #config-for-selection

valinta

Valinta a zero config Rust crate 🦀 for multiple selection in the terminal

2 unstable releases

Uses new Rust 2024

new 0.2.0 Dec 29, 2025
0.1.0 Dec 11, 2025

#664 in Configuration


Used in git-branch

MIT license

19KB
387 lines

[x] Valinta

Valinta a zero config Rust crate 🦀 for multiple selection in the terminal

🎞️ Example

valinta

📚 Usage

First: add this crate to your project

cargo add valinta

Next:

use valinta::select;

fn main() -> std::io::Result<()> {

    let animals = vec![
        "🦍 gorilla",
        "🪼 jellyfish",
        "🦁 lion",
        "🐝 honeybee",
        "🐗 boar",
        "🦇 bat",
        "🐌 snail",
        "🐨 koala",
        "🦉 owl",
        "🐢 turtle",
        "🐬 dolphin",
    ];

    let selected_animals = select(&animals).expect("Error message");

    Ok(())
}

Or by using ValintaError

use valinta::{select, ValintaError};
fn main() -> Result<(), ValintaError> {

    let animals = vec![
        "🦍 gorilla",
        "🪼 jellyfish",
        "🦁 lion",
        "🐝 honeybee",
        "🐗 boar",
        "🦇 bat",
        "🐌 snail",
        "🐨 koala",
        "🦉 owl",
        "🐢 turtle",
        "🐬 dolphin",
    ];

    let selected_animals = select(&animals)?;

    Ok(())
}

👩‍💻 User interactions

key pressed Action
Next item
Previous item
a or A Select all
n or N Deselect all
i or I Invert selection
space Toggle current
enter Confirm selection
esc Break

🪇 Returned type

A tupple which include the selected items and the indexes of selected data

pub type Returned<T> = (Vec<T>, Vec<usize>);

Dependencies

~4–8.5MB
~178K SLoC