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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@nkeff/cardboard-js

v0.1.0

Published

Fast, light & ultra-compact library for composing interactive web apps—all in plain JavaScript or TypeScript, no HTML required.

Downloads

34

Readme

📦 Carboard.js

Tests Main Project Status SonarQube Status Bundle Size

Cardboard.js: Build web apps without HTML, CSS, or JSX! This lightweight (around 16kb), performant library lets you manage state, components, and logic using just JavaScript/TypeScript. Ideal for projects where simplicity and speed are key.

It's similar in philosophy to VanJS, but with many more features and a more extensive API.

!NOTE!: Cardboard is in development, use it with caution.
You can check the v1.0.0 milestone for a view on the development state - help is much appreciated!

const Counter = () => {
  const count = state(0);

  return button()
    .text(`Clicked $count times`, { count })
    .addStyle('color', 'gray')
    .stylesIf(count.greaterThan(5), { color: 'red' }) // If count > 5, it will make the color red
    .clicked((_) => count.value++);
};

// Counter will be added to the body
tag('(body)').append(Counter());

🔸 Getting Started - for a getting started guide.

🔸 Wiki - for human documentation, and examples.

🔸 Deepwiki - ai generated docs using deepwiki

🔸 Documentation - for technical docs.

Setup

Install

npm install @nkeff/cardboard-js

Setup

import { tag, init, allTags } from '@nkeff/cardboard-js';
// Or
import { tag, init, allTags } from 'node_modules/@nkeff/cardboard-js/dist/cardboard.js';

const { div, p, span, b, script, button, style, a, hr } = allTags;

// Initialize and get access to the root tag ('body' by default)
const body = init();

// Add tags to the body
body.append(
  div(
    p('Hello world!')
  )
);

Single file script

If you want to add it to your site and start using Cardboard, you can import the bundle file:

Global import:

<script src="node_modules/@nkeff/cardboard-js/dist/cardboard.global.js"></script>
<!-- Or using a CDN -->
<script src="https://cdn.jsdelivr.net/npm/@nkeff/cardboard-js/dist/cardboard.global.js"></script>
<script>
const { div, p } = Carboard.allTags;
</script>

ESM import:

<script>
  import { tag, init, allTags, p } from 'https://cdn.jsdelivr.net/npm/@nkeff/cardboard-js/dist/cardboard.js';
  const { div, p } = allTags;
</script>

What does it do?

Cardboard.js lets you create web apps using only JavaScript/TypeScript, eliminating the need for HTML, CSS, or JSX. Write code that directly represents your HTML, CSS, state, and logic.

Key features:

  • NO HTML: Create any HTML element with Cardboard.
  • State: Built-in reactive state management.
  • Manipulation: Easily manipulate HTML properties based on state.
  • Logic: Add application logic in a simple way.
  • Text Templates: Simplify text and template manipulation with state.
  • Components: Create reusable UI components.
  • CSS in JS: Style your application using JavaScript objects.
  • Typed: Full TypeScript support for code completion and type safety.
  • ATAP: As tested as possible!

NOTE: There's also a server-side alternative to Cardboard I've also written, called Hobo. In case you need something similar to Cardboard that works server-side! I'm planning to make Cardboard work server-side as well in v2.0.0. So you can look forward to that, or help out!


Who's this for?

If you don't like writing HTML, CSS, or JSX, or need a lightweight framework for performant web apps, Cardboard.js might be for you. Build anything from static pages to advanced applications with a small footprint. Let me know if it's missing something you need!

Contributing

Well, hello! I'm always open for help on projects, and this one in particular! If you find the project interesting, useful, fun, or you feel some other kind of emotion, and that emotion inclines you to maybe consider helping out, that'd be great!

You can help with the Wiki, using and testing the project, reporting bugs, fixing bugs, adding features, etc... Just remember to leave an issue if the change is big or changes some core concept of cardboard.

Take a look at these guides: