flagstaff
API reference

flagstaff/boxen

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

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

Functions

default

The default export, declared as boxen.

import boxen from 'boxen' is the incumbent's surface. A named export here would break every migration this file exists to serve, so the house rule yields to the host.

function boxen(text: string, options?: BoxenOptions): string;
ParameterType
textstring
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;
    /** Retro-compatibility: sets `left` and `right` together. */
    vertical?: string;
    /** Retro-compatibility: sets `top` and `bottom` together. */
    horizontal?: string;
}

BoxenOptions

interface BoxenOptions {
    borderStyle?: string | BoxenBorderStyle;
    borderColor?: string;
    backgroundColor?: string;
    dimBorder?: boolean;
    title?: string;
    titleAlignment?: 'left' | 'center' | 'right';
    textAlignment?: 'left' | 'center' | 'right';
    /** @deprecated boxen's own name for `textAlignment`, still honoured. */
    align?: 'left' | 'center' | 'right';
    padding?: number | Spacing;
    margin?: number | Spacing;
    width?: number;
    height?: number;
    float?: 'left' | 'center' | 'right';
    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;

CustomBorderStyle

type CustomBorderStyle = BoxenBorderStyle;

Options

type Options = BoxenOptions;

On this page