{"id":16951,"library":"blessed-tab-container","title":"Blessed Tab Container","description":"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.","status":"maintenance","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/f3rno/blessed-tab-container","tags":["javascript","blessed","cli","ascii","dashboard","ui","terminal"],"install":[{"cmd":"npm install blessed-tab-container","lang":"bash","label":"npm"},{"cmd":"yarn add blessed-tab-container","lang":"bash","label":"yarn"},{"cmd":"pnpm add blessed-tab-container","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core UI library this component extends and relies upon for terminal interface management.","package":"blessed","optional":false},{"reason":"Used in examples and common for styling terminal output; can be replaced with custom color functions.","package":"colors","optional":true}],"imports":[{"note":"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.","wrong":"import BlessedTabContainer from 'blessed-tab-container'","symbol":"BlessedTabContainer","correct":"const BlessedTabContainer = require('blessed-tab-container')"},{"note":"`blessed` itself is a CommonJS-first library, typically imported as a default object containing its exports.","wrong":"import { screen } from 'blessed'","symbol":"screen","correct":"const blessed = require('blessed'); const screen = blessed.screen({ smartCSR: true });"}],"quickstart":{"code":"const BlessedTabContainer = require('blessed-tab-container')\nconst blessed = require('blessed')\nconst blessedContrib = require('blessed-contrib')\nconst colors = require('colors')\n\nconst screen = blessed.screen({ smartCSR: true })\n\nscreen.enableInput()\nscreen.key(['escape', 'q', 'C-c'], () => {\n  screen.destroy()\n  process.exit(0)\n})\n\nconst grid = new blessedContrib.grid({\n  screen: screen,\n  rows: 1,\n  cols: 2\n})\n\nconst tabGroupA = []\nconst tabGroupB = []\n\nfor (let i = 0; i < 2; i += 1) {\n  tabGroupA.push(grid.set(0, 0, 1, 1, blessed.element, {\n    content: `Content for Tab ${i + 1}`\n  }))\n}\n\nfor (let i = 0; i < 5; i += 1) {\n  tabGroupB.push(grid.set(0, 1, 1, 1, blessed.element, {\n    content: `Content for Tab ${i + 1}`\n  }))\n}\n\nconst tabContainerSettings = {\n  screen,\n  tabSeperator: ' | ',\n  activeColorFunc: colors.bgBrightBlue.black,\n  dirtyColorFunc: colors.underline\n}\n\nconst tabContainerA = BlessedTabContainer({\n  ...tabContainerSettings,\n  defaultVisible: 'Tab 1',\n  tabs: tabGroupA.map((t, i) => ({\n    label: `Tab ${i + 1}`,\n    component: t\n  }))\n})\n\nconst tabContainerB = BlessedTabContainer({\n  ...tabContainerSettings,\n  defaultVisible: 'Tab 1',\n  tabs: tabGroupB.map((t, i) => ({\n    label: `Tab ${i + 1}`,\n    component: t\n  }))\n})\n\n// Do something with the containers\ntabContainerA.setVisibleTab('Tab 2')\ntabContainerB.setVisibleTab('Tab 4')\n\nscreen.render()","lang":"javascript","description":"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."},"warnings":[{"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.","message":"The `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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"The `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.","severity":"gotcha","affected_versions":">=1.0.0"},{"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.","message":"The 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.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"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()`.","cause":"Attempting to use `require()` in an ES module file (e.g., `type: 'module'` in package.json or `.mjs` file).","error":"ReferenceError: require is not defined in ES module scope"},{"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.","cause":"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.","error":"TypeError: BlessedTabContainer is not a function"}],"ecosystem":"npm","meta_description":null}