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

twux

v1.0.4

Published

Twux is a simple and powerful way to build re-usable type-safe React components with Tailwind in a 2.5 KB library.

Readme

Tailwind User Experience

Twux is a simple and powerful way to build re-usable type-safe React components with Tailwind in a 2.5 KB library.

See the Twux Documentation and Website to learn more.

Basic Usage

import { twux } from "twux";

const Button = twux("text-white bg-blue-500", "button");

Example 1:

<Button>
  Click me!
</Button>

// Outputs

<button className="text-white bg-blue-500">
  Click me!
</button>

Example 2:

<Button className="bg-red-500">
  Click me!
</Button>

// Outputs

<button className="text-white bg-red-500">
  Click me!
</button>

Variants

Twux supports variants of components by providing an object as the second argument.

const VariantButton = twux(
  "text-white p-2 rounded",
  {
    // color variant with two options
    color: {
      primary: "bg-blue-500",
      gray: "bg-gray-500",
    },
    // size variant with three options
    size: {
      sm: "text-sm",
      md: "text-base",
      lg: "text-lg",
    },
  },
  "button"
);

Example 1:

<VariantButton color="primary" size="md">
  Medium Primary Button
</VariantButton>

// Outputs

<button className="bg-blue-500 text-base">
  Medium Primary Button
</button>

Example 2:

<VariantButton color="gray" size="sm">
  Small Gray Button
</VariantButton>

// Outputs

<button className="bg-gray-500 text-sm">
  Small Gray Button
</button>

Twux also support default values for variants.

Boolean Variants

Twux also supports boolean variants by providing a string value for each variant instead of an object.

const BooleanButton = twux(
  "text-white p-2 rounded bg-blue-500",
  {
    bold: "font-bold",
    italic: "italic",
  },
  "button"
);

Example 1:

<BooleanButton bold>
  Bold Button
</BooleanButton>

// Outputs

<button className="font-bold">
  Bold Button
</button>

Example 2:

<BooleanButton italic>
  Italic Button
</BooleanButton>

// Outputs

<button className="italic">
  Bold Button
</button>

Note: Boolean variants and option variants can be mixed and matched.

Function Components

Twux can be used with function components by passing a function as the final argument.

import { twux } from "twux";
 
const Chip = twux(
  "text-xs bg-orange-600 text-white rounded-full px-2 py-1 inline-block",
  ({ className, text }: { className: string; text: string }) => {
    return <span className={className}>{text}</span>;
  }
);

Example:

<Chip text="This is a chip" />

// Outputs

<span className="text-xs bg-orange-600 text-white rounded-full px-2 py-1 inline-block">
  This is a chip
</span>

Documentation

Read the Twux documentation to learn more about