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

@locktech/atomic-mixins

v0.4.5

Published

PostCSS mixins for Atomic UI components

Readme

Atomic: PostCSS Mixins

GitHub release Build and Publish Build and Deploy Storybook

atomic-mixins is a library providing PostCSS mixins to generate Atomic's UI components using TailwindCSS' utility-classes.

On this page:

Installation

0) Setting up TailwindCSS and PostCSS

Installing TailwindCSS and PostCSS is well beyond this document.

How you do so will largely depend upon your environment, libraries, and/or framework of choice.

1) Downloading the library

Downloading the library will depend upon your environment of choice. I'll be using Yarn below:

yarn add --dev @locktech/atomic-mixins

2) Setting up PostCSS plugins

To make getting started easier, Atomic takes care of ensuring the required PostCSS plugins are available through a single plugin of its own. These opinionations will be a down-stream benefit to your application: the plugins Atomic makes use of are fully available to you in your application's styling.

Plugins Atomic will provide you:

In addition to Atomic's plugin, you'll also need to add the tailwindcss/nesting plugin. All said and done, your postcss.config.js file should resemble:

// postcss.config.js
module.exports = {
  plugins: [
    // Notice how we've loaded them *before* Tailwind.
    require("@locktech/atomic-mixins/postcss"),
    require("tailwindcss/nesting"),
    require("tailwindcss"),
    require("autoprefixer"),
  ],
};

3) Importing Atomic's mixins

Finally, you'll need to @import Atomic's mixins into your application's CSS file - the same you've used to setup Tailwind.

Below I'm using Tailwind's @import syntax.

@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";

@import "@locktech/atomic/mixins";

/* Your styling... */

4) Use Atomic's TailwindCSS Preset (Optional)

Provided is Atomic's TailwindCSS preset, you may choose to use this in your project's tailwind.config.js file or not - its up to you.

module.exports = {
  presets: [require("@locktech/atomic-mixins/preset")],
  purge: [
    /* ... */
  ],
};

This preset will:

  • Configure TailwindCSS in JIT mode.
  • Enable dark mode, using the 'media' setting.
  • Add a spin animation
  • Add Atomic's gray color pallete.

Usage

Basic Use

Let's use the btn mixin as an example. It provides a call signature resembling:

@mixin btn $color;

To make use of this mixin, your class would invoke it as such:

Note: It is highly recommended you organize your custom-classes using Tailwind's @layer directive, to ensure any styling you don't use is not included in your final CSS.

.btn-red {
  @mixin btn red;
}

You are free to @apply any of Tailwind's classes to your own, customizing the mixin to your liking:

.btn-red-ghost-lg {
  @mixin btn red;
  @apply px-3 py-2; /* Increase the apparent size of our button */
  @apply bg-transparent; /* Remove the mixin's "resting" background. */
  @apply border-transparent; /* Remove the mixin's "resting" border. */
  @apply text-gray-900 dark:text-gray-50; /* Ensure our button's text contrasts our app's background. */
}

Nested Styling

Some components offer styling spread throughout many classes. These classes are often styled using Tailwind's nesting wrapper. Your customizations should, much like the classes themselves, be nested under the invocation of the mixin defining them.

Component's which provide this functionality will have a code-block in their documentation, highlighting how you may go about applying your customizations. For the purpose of demonstration, let's look at how you might go about customizing the 'menu-items' class - which is created when using the Menu mixin:

.menu {
  @mixin menu;

  & > .menu-items {
    @apply bg-gray-300;
  }
}

Extending Mixins

As the installation document would tell you, the plugins which power Atomic are available to you - this includes the mixin plugin.

Let's take advantage of it to extend one of Atomic's mixins to make our own, which we may reuse:

@define-mixin btn-raised $color {
  @mixin btn $color;
  @apply shadow hover:shadow-md active:shadow-sm;
}

.btn-raised-green {
  @mixin btn-raised green;
}

.btn-raised-red {
  @mixin btn-raised red;
}