Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tailwindcss-plugin-icons

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tailwindcss-plugin-icons

Tailwind CSS icons with classes

  • 2.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
142
decreased by-21.11%
Maintainers
1
Weekly downloads
 
Created
Source

tailwindcss-plugin-icons

npm socket security example license

Tailwind CSS implementation of @unocss/preset-icons.

npm install tailwindcss-plugin-icons
pnpm add tailwindcss-plugin-icons
yarn add tailwindcss-plugin-icons

How to use

  1. Search the available icon sets at Icônes or Iconify and choose the icons your project needs.
  2. Install any required icon set with npm install @iconify-json/[the-icon-set-name].
  3. Configure the plugin in your tailwind.config file, for example, heroicons:
const { Icons } = require('tailwindcss-plugin-icons')

/**
 * @type {import('tailwindcss-plugin-icons').Options}
 */
const options = ({ theme }) => ({
  heroicons: {
    icons: {
      'plus-circle': {
        cursor: 'pointer',
        color: theme('colors.emerald.600'),
        '&:hover': {
          color: theme('colors.emerald.800')
        }
      },
      'trash?bg': {}
    },
    scale: 1.5,
    includeAll: true,
    location: 'https://esm.sh/@iconify-json/heroicons@1.1.6/icons.json'
  }
})

/**
 * @type {import('tailwindcss').Config}
 */
module.exports = {
  plugins: [Icons(options)]
}

The plugin's options are a function. It gets forwarded the Tailwind CSS plugin API and returns the selected icons with optional default style and scale. After the icon's name, you can pass ?bg or ?mask to force a specific render method. Finally, you can use includeAll: true to have every icon in the icon set added as a Tailwind source.

  1. Write icons with Tailwind CSS classes directly in your markup:
<div class="i-heroicons-plus-circle"></div>
<div class="bg-heroicons-trash-black"></div>

Comprehensive Example

Keywords

FAQs

Package last updated on 13 Feb 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc