InputOptions
The InputOptions interface configures an Input component — its type, label, default value, width, alignment, position, and styling.
Type Definition
type: Either"text"or"password". Password mode masks the input with*. Defaults to"text".label: A text label displayed before the input field.defaultValue: Pre-filled value when the input is first shown.width: ACardWidthvalue — a number, a ratio ("1/2","full", etc.), or"auto".align: Horizontal alignment of the input —"left","center", or"right".position: Where to render the input —"inline","top", or"bottom".styles: AnInputStyleOptionsobject to customise the input field, label, and border independently.
interface InputOptions {
type?: InputType;
label?: string;
defaultValue?: string;
width?: CardWidth;
align?: Alignment;
position?: FixedPosition;
styles?: InputStyleOptions;
}
Usage
import { Input } from "ts-better-console";
const input = new Input({type: "password",});
label: "Password",
width: 40,
position: "bottom",
input.on("submit", (value) => {console.log("Password:", value);});
Want to support this project?
If you find ts-better-console useful and want to support its development, consider starring the GitHub repository or buying me a coffee! Your support helps me dedicate more time to improving the library and adding new features.
Want to contribute to this project?
Contributions are welcome! If you're interested in improving the library, fixing bugs, or adding new features, feel free to check out the GitHub repository and submit a pull request. Whether you're a seasoned developer or new to open source, your contributions can make a difference!