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

tailwind-props

v0.1.5

Published

### [Storybook](https://tailwind-props.vercel.app/)

Readme

Tailwind Props

Storybook

React prop bindings for Tailwind Utility Classes

import { Box } from 'tailwind-props';

const Card = () => (
  <Box flex p={2} h={6}>
    Card Content
  </Box>
  // gets turned into
  <div className="flex p-2 h-6">
    Card Content
  </div>
)

Get Started

yarn install tailwind-props
# or
npm install tailwind-props

# Then install Tailwind dependencies, following these directions if needed:
# https://tailwindcss.com/docs/installation
yarn install tailwindcss

Usage

/* ./styles/index.css */
@tailwind base;
@tailwind components;
@tailwind utilities;
// in the root of your app, import your Tailwind styles:
import '../styles/index.css';
import { Box } from 'tailwind-props';

const NavItem = ({ children }) => (
  <Box block px={4} py={2} rounded="md" bg="amber-100" text="amber-700">
    {children}
  </Box>
)

const MenuButton = ({ children }) => (
  <Box as="button" font="sans" rounded="lg" bg="purple-100" textColor="purple-700" px={6} py={2}>
    Check Availability
  </Box>
)

Why does this exist?

While TailwindCSS on its own works perfectly well with React, there are a few ways it could be improved to better fit the React model.

Easier Composability

The biggest limitation of TailwindCSS on its own is that it relies entirely on strings for an element's class.

While you can extract styles within Tailwind, the common React pattern for this is using objects and defaults to compose similar elements.

// default TailwindCSS (without using @apply to extract)
const BaseButton = ({ className }) => (
  // string concatenation this way is more fragile than merging objects and will also cause duplicate classNames to be added
  <button className={`px-5 py-3 rounded-md text-white bg-indigo-600 ${className}`}>
    Primary Button
  </button>
)

const SecondaryButton = () => (
  <BaseButton className="text-indigo-600 bg-white border border-indigo-600">
    Secondary Button
  </BaseButton>
)


// Using Tailwind Props
const BaseButton = (props) => (
  // pass down all props to allow additional styles to be merged in
  <Button px={5} py={3} rounded="md" text="white" bg="indigo-600" {...props}>
    Primary Button
  </Button>
)

const SecondaryButton = () => (
  // pass down props to override base button styles
  <BaseButton text="indigo-600" bg="white" border="indigo-600" >
    Secondary Button
  </BaseButton>
)

Simplifying Syntax

Since we're (currently) stuck typing out className in React, it can make tailwind a bit clunkier.

By mapping out Tailwind utilities to props, we can simplify the syntax a good amount:

// vanilla tailwind
<button className="px-5 py-3 rounded-md">
  Click Here
</button>
// Tailwind Props
<Button px={5} py={3} rounded="md">
  Click Here
</Button>

Typescript

TO DO:

(From Highest to Lowest Priority)

Figure out approach for pseudo classes / states (:hover, :active, :disabled) and responsive styles

Create custom PurgeCSS Extractor to optimize for production

Will require a custom PurgeCSS extractor / function

Remaining Props:

  • [X] Color Utilities
  • [X] Text Color
  • [X] Background Color
  • [X] Font Family
  • [X] Font Weight
  • [x] Text Align
  • [ ] Alignment (justify-content, align-items)
  • [ ] Text Transform
  • [ ] Border Width
  • [ ] Border Color
  • [ ] Border Radius
  • [ ] Box Shadow
  • [ ] Cursor
  • [ ] Container