Tailwind Plugin generating triangle arrows for tooltip-ish divs
Description
This plugin generates styles for CSS based triangle arrows with configurable border and background via ::after
pseudo-elements.
Installation
Add this plugin to your project:
# Install via npm npm install --save-dev tailwindcss-tooltip-arrow-after
Usage
The plugin configuration accepts multiple objects where each key defines a class suffix for a arrow name. This options should be defined in 'theme.tooltipArrows' key in tailwind.config.js
moduleexports = //... theme: 'danger-arrow': borderColor: borderWidth: 1 backgroundColor: size: 10 offset: 10 //...
borderColor
: border colorborderWidth
: border width (in pixels) e.g.1
backgroundColor
: background colorsize
: size (in pixels)offset
: offset (from left to right for top and bottom arrows and from top to bottom for left and right ones)
Here is the example for adding it to your project plugins
moduleexports = // ... plugins: // ...
This configuration would generate classes for all four direction variants of arrows:
danger-arrow-top
danger-arrow-right
danger-arrow-bottom
danger-arrow-left
Example for danger-error-top
styles:
You can use it in your html
TOP ARROW RIGHT ARROW BOTTOM ARROW LEFT ARROW