Utilities for styling the stroke of SVG elements.
Use stroke-current
to set the stroke color of an SVG to the current text color. This makes it easy to set an element's stroke color by combining this class with an existing text color utility.
Useful for styling icon sets like Heroicons that are drawn entirely with strokes.
<svg class="stroke-current text-purple-600 ..."></svg>
Control which stroke utilities Tailwind generates by customizing the theme.stroke
section in your tailwind.config.js
file:
// tailwind.config.js
module.exports = {
theme: {
- stroke: {
- current: 'currentColor',
- }
+ stroke: theme => ({
+ 'red': theme('colors.red.500'),
+ 'green': theme('colors.green.500'),
+ 'blue': theme('colors.blue.500'),
+ })
}
}
By default, only responsive variants are generated for stroke utilities.
You can control which variants are generated for the stroke utilities by modifying the stroke
property in the variants
section of your tailwind.config.js
file.
For example, this config will also generate hover and focus variants:
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
+ stroke: ['hover', 'focus'],
}
}
}
If you don't plan to use the stroke utilities in your project, you can disable them entirely by setting the stroke
property to false
in the corePlugins
section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ stroke: false,
}
}