flagstaff
API reference

flagstaff/boxen

Every export of flagstaff/boxen, with its signature and doc comment: boxen, _borderStyles, plus 7 types.

import boxen from 'flagstaff/boxen';
import { _borderStyles } from 'flagstaff/boxen';

Functions

default

The default export, declared as boxen.

Draw a box around text, exactly as boxen 9 draws it.

function boxen(input: string, options?: BoxenOptions): string;
ParameterType
inputstring
options (optional)BoxenOptions

Returns string

Constants

_borderStyles

cli-boxes 4, as data. boxen re-exports this as _borderStyles, so it is part of the surface a caller can reach and not an implementation detail to be hidden.

const BOXES: Record<string, BoxenBorderStyle>;

Interfaces

BoxenBorderStyle

interface BoxenBorderStyle {
    topLeft: string;
    top: string;
    topRight: string;
    left: string;
    right: string;
    bottomLeft: string;
    bottom: string;
    bottomRight: string;
    /** @deprecated boxen's own name for `left` and `right` together; a fallback for either. */
    vertical?: string;
    /** @deprecated boxen's own name for `top` and `bottom` together; a fallback for either. */
    horizontal?: string;
}

BoxenOptions

interface BoxenOptions {
    borderStyle?: string | BoxenBorderStyle;
    borderColor?: Color;
    backgroundColor?: Color;
    /** The border's background: a colour, `'inherit'` (the default) to take `backgroundColor`, or `undefined` for none. */
    borderBackgroundColor?: Color | 'inherit' | undefined;
    dimBorder?: boolean;
    title?: string;
    titleColor?: Color;
    titleAlignment?: Alignment;
    footer?: string;
    footerAlignment?: Alignment;
    textAlignment?: Alignment;
    /** @deprecated boxen's own name for `textAlignment`, still honoured. */
    align?: Alignment;
    padding?: number | Spacing;
    margin?: number | Spacing;
    width?: number | `${number}`;
    maxWidth?: number | `${number}`;
    height?: number | `${number}`;
    float?: Alignment;
    fullscreen?: boolean | ((columns: number, rows: number) => [number, number]);
}

Spacing

interface Spacing {
    top?: number;
    right?: number;
    bottom?: number;
    left?: number;
}

Types

Boxes

type Boxes = typeof BOXES;

Color

boxen's Color: one of chalk's sixteen foreground names, or a hex.

type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray' | 'grey' | 'blackBright' | 'redBright' | 'greenBright' | 'yellowBright' | 'blueBright' | 'magentaBright' | 'cyanBright' | 'whiteBright' | (string & Record<never, never>);

CustomBorderStyle

type CustomBorderStyle = BoxenBorderStyle;

Options

type Options = BoxenOptions;

On this page