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

react-bonsai

v1.1.3

Published

An implementation of cbonsai for the web

Readme

React Bonsai

react-bonsai is a bonsai tree generator, written in react using typescript. It intelligently creates, colors, and positions a bonsai tree, and is entirely configurable -- see usage. There are 2 modes of operation: static (see finished bonsai tree), and live (see growth step-by-step).

Installation

cbonsai is available in npm. Check out the latest version here.

npm i react-bonsai

Usage

const config: BonsaiConfig = {
  /*...*/
};

const Component = () => (
  <div>
        <h1>My Bonsai</h1>
        <Bonsai config={config} />
  </div>
);

Configuration:

export type BonsaiConfig = {
  maxX?: number; //max width of the tree (default: 100)
  maxY?: number; //max height of the tree (default: 100)
  baseType?: 1 | 2; //ascii-art plant base to use, 0 is none (default: 1)
  lifeStart?: number; //life; higher -> more growth (default: 10)
  multiplier?: number; //branch multiplier; higher -> more branching (default: 5)
  seed?: string; //seed random number generator (default: "react-bonsai")
  leaves?: string[]; //list of comma-delimited strings randomly chosen for leaves (default: ["&", "0", "&&", "00", "&&&", "0&~", "&~&"])
  leafClassName?: string; //class name for the leaf (default: "bonsai-leaf")
  trunkClassName?: string; //class name for the trunk (default: "bonsai-trunk")
  emptyClassName?: string; //class name for the empty space (default: "bonsai-empty")
  growthInterval?: number; //interval for showing the tree (default: 5)
  containerClassName?: string; //class name for the container (default: "bonsai")
  emptySymbol?: string; //symbol for the empty space (default: " ")
  live?: boolean; //live mode: show each step of growth (default: false)
};

How it Works

react-bonsai ports over the homemade algorithm of cbonsai to decide how the tree should grow in every step. It generates the whole tree and then returns every position as a Cell that is then rendered using a span. Trees area always generated upfront and using livemode it just shows steps 1 at a time

Just like cbonsai the algorithm is tweaked to look best at the default size, so larger sized trees may not be as bonsai-like.

Inspiration

This project is a direct port of cbonsai which itself is a newer version of bonsai.sh, which was written in bash and was itself a port of this bonsai tree generator written in javascript.

We have come full circle