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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@akocan98/out-click-for-tailwind

v1.0.5

Published

Utility classes for 'out-click' effect

Downloads

15

Readme

Out-click for Tailwind

This is a plugin for Tailwind which introduces a configurable 'out-click' animation.

It's really difficult to neatly specify different duration timings for different CSS properties with Tailwind, but that's what is needed for this effect. Instead of adding custom CSS to the project I decided to wrap this into a plugin so that you can rely on Tailwind to purge out unused classes, easily extend them and benefit from all the support Tailwind has integrated into most IDE's.

This is the what the effect looks like:

Usage

Include the plugin in tailwind.config.js

const outclick = require('@akocan98/out-click-for-tailwind');

module.exports = {
    // ...
    plugins: [ 
        outclick,
        //...
    ],
    
};

Minimal example

<div class="out-click-200"> 
    Hello World
</div>

Different colored out-click effect

You can tweak the colors of the out-click effect by specifying the active:bg-color and active:outline-color utility classes (or through other means, if necessary).

An example of this:

<div class="out-click-200 active:bg-red-400/10 active:outline-red-400/10">
    Hello, world
</div>

Adding an additional variation

You can add additional variations to specify your own transition durations. They are specified in tailwind.config.js, as such:

const outClick = require('@akocan98/out-click-for-tailwind');

module.exports = {
    theme: {
        extend: {
            outClick: {
                999: {
                    background: '333ms',
                    outline: '666ms',
                },
                123: {
                    background: '123ms',
                    outline: '321ms',
                }
            }
        }
    },
    plugins: [outClick],
    // ...
}

this will generate additional utility classes (if they are also used in your markup):

<div class="out-click-999">
    Hello, world
</div>
<div class="out-click-321">
    Hello, world
</div>

As expected, you can use all of the generated utility classes in your CSS as well

// ...
@tailwind components;

@layer components {
    .red-out-click {
        @apply out-click-200 active:bg-red-300 active:outline-red-300;
    }
}
// ...

Example of different colours for light and dark mode:

<div class="out-click-200 active:bg-red-400/10 active:outline-red-400/10 dark:active:bg-purple-400/10 dark:active:outline-purple-400/10">
    Hello, world
</div>

Full example (Tailwind CSS & React.js)

<>
    <div className={'p-20 bg-white dark:bg-black'}>
        <div
            className={
                'w-14 h-14 rounded-full out-click-200 active:bg-gray-300 dark:active:bg-white/20 active:outline-gray-300 dark:active:outline-white/20 flex justify-center items-center cursor-pointer'
            }>
            <svg
                xmlns="http://www.w3.org/2000/svg"
                className="h-6 w-6"
                fill="none"
                viewBox="0 0 24 24"
                stroke="white"
                stroke-width="2">
                <path stroke-linecap="round" stroke-linejoin="round" d="M13 5l7 7-7 7M5 5l7 7-7 7" />
            </svg>
        </div>
    </div>
</>