bubbletea_widgets/textinput/mod.rs
1//! Text input component for Bubble Tea applications.
2//!
3//! Package textinput provides a text input component for Bubble Tea applications.
4//! It closely matches the Go bubbles textinput component API for 1-1 compatibility.
5//!
6//! # Basic Usage
7//!
8//! ```rust
9//! use bubbletea_widgets::textinput::{new, Model};
10//! use bubbletea_rs::{Model as BubbleTeaModel, Msg, Cmd};
11//!
12//! // Create a text input with default settings
13//! let mut input = new();
14//! input.focus();
15//!
16//! // Set placeholder, width, and other options
17//! input.set_placeholder("Enter your name...");
18//! input.set_width(30);
19//! ```
20//!
21//! # Echo Modes
22//!
23//! ```rust
24//! use bubbletea_widgets::textinput::{new, EchoMode};
25//!
26//! let mut input = new();
27//! input.set_echo_mode(EchoMode::EchoPassword); // Hide text with asterisks
28//! ```
29//!
30//! # Key Bindings
31//!
32//! The component uses the key system for handling keyboard input with customizable bindings.
33//!
34//! # Testing
35//!
36//! This module includes comprehensive tests that match the Go implementation exactly.
37//! Run tests with: `cargo test textinput` to verify 1-1 compatibility.
38
39pub mod keymap;
40pub mod methods;
41pub mod model;
42pub mod movement;
43pub mod suggestions;
44pub mod types;
45pub mod view;
46
47#[cfg(test)]
48mod tests;
49
50// Re-export main types and functions for public API
51pub use keymap::{default_key_map, KeyMap};
52pub use model::{blink, new, new_model, paste, Model};
53pub use types::{EchoMode, PasteErrMsg, PasteMsg, ValidateFunc};