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

responsive-classnames

v0.1.5

Published

Use responsive props inspired by [Styled System] for components that using your [Tailwind CSS] class names.

Downloads

10

Readme

Responsive Class Names (aka rcx)

Use responsive props inspired by Styled System for components that using your Tailwind CSS class names.

Install

Use your choice of NPM client to install the package:

$ yarn add responsive-classnames
# or
$ npm install responsive-classnames

Getting Started

To get started you will need supply an array of your breakpoint keys (e.g. sm, md, lg, etc.) to the createResponsiveClassNames function.

import {createResponsiveClassNames} from 'responsive-classnames';

const rcx = createResponsiveClassNames(tailwind.screens);

This creates your own responsive class names function for you. You can call it whatever you’d like, but something short and sweet like rcx will probably serve you best.

Usage

rcx is designed for the className prop. It is used as a tagged template. The string literal you use is the template for the class names it will create. The expression passed can be a numeric value, an array of numeric values, or an object with keys corresponding to your breakpoints.

import cx from 'classnames';

const Stack = ({as: AsElement = 'div', space, ...props}) => (
  <AsElement
    className={cx('flex flex-col', rcx`space-y-${space}`)} 
    {...props} 
  />
);

<Stack as="ul" space={[2, 4, 6]}>
  <li>Item 1</li>
  <li>Item 2</li>
  <li>Item 3</li>
</Stack>

<Stack space={{default: 2, md: 4}}>
  <Card />
  <Card />
  <Card />
</Stack>

Limitations

The following are some technical limitations of this package. I plan to address these in the future.

Only one expression allowed in template

Currently, the tagged template only takes a single expression (e.g. space-y-${space})

Purgecss

If your use Purgecss with Tailwind then you are probably quite aware that you are told to avoid string concatenation. This is problematic if you plan to use this package. Currently, I have a Babel plugin in development that will analyze your React project’s source code for string concatenations in className props, find values from usages of those components, then create a whitelist of compiled class names for Purgecss to use. My early findings are proving to be effective. Please create an issue if your are interested in taking a look at how this works so far.

Disclaimer

responsive-classnames is not meant to replace packages like classnames, but to be used in tandem with them.

Contributing

Contributions are welcome. Please make an issue first unless it’s something small.