boxen
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
ansi-align | 3.0.1 | 3.17 kB | ISC | prod | |
camelcase | 6.3.0 | 3.75 kB | MIT | prod | |
chalk | 4.1.2 | 11.31 kB | MIT | prod | |
cli-boxes | 2.2.1 | 2.52 kB | MIT | prod | |
string-width | 4.2.3 | 2.33 kB | MIT | prod | |
type-fest | 0.20.2 | 36.35 kB | (MIT OR CC0-1.0) | prod | |
widest-line | 3.1.0 | 1.87 kB | MIT | prod | |
wrap-ansi | 7.0.0 | 4.22 kB | MIT | prod |
"Boxen" is an incredibly handy npm package used to create styled boxes in the terminal. With boxen, your terminal need not be a boring streak of plain text but can incorporate visually appealing and perfectly formatted boxes to emphasize or segregate messages. Text, border styles, padding, margin settings, and more can be easily modified for an enhanced user experience.
Using "boxen" is both versatile and straightforward. The initial step involves adding it to your project using npm install boxen
. After installing the module, import it using import boxen from 'boxen';
and make use of it in your files.
For creating a simple box with padding, the code would look like this:
console.log(boxen('unicorn', {padding: 1}));
For adding a margin and using a double border style, you can modify the second parameter passed in the boxen()
function like so:
console.log(boxen('unicorn', {padding: 1, margin: 1, borderStyle: 'double'}));
To add a title to your box, utilize the title
and titleAlignment
options:
console.log(boxen('unicorns love rainbows', {title: 'magical', titleAlignment: 'center'}));
You can also set a fixed width or height for your box, use a fullscreen option, set padding and margin, adjust the alignment of the text, and more. The combination of these options offers robust customizability to shape the box precisely as per your needs.
The comprehensive documentation for "boxen" can be found right in its README on the GitHub repository, available at https://github.com/sindresorhus/boxen/
. The full list of options that you can pass to customize your boxes, the acceptable values for these options, and additional examples showcasing the package's capability are all featured in the README. Consult it to ascertain the various creative ways you can incorporate boxen in your console output.