Socket
Socket
Sign inDemoInstall

tailwindcss-counter

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    tailwindcss-counter

Tailwind CSS plugin to generate counter utilities


Version published
Weekly downloads
241
decreased by-49.16%
Maintainers
1
Install size
124 kB
Created
Weekly downloads
 

Readme

Source

tailwindcss-counter

Tailwind CSS plugin to generate counter utilities

Installation

npm i tailwindcss-counter

Usage

// tailwind.config.js
module.exports = {
  theme: {},
  variants: {},
  plugins: [
    require('tailwindcss-counter')(),
    // Or if you want to set your own counter name:
    // require('tailwindcss-counter')({
    //   counterName: 'yourUniqueCounterName'
    // }),
  ],
};

This plugin generates the following utilities:

.counter-reset {
  counter-reset: uniqueCounterName
}
.counter-increment {
  counter-increment: uniqueCounterName 1
}
.counter-decrement {
  counter-increment: uniqueCounterName -1
}
.counter-result {
  content: counter(uniqueCounterName)
}
.after\:counter-result::after {
  content: counter(uniqueCounterName)
}
.before\:counter-result::before {
  content: counter(uniqueCounterName)
}

which you can use in your HTML like so:

<div class="counter-reset">
  <div class="after:counter-result">Initial: </div>
  <div class="counter-increment after:counter-result">Incremented: </div>
  <div class="counter-increment after:counter-result">Incremented: </div>
  <div class="counter-increment after:counter-result">Incremented: </div>
  <div class="counter-decrement after:counter-result">Decremented: </div>
  <div class="counter-decrement after:counter-result">Decremented: </div>
  <div class="counter-decrement after:counter-result">Decremented: </div>
  <div class="before:counter-result"> is a result</div>
</div>

Demo

Take a look

Screenshot of the demo

Keywords

FAQs

Last updated on 13 Dec 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc