npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@b9g/termdom

v0.1.0

Published

HTML, CSS and the DOM for terminal emulators. Real CSS layout, no native or WASM dependency.

Downloads

73

Readme

TermDOM

Build terminal apps with HTML, CSS and the DOM.

TermDOM is a JavaScript library that displays HTML and CSS in the terminal. It draws actual DOM nodes to terminal output and redraws the screen when they mutate, so TUIs and interactive CLIs can be written with vanilla JavaScript or any frontend web framework.

npm install @b9g/termdom
import {TermDOM} from "@b9g/termdom";

const term = new TermDOM();
term.attach();

// The document is a real DOM document.
const {document} = term;
document.body.innerHTML = `
  <style>
    .card { border: 1px solid #5fafff; padding: 0 1ch; width: 36ch; }
    .title { color: #5fafff; font-weight: bold; }
    .done { color: green; }
    .rest { color: #444; }
    .pct { color: #888; }
  </style>
  <div class="card">
    <div class="title">Installing</div>
    <div>
      <span class="done" id="done"></span><span class="rest" id="rest"></span>
      <span class="pct" id="pct"></span>
    </div>
  </div>
`;

// TermDOM observes mutations and re-renders automatically.
let n = 0;
setInterval(() => {
  n = (n + 1) % 101;
  const cells = Math.round(n / 4);
  document.getElementById("done").textContent = "█".repeat(cells);
  document.getElementById("rest").textContent = "░".repeat(25 - cells);
  document.getElementById("pct").textContent = String(n).padStart(3) + "%";
}, 50);

The card above, animating in a terminal

Features

  • Stylesheets CSS from <style> elements and style attributes cascades and inherits like it does in the browser, and is translated to ANSI escapes for color and text decoration.
  • Layout The CSS box model, flexbox, and table layout are all supported.
  • Scrolling Documents taller than the terminal scroll with window.scrollTo() and element.scrollIntoView().
  • Events Events for keys, mouse, focus, and paste fire on elements, the document, and the window, pulled from STDIN.
  • DOM utilities document.querySelector(), MutationObserver, ResizeObserver, and Element.getBoundingClientRect() are hooked up to the layout engine and viewport, following browser standards.
  • Forms <input>, <textarea>, <select>, checkboxes, and radios come with default behavior and terminal-native looks, and can be restyled with ordinary CSS. Tab navigation and :focus styles are supported.
  • Web Components customElements.define(), attachShadow(), <slot>, :host, and scoped styles behave like the browser's. The built-in form controls are themselves shadow trees.
  • Text CJK, emoji, and combining characters take their correct widths. Hebrew and Arabic render in visual order with contextual shaping, and the caret moves by grapheme.
  • Selection Drag to select, styled with ::selection.
  • Fullscreen Element.requestFullscreen() renders an element to the alternate screen. Exiting restores the shell and its scrollback.

Examples

  • markdown.ts — a Markdown viewer that pages when the document is taller than the terminal.
  • chat.ts — a streaming LLM chat client powered by ch.at, with a transcript and composer.
  • todomvc.ts — the official TodoMVC with its component logic unmodified; only the stylesheet was swapped.
  • fuzzy-finder.ts — a file picker that prints the selection to stdout.

More runnable examples can be found in examples/.

Runtimes

TermDOM runs on Node, Bun and Deno. The library has no native components and can be used to create binaries with tools like bun build --compile.

Compatibility

COMPATIBILITY.md is generated by probing each feature against the engine.

License

MIT