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

@choice-ui/badge

v0.0.4

Published

A badge component for displaying labels, counts, or status indicators

Downloads

237

Readme

Badge

A compact label component for displaying status, categories, or counts. Supports multiple visual variants with strong and subtle styling options.

Import

import { Badge } from "@choice-ui/react"

Features

  • Multiple semantic variants (default, brand, inverted, component, success, warning, error)
  • Strong and subtle styling modes
  • Automatic padding adjustment for icons
  • Inline display for text flow integration
  • Consistent height and rounded corners
  • Support for icons and multiple child elements

Usage

Basic

<Badge>Default</Badge>
<Badge variant="brand">Brand</Badge>
<Badge variant="success">Success</Badge>

Strong vs Subtle

// Subtle (default)
<Badge variant="warning">Warning</Badge>

// Strong
<Badge variant="warning" strong>Warning</Badge>

Variants

<Badge variant="default">Default</Badge>
<Badge variant="brand">Brand</Badge>
<Badge variant="inverted">Inverted</Badge>
<Badge variant="component">Component</Badge>
<Badge variant="success">Success</Badge>
<Badge variant="warning">Warning</Badge>
<Badge variant="error">Error</Badge>

With Icons

import { CheckSmall } from "@choiceform/icons-react"
;<Badge variant="success">
  <CheckSmall className="mr-0.5" />
  Completed
</Badge>

Props

interface BadgeProps extends Omit<HTMLProps<HTMLDivElement>, "size"> {
  /** Visual variant of the badge */
  variant?: "default" | "brand" | "inverted" | "component" | "success" | "warning" | "error"

  /** Use strong styling (filled background) instead of subtle */
  strong?: boolean
}
  • Defaults:
    • variant: "default"
    • strong: false

Styling

  • Fixed height of 16px (h-4)
  • Rounded corners (rounded-md)
  • Inline-flex display for proper text alignment
  • Automatic padding adjustment:
    • Single element: horizontal padding (px-1)
    • Multiple elements: right padding only (pr-1) to accommodate icons

Variants Guide

  • default: Neutral gray styling for general information
  • brand: Uses accent color for brand-related content
  • inverted: High contrast for emphasis
  • component: Purple styling for UI component references
  • success: Green for positive states or completion
  • warning: Yellow/amber for cautions or warnings
  • error: Red for errors or critical information

Best Practices

  • Use semantic variants to convey meaning
  • Keep badge text short and concise
  • Use strong mode sparingly for important states
  • Combine with icons for better visual recognition
  • Group related badges with consistent styling

Examples

Status Indicators

<div className="flex gap-2">
  <Badge
    variant="success"
    strong
  >
    Active
  </Badge>
  <Badge variant="warning">Pending</Badge>
  <Badge variant="error">Failed</Badge>
  <Badge>Draft</Badge>
</div>

With Icons

<div className="flex gap-2">
  <Badge variant="success">
    <CheckSmall className="mr-0.5" />
    Verified
  </Badge>
  <Badge variant="warning">
    <AlertSmall className="mr-0.5" />
    Review Required
  </Badge>
</div>

Categories

<div className="flex flex-wrap gap-1">
  <Badge variant="component">Button</Badge>
  <Badge variant="component">Input</Badge>
  <Badge variant="component">Modal</Badge>
</div>

Inline Usage

<p>
  This feature is{" "}
  <Badge
    variant="brand"
    strong
  >
    New
  </Badge>{" "}
  and requires <Badge variant="warning">Beta Access</Badge> to use.
</p>

Notes

  • Badges are inline-flex elements that flow with text
  • The component automatically detects multiple children for proper spacing
  • All native div props are supported except size
  • Background and text colors adjust based on variant and strong mode