CLI Boxes

4.0.1 · active · verified Wed Apr 22

cli-boxes is a utility package providing a collection of pre-defined ASCII and Unicode box character sets, formatted as JSON objects, for rendering borders in terminal applications. It is currently at version 4.0.1 and is actively maintained by Sindre Sorhus, with releases primarily driven by Node.js LTS version compatibility and major architectural shifts like the move to pure ESM. Unlike full terminal UI libraries, cli-boxes focuses solely on delivering the raw character data, allowing other packages (like `boxen`) to handle the actual drawing logic. This makes it a lightweight and foundational component for console-based interfaces, distinguishing it from more comprehensive alternatives by its single-purpose design.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates importing the `cli-boxes` module, accessing the character definitions for the 'single' and 'double' box styles, and a simple example of how to use them to print a basic box in the terminal.

import cliBoxes from 'cli-boxes';

// Log the character definitions for the 'single' box style
console.log(cliBoxes.single);
/*
{
	topLeft: '┌',
	top: '─',
	topRight: '┐',
	right: '│',
	bottomRight: '┘',
	bottom: '─',
	bottomLeft: '└',
	left: '│'
}
*/

// You can use these characters to construct a box
const { topLeft, top, topRight, left, right, bottomLeft, bottom, bottomRight } = cliBoxes.double;
console.log(topLeft + top.repeat(5) + topRight);
console.log(left + ' Hello ' + right);
console.log(bottomLeft + bottom.repeat(5) + bottomRight);

view raw JSON →