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

@darehn/tailwind-qol

v0.1.5

Published

Additional utility classes for tailwindcss

Downloads

3

Readme

tailwind-qol

Additional utility classes for tailwindcss

Installation

yarn add -D @darehn/tailwind-qol

or

npm install -D @darehn/tailwind-qol

Usage

To include everything in this package, update the plugins array in tailwind.config.js.

plugins: [
    ...Object.values(require('@darehn/tailwind-qol')),
]

You can also include only the parts you need. The following example would only include the animations plugin.

plugins: [
    require('@darehn/tailwind-qol/animations'),
]

Size Plugin

The size plugin adds new classes to set the width and height of an element. You can use the same units that you are used to.

Usage

plugins: [
    require('@darehn/tailwind-qol/size'),
]

Example

Div with width and height set to 16 units (4rem)

<div class="s-16"></div>

Available Classes

  • s-{n}: Sets the width and height to the given size

Animation Plugin

The animations plugin adds new utility classes for animations. You can use this to alter the animation-duration and timing-function.

Usage

plugins: [
    require('@darehn/tailwind-qol/animations'),
]

Example

Here we change the duration of the animation to 1.5 seconds. We also set the timing-function to steps(8).

<svg class="animate-spin animation-duration-1500 animation-steps-8" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
    ...
</svg>

Available Classes

  • animation-duration-{n}: Sets the duration of the animation in ms.
  • animation-steps-{n}: Sets the timing-function to steps(n).
  • animation-linear
  • animation-ease
  • animation-ease-in
  • animation-ease-out
  • animation-ease-in-out
  • animation-bounce

Configuration

You can configure which values and variants are generated by this plugin under the animationDuration and animationStep keys in your tailwind.config.js file:

// tailwind.config.js
module.exports = {
    //...
    theme: {
        animationDuration: {
            250: '250ms',
            400: '400ms',
            1250: '1250ms',
        },
        animationStep: {
            3: '3',
            4: '4',
            5: '5',
        },
    }
}

Typography Plugin

The typography plugin adds the possibility to clamp the number of lines visible.

Usage

plugins: [
    require('@darehn/tailwind-qol/typography'),
]

Example

Limits the number of visible lines to 2.

<div class="clamp-lines-2">
    ...
</div>

Remove clamping on hover

<div class="clamp-lines-3 hover:clamp-lines-none">
    ...
</div>

Available Classes

  • clamp-lines-{n}: Clamp text to given number of lines (1 to 6 by default)
  • clamp-lines-none: Use this to remove clamping

Configuration

You can configure which values and variants are generated by this plugin under the clampLines key in your tailwind.config.js file:

// tailwind.config.js
module.exports = {
    //...
    theme: {
        clampLines: {
            2: '2',
            4: '4',
            8: '8'
        }
    }
}

Elevation Plugin

The elevation plugin adds material design style elevation utility classes. You can still use the regular tailwind shadow classes to change the color of the shadow.

Usage

plugins: [
    require('@darehn/tailwind-qol/elevation'),
]

Example

Div with an elevation level of 4.

<div class="shadow-4">
    ...
</div>

Div with an elevation level of 8 and red shadow.

<div class="shadow-8 shadow-red-700/20">
    ...
</div>

Available Classes

  • shadow-{n}: Sets the elevation level to the given value (between 0 and 24).

Layout Plugin

The layout plugin adds a few utilities to position elements.

Usage

plugins: [
	require('@darehn/tailwind-qol/layout'),
]

Example

Div with transparent black background that will overlay its parent

<div class="overlay bg-black/25">
	...
</div>

Div as a fixed overlay

<div class="overlay-fixed bg-black/25">
	...
</div>

Available Classes

  • overlay: Sets absolute position and inset to 0.
  • overlay-fixed: Sets fixed position and inset to 0.

Transition Plugin

The layout plugin adds a few utilities for transitions.

Usage

plugins: [
    require('@darehn/tailwind-qol/transition'),
]

Example

Div which will transition width and height

<div class="h-10 hover:h-20 transition-size">
	...
</div>

Div which will transition height with a bouncing easing function

<div class="h-10 hover:h-20 transition-height ease-bounce">
    ...
</div>

Available Classes

  • transition-width
  • transition-height
  • transition-size: width and height
  • transition-box: width, height, padding, border-width and margin
  • transition-text: color, text-decoration-color, font-size, font-weight, line-height and letter-spacing
  • ease-bounce