CardOptions
Configuration for the Card class. Controls the title, body, footer, alignment on the terminal, and border appearance.
Type Definition
interface CardOptions {
title?: SectionOptions;
body?: BodyOptions;
align?: Alignment;
footer?: SectionOptions;
border?: BorderOptions;
}
Properties
title— aSectionOptionswithcontent, optionalalign, and optionalstyle. Renders a title row above the body with a separator line.body— aBodyOptionsobject withalignandstyleto control the main content area.align— positions the entire card on the terminal:"left","center", or"right".footer— same shape astitle. Renders a footer row below the body with a separator line.border— aBorderOptionsobject with:style— aStyleOptionsto color/style the border characters.symbols— pick a preset withsymbols.style("single","double","round","bold","singleDouble","doubleSingle") or supply your own withsymbols.custom.
Usage
import { Card } from "ts-better-console";
const card = new Card("Hello World", 50, {title: {content: "My Card",style: { color: "cyan", styles: ["bold"] },},body: { style: { color: "white" } },footer: { content: "v1.0.0", style: { color: "gray" } },border: {}).render();style: { color: "blue" },symbols: { style: "round" },},
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!