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

tinky-badge

v1.0.0

Published

A React-like badge component library for building beautiful terminal UIs

Readme

tinky-badge

A React-like badge component library for building beautiful terminal UIs.

npm license TypeScript

tinky-badge provides a fully-featured badge component for terminal applications built with the tinky framework. It supports customizable colors, automatic text transformation, and seamless theme integration.

Features

  • 📝 Simple API - Intuitive JSX-based syntax for creating badges
  • 🎨 Themeable - Full integration with tinky-theme
  • 🎯 Customizable Colors - Support for all standard terminal colors
  • 🔤 Auto Uppercase - String content is automatically converted to uppercase
  • 🎨 High Contrast - Black text on colored backgrounds for readability
  • 🎯 Type Safe - Built with TypeScript for excellent developer experience
  • 🧪 Well Tested - Comprehensive test coverage with unit tests
  • 📚 Documented - Complete API documentation generated with TypeDoc

Installation

npm install tinky-badge

# or

bun add tinky-badge

# or

yarn add tinky-badge

Quick Start

import { render } from "tinky";
import { Badge } from "tinky-badge";

function App() {
  return (
    <>
      <Badge color="green">Success</Badge>
      <Badge color="red">Error</Badge>
      <Badge color="blue">Info</Badge>
    </>
  );
}

render(<App />);

Usage

Basic Badge

Create a simple colored badge:

import { Badge } from "tinky-badge";

// Default magenta color
<Badge>Default</Badge>

// Custom colors
<Badge color="green">Success</Badge>
<Badge color="red">Error</Badge>
<Badge color="yellow">Warning</Badge>
<Badge color="blue">Info</Badge>

Color Options

The Badge component supports all standard terminal colors:

| Color | Example | | --------- | -------------------------------------------------- | | black | <Badge color="black">Text</Badge> | | red | <Badge color="red">Error</Badge> | | green | <Badge color="green">Success</Badge> | | yellow | <Badge color="yellow">Warning</Badge> | | blue | <Badge color="blue">Info</Badge> | | magenta | <Badge color="magenta">Default</Badge> (default) | | cyan | <Badge color="cyan">Active</Badge> | | white | <Badge color="white">Text</Badge> | | gray | <Badge color="gray">Disabled</Badge> |

Text Transformation

String children are automatically converted to uppercase:

// Input
<Badge color="green">success</Badge>

// Renders: SUCCESS (in uppercase)

For non-string children (React elements), no transformation is applied:

<Badge color="blue">
  <Text>Status:</Text> Active
</Badge>

API Documentation

For complete API documentation, type definitions, and usage examples, visit the API Docs.

Components

Badge

The badge component for rendering colored labels.

Props:

| Property | Type | Required | Default | Description | | ---------- | -------------------- | -------- | --------- | --------------------------------------------- | | children | ReactNode | Yes | - | Content to display (strings become uppercase) | | color | TextProps['color'] | No | magenta | Background color of the badge |

Example:

<Badge color="green">Success</Badge>

Theme Configuration

badgeTheme

Default theme configuration for the Badge component.

Type: BadgeTheme

Example:

import { useComponentTheme } from "tinky-theme";
import { badgeTheme } from "tinky-badge";

function CustomBadge({ color, children }) {
  const { styles } = useComponentTheme("Badge", badgeTheme, { color });

  return (
    <Box {...styles.container}>
      <Text {...styles.label}>{children}</Text>
    </Box>
  );
}

BadgeTheme

Type definition for the Badge theme configuration.

Example:

import type { BadgeTheme } from "tinky-badge";

const customTheme: BadgeTheme = {
  styles: {
    container: ({ color }) => ({
      backgroundColor: color,
      padding: 1,
    }),
    label: () => ({
      color: "white",
    }),
  },
};

Styling

The Badge component uses a theme-based styling system via tinky-theme.

Style Structure

{
  styles: {
    container: ({ color }) => ({ backgroundColor: color }),
    label: () => ({ color: "black" }),
  }
}

Custom Styling

You can customize the badge appearance by providing a custom theme:

import { useComponentTheme } from "tinky-theme";

const customTheme = {
  styles: {
    container: ({ color }) => ({
      backgroundColor: color,
      padding: 1,
      bold: true,
    }),
    label: () => ({
      color: "white",
      italic: true,
    }),
  },
};

function CustomBadge({ color, children }) {
  const { styles } = useComponentTheme("Badge", customTheme, { color });

  return (
    <Text {...styles.container}>
      {" "}
      <Text {...styles.label}>{children}</Text>
    </Text>
  );
}

Development

Setup

# Install dependencies
bun install

# Run tests
bun test

# Build the project
bun run build

# Lint code
bun run lint

# Generate documentation
bun run docs

Project Structure

tinky-badge/
├── src/
│   ├── components/
│   │   └── badge/
│   │       ├── badge.tsx      # Badge component implementation
│   │       └── index.ts       # Component re-exports
│   ├── themes/
│   │   └── badge-theme.tsx    # Theme configuration
│   └── index.ts               # Package exports
├── tests/
│   ├── badge.test.tsx         # Component tests
│   └── badge-theme.test.tsx   # Theme tests
├── docs/
│   └── api/                   # Generated API documentation
├── README.md
├── package.json
└── tsconfig.json

Related Packages

Acknowledgments

  • ink-ui - Inspiration for Badge component by Vadim Demedes

License

MIT © ByteLand Technology Limited