with_key_map

Function with_key_map 

Source
pub fn with_key_map(km: TableKeyMap) -> TableOption
Expand description

Creates an option to set table key map during construction.

This option applies custom key bindings to the table, allowing applications to override the default navigation keys.

§Arguments

  • km - Key mapping configuration

§Examples

use bubbletea_widgets::table::{Model, with_key_map, TableKeyMap};
use bubbletea_widgets::key;
use crossterm::event::KeyCode;

let mut custom_keymap = TableKeyMap::default();
custom_keymap.row_up = key::Binding::new(vec![KeyCode::Char('w')])
    .with_help("w", "up");

let table = Model::with_options(vec![
    with_key_map(custom_keymap),
]);