Utilities for styling the stroke width of SVG elements.
Use the stroke-{width} utilities to set the stroke width of an SVG.
Useful for styling icon sets like Heroicons that are drawn entirely with strokes.
<svg class="stroke-current stroke-1 text-green-600 ..."></svg>
<svg class="stroke-current stroke-2 text-green-600 ..."></svg>To control the stroke width of an SVG element at a specific breakpoint, add a {screen}: prefix to any existing width utility. For example, adding the class md:stroke-2 to an element would apply the stroke-2 utility at medium screen sizes and above.
<svg class="stroke-1 md:stroke-2 ...">
<!-- ... -->
</svg>For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.
Control which stroke-width utilities Tailwind generates by customizing the theme.strokeWidth section in your tailwind.config.js file:
// tailwind.config.js
module.exports = {
theme: {
extend: {
strokeWidth: {
+ '3': '3',
+ '4': '4',
}
}
}
}Learn more about customizing the default theme in the theme customization documentation.
By default, only responsive variants are generated for stroke-width utilities.
You can control which variants are generated for the stroke-width utilities by modifying the strokeWidth 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: {
// ...
+ strokeWidth: ['hover', 'focus'],
}
}
}If you don't plan to use the stroke-width utilities in your project, you can disable them entirely by setting the strokeWidth property to false in the corePlugins section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ strokeWidth: false,
}
}