Registry / web-framework / blessed-tab-container

blessed-tab-container

JSON →
library1.0.0jsnpmunverified

blessed-tab-container is a specialized UI component designed for the `blessed` command-line interface (CLI) library, enabling developers to create multi-tabbed user interfaces within terminal applications. As of version `1.0.0`, it provides a stable API for managing tabbed content. The package indicates tab 'dirty' states, a key differentiator, by modifying tab labels, along with configurable styling options for active and dirty tabs. Released over 6 years ago, it suggests a mature and stable API without a rapid release cadence. It extends `blessed` functionality by integrating tab navigation directly into the `blessed` screen's label mechanism, offering a unique approach compared to other potential custom container implementations.

npm install blessed-tab-container
INSTALL
IMPORT
SIG · BLESSED-TAB-CONTAI
B
blessed-tab-container
web-frameworkjavascriptv1.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BlessedTabContainer
const BlessedTabContainer = require('blessed-tab-container')
import BlessedTabContainer from 'blessed-tab-container'
Package `1.0.0` was published 6 years ago and targets Node.js >=8.3.0, making it primarily CommonJS. Direct ESM import (`import ... from 'pkg'`) is not natively supported and will fail unless bundled or transpiled.
screen
const blessed = require('blessed'); const screen = blessed.screen({ smartCSR: true });
import { screen } from 'blessed'
`blessed` itself is a CommonJS-first library, typically imported as a default object containing its exports.

This example demonstrates setting up two `blessed-tab-container` instances within a `blessed-contrib` grid, populating them with simple `blessed.element` components, and programmatically setting the visible tab. It shows basic initialization and interaction.

const BlessedTabContainer = require('blessed-tab-container') const blessed = require('blessed') const blessedContrib = require('blessed-contrib') const colors = require('colors') const screen = blessed.screen({ smartCSR: true }) screen.enableInput() screen.key(['escape', 'q', 'C-c'], () => { screen.destroy() process.exit(0) }) const grid = new blessedContrib.grid({ screen: screen, rows: 1, cols: 2 }) const tabGroupA = [] const tabGroupB = [] for (let i = 0; i < 2; i += 1) { tabGroupA.push(grid.set(0, 0, 1, 1, blessed.element, { content: `Content for Tab ${i + 1}` })) } for (let i = 0; i < 5; i += 1) { tabGroupB.push(grid.set(0, 1, 1, 1, blessed.element, { content: `Content for Tab ${i + 1}` })) } const tabContainerSettings = { screen, tabSeperator: ' | ', activeColorFunc: colors.bgBrightBlue.black, dirtyColorFunc: colors.underline } const tabContainerA = BlessedTabContainer({ ...tabContainerSettings, defaultVisible: 'Tab 1', tabs: tabGroupA.map((t, i) => ({ label: `Tab ${i + 1}`, component: t })) }) const tabContainerB = BlessedTabContainer({ ...tabContainerSettings, defaultVisible: 'Tab 1', tabs: tabGroupB.map((t, i) => ({ label: `Tab ${i + 1}`, component: t })) }) // Do something with the containers tabContainerA.setVisibleTab('Tab 2') tabContainerB.setVisibleTab('Tab 4') screen.render()
Debug
Known issues
gotchaThe `blessed` ecosystem, including `blessed-tab-container`, largely predates widespread native ESM support in Node.js. This package is primarily CommonJS, and direct `import` statements will likely fail without a transpiler or ESM loader.
fix
Always use `require()` for importing `blessed-tab-container` and other `blessed` related modules in projects not explicitly set up for CJS-to-ESM interoperability.
affects: >=1.0.0
gotchaThe `blessed` library, on which this package depends, has not been actively maintained by its original author (chjj) since around 2016. While `blessed-tab-container` is stable, the underlying `blessed` library itself may have unaddressed bugs or compatibility issues with newer terminal features.
fix
Consider using `reblessed` (a community-maintained fork of `blessed`) if active development and modern Node.js compatibility are critical, though `blessed-tab-container` might need testing for `reblessed` compatibility.
affects: >=1.0.0
gotchaThe package was last published 6 years ago. While stable at `1.0.0`, lack of recent updates means it may not fully leverage modern JavaScript features, `blessed` advancements (e.g., in `neo-blessed`), or address security concerns found in older dependencies.
fix
Thoroughly test integration in modern Node.js environments. Review dependency tree for known vulnerabilities in older packages if used in production. Be prepared to fork or extend if new features are required.
affects: >=1.0.0
Errors
Common errors & fixes
ReferenceError: require is not defined in ES module scope
Attempting to use `require()` in an ES module file (e.g., `type: 'module'` in package.json or `.mjs` file).
fix
Ensure your file is treated as CommonJS (e.g., `.js` file without `type: 'module'` in `package.json`). For `blessed-tab-container@1.0.0`, direct ESM imports are not supported. Stick to CommonJS `require()`.
TypeError: BlessedTabContainer is not a function
Incorrect import statement, typically trying to use named import syntax (`import { BlessedTabContainer } from 'blessed-tab-container'`) instead of default import for a CommonJS module that exports a function.
fix
If using CommonJS, ensure `const BlessedTabContainer = require('blessed-tab-container')` is used. If attempting ESM with a bundler, ensure it handles default CJS exports correctly, e.g., `import BlessedTabContainer from 'blessed-tab-container'` after appropriate transpilation/bundling.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
blessedrequiredCore UI library this component extends and relies upon for terminal interface management.
colorsoptionalUsed in examples and common for styling terminal output; can be replaced with custom color functions.
Agent activity
9 hits · last 30 days
node
6
OpenAI (training)
1
Resources
blessed-tab-container — npm install blessed-tab-container · libregistry