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

@qpokychuk/tailwind-button-plugin

v4.0.3

Published

buttons components for tailwind

Readme

🧩 Buttons Plugin for Tailwind CSS

Tailwind CSS плагин для создания настраиваемых кнопок с поддержкой темизации, вариантов, размеров, состояний и утилит.

Преимущества плагина

✅ Работает из коробки: всего один класс btn 🎨 Полная тема: цвета, размеры, варианты ⚙️ Конфигурация и кастомизация 🎯 Target-селекторы: hover/focus от родителей и peer 🛠️ Создан для Tailwind CSS, дружит с утилитами


🚀 Установка

Установите плагин через NPM:

npm install @qpokychuk/tailwind-button-plugin --save-dev

Добавьте его в ваш tailwind.config.js:

// tailwind.config.js
module.exports = {
  plugins: [
    require('@qpokychuk/tailwind-button-plugin'),
  ],
};

⚙️ Базовое использование

Примените базовый класс btn, затем добавьте дополнительные модификаторы для настройки внешнего вида:

<button class="btn">text here</button>

🎨 Цвет кнопки

Настройте цвет кнопки с помощью утилиты btn-{color} — где color соответствует вашей теме Tailwind:

<button class="btn btn-indigo">text here</button>
<button class="btn btn-blue">text here</button>
<button class="btn btn-red">text here</button>

Для произвольного значения цвета используйте квадратные скобки:

<button class="btn btn-[#B33771]">text here</button>

Цвета кнопок


🧩 Варианты кнопок

Поддерживаются следующие варианты: fill | contur | light | text

<button class="btn">text here</button> <!-- По умолчанию: fill -->
<button class="btn btn-contur">text here</button>
<button class="btn btn-light">text here</button>
<button class="btn btn-text">text here</button>

💡 Также доступны: whitebg, icon — для специальных случаев.

Варианты кнопок


📏 Размер кнопки

Выберите размер с помощью btn-{size}:

<button class="btn btn-xs">text here</button>
<button class="btn btn-sm">text here</button>
<button class="btn btn-base">text here</button> <!-- По умолчанию -->
<button class="btn btn-lg">text here</button>
<button class="btn btn-xl">text here</button>
<button class="btn btn-2xl">text here</button>

Кастомные размеры:

<button class="btn btn-[50px]">text here</button>

Размеры кнопок


🛠️ Модификаторы

Используйте стандартные Tailwind модификаторы:

<button class="btn btn-sm md:btn-lg">
  Adaptive Button
</button>
<button class="btn btn-blue-300 dark:btn-blue-500">
  Support dark mode
</button>
<button class="btn btn-red hover:btn-green">
  Custom hover
</button>

🌀 Закругление

Используйте стандартные Tailwind-утилиты rounded:

<button class="btn rounded">text here</button>
<button class="btn rounded-xl">text here</button>
<button class="btn rounded-full">text here</button>

Закругления


🌑 Тени

Применяйте стандартные Tailwind-утилиты shadow:

<button class="btn shadow-md hover:shadow-xl active:shadow-md">text here</button>

Тени


👨‍👧 Target-селекторы

Чтобы эффекты наведения, фокуса и клика работали при взаимодействии с родительским или соседним элементом:

<a class="absolute inset-0 flex btn-group">
  <button class="btn m-auto">text here</button>
</a>

<a class="absolute inset-0 flex btn-peer">text here</a>
...
<button class="btn m-auto">icon</button>

🛠 Расширение темы

Вы можете переопределить или расширить размеры кнопок:

// tailwind.config.js
module.exports = {
  theme: {
    btnSize: {
      xs: '28px',
      sm: '32px',
      base: '42px',
      lg: '48px',
      xl: '56px',
      ['2xl']: '64px',
    },
  },
};

🧪 Конфигурация плагина

Вы можете настроить поведение плагина, передав объект опций:

// tailwind.config.js
plugins: [
  require('@qpokychuk/tailwind-button-plugin')({
    className: 'btn',
    baseStyles: {},
    colorHoverOffset: 15,
    lightColorOpacity: 0.1,
    lightColorOpacityHover: 0.2,
    withFocusStyles: false,
    targetGroupSelector: '.btn-group',
    targetPeerSelector: '.btn-peer',
    hoverStyles: {
      background: 'var(--tw-btn-color-light)',
    },
    focusStyles: {
      zIndex: '2',
    },
    activeStyles: {
      transform: 'translateY(2px)',
    },
    disabledStyles: {
      opacity: '0.4',
      pointerEvents: 'none',
    },
  }),
]

| Параметр | Значение по умолчанию | Описание | |---------------------------|---------------------------------------|----------| | className | 'btn' | Базовый класс для кнопок | | baseStyles | {} | Базовые стили, которые переопределяют дефолтные | | colorHoverOffset | 15 | Смещение цвета при наведении (можно отрицательное) | | lightColorOpacity | 0.1 | Прозрачность цвета в варианте light | | lightColorOpacityHover | 0.2 | Прозрачность при hover в варианте light | | withFocusStyles | false | Добавлять ли стили при фокусе | | targetGroupSelector | '.btn-group' | Селектор для наследования состояний от родителя | | targetPeerSelector | '.btn-peer' | Селектор для наследования состояний от соседа | | hoverStyles | { background: 'var(--tw-btn-color-light)' } | Стили при hover | | focusStyles | { zIndex: '2' } | Стили при focus | | activeStyles | { transform: 'translateY(2px)' } | Стили при active | | disabledStyles | { opacity: '0.4', pointerEvents: 'none' } | Стили для disabled состояния |


🔗 Полезные ссылки