@chromakit/core
    Preparing search index...

    Interface BoxOptions

    Visual customization options for box.

    interface BoxOptions {
        borderColor?: string;
        borderStyle?: "single" | "double" | "dashed";
        padding?: number;
        style?: (text: string) => string;
        title?: string;
        width?: number;
    }
    Index

    Properties

    borderColor?: string

    Foreground color applied to all border glyphs and the vertical bars around each content line. When omitted, borders are uncolored.

    Parsed and applied by colorText, which emits ANSI SGR sequences and appends a reset.

    borderStyle?: "single" | "double" | "dashed"

    Border drawing style.

    "single"

    padding?: number

    Horizontal padding (spaces) added on both left and right sides of each content line. Top/bottom padding is not applied (MVP behavior).

    1

    style?: (text: string) => string

    Text transformer applied to each content line before width calculation.

    Useful for emphasis (e.g., bold) or composed styles. The result of style contributes to the measured contentWidth, which may overcount visible width because ANSI sequences occupy code units but no columns. This is acceptable for simple cases; see box caveats if you need precise alignment.

    title?: string

    Optional title displayed in the top border, centered, and rendered bold.

    The title is padded with single spaces (e.g., " My Title "), then centered within the top horizontal rule. If title is longer than the computed inner width, the inner width expands automatically due to the Math.max(...) calculation.

    width?: number

    Minimum total width of the box, including left/right borders.

    If omitted, the width is the maximum of:

    • Longest content line + padding * 2
    • Title length + 4 (left/right inner spacing)
    • 0

    Note: Width is computed via String.length (UTF-16 code units). Terminals render box-drawing characters and East Asian text with varying cell widths; alignment can differ in those contexts. See caveats in box.