Expand description
Text input component for Bubble Tea applications.
Package textinput provides a text input component for Bubble Tea applications. It closely matches the Go bubbles textinput component API for 1-1 compatibility.
§Basic Usage
use bubbletea_widgets::textinput::{new, Model};
use bubbletea_rs::{Model as BubbleTeaModel, Msg, Cmd};
// Create a text input with default settings
let mut input = new();
input.focus();
// Set placeholder, width, and other options
input.set_placeholder("Enter your name...");
input.set_width(30);§Echo Modes
use bubbletea_widgets::textinput::{new, EchoMode};
let mut input = new();
input.set_echo_mode(EchoMode::EchoPassword); // Hide text with asterisks§Key Bindings
The component uses the key system for handling keyboard input with customizable bindings.
§Testing
This module includes comprehensive tests that match the Go implementation exactly.
Run tests with: cargo test textinput to verify 1-1 compatibility.
Re-exports§
pub use keymap::default_key_map;pub use keymap::KeyMap;pub use model::blink;pub use model::new;pub use model::new_model;pub use model::paste;pub use model::Model;pub use types::EchoMode;pub use types::PasteErrMsg;pub use types::PasteMsg;pub use types::ValidateFunc;
Modules§
- keymap
- Key bindings for the textinput component.
- methods
- Core methods for the Model struct.
- model
- Core model implementation for the textinput component.
- movement
- Cursor movement and text deletion methods.
- suggestions
- Suggestion system methods for the textinput component.
- types
- Core types for the textinput component.
- view
- View rendering methods for the textinput component.