Alignment
Three related types handle horizontal alignment throughout ts-better-console: Alignment uses directional words, AlignmentAlias uses positional words, and Align accepts both — making all three interchangeable anywhere alignment is needed.
Type Definitions
// Directional — used in most component options
type Alignment = "left" | "center" | "right";
// Positional alias — familiar to CSS / flexbox users
type AlignmentAlias = "start" | "center" | "end";
// Union — accepts either form
type Align = Alignment | AlignmentAlias;
Value Mapping
"left"/"start"— content aligned to the left edge"center"— content centred"right"/"end"— content aligned to the right edge
Use aliasAlignment() to normalise an Align value down to a plain Alignment string when you need a canonical form.
Usage
import { Card, Input } from "ts-better-console";
// Alignment value — left | center | right
const card = new Card("Centred text", 40, { align: "center" }).render();
// Alias form — also accepted
const input = new Input({ align: "end" });
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!