gitmyhub

react-blessed

JavaScript ★ 4.5k updated 5y ago

A react renderer for blessed.

A library that lets you build terminal command-line apps using React components and JSX, write your terminal UI the same way you write a website, and it renders into the terminal window instead of a browser.

JavaScriptReactNode.jsblessedsetup: moderatecomplexity 3/5

react-blessed lets you build terminal applications using the same component model that web developers use to build websites with React. Normally React renders buttons, divs, and text into a browser window. This library redirects that rendering into a terminal screen instead, using a Node.js library called blessed that knows how to draw boxes, lists, progress bars, and other widgets inside a command-line window.

The practical result is that you write your terminal UI in JSX, the same HTML-like syntax React developers already know. A tag like box or progressbar maps to a blessed widget. You set colors, borders, and positioning through props on those tags rather than through manual terminal drawing code. Events from the terminal, like a key press or mouse click on a widget, come back through event listener props on your components, following the same on-prefixed pattern that browser React uses. Class-based styling, similar to how React Native handles styles, is also supported, letting you define reusable style objects and attach them to components.

The library requires React 17 or later and the blessed package installed alongside it. Because the original blessed library has not been actively maintained for some time, react-blessed also supports blessed forks through a createBlessedRenderer function, letting you swap in an alternative implementation if needed.

The project describes itself as experimental and subject to change. It does work with React's own developer tools, so you can inspect the component tree in the same Electron-based devtools panel used for browser apps. The README includes several working code examples. The license is MIT.

Where it fits