SVG
Utilities for styling the stroke of SVG elements.
Use the stroke-{color}
utilities to change the stroke color of an SVG.
<svg class="stroke-cyan-500 ...">
<!-- ... -->
</svg>
This can be useful for styling icon sets like Heroicons.
Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:stroke-cyan-700
to only apply the stroke-cyan-700
utility on hover.
<svg class="stroke-cyan-500 hover:stroke-cyan-700">
<!-- ... -->
</svg>
For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.
You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:stroke-cyan-700
to apply the stroke-cyan-700
utility at only medium screen sizes and above.
<svg class="stroke-cyan-500 md:stroke-cyan-700">
<!-- ... -->
</svg>
To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.
By default, Tailwind makes the entire default color palette available as stroke colors. You can customize your color palette by editing theme.colors
or theme.extend.colors
in your tailwind.config.js
file.
module.exports = {
theme: {
extend: {
colors: {
'regal-blue': '#243c5a',
},
}
}
}
Alternatively, you can customize just your stroke colors by editing theme.stroke
or theme.extend.stroke
in your tailwind.config.js
file.
Learn more about customizing the default theme in the theme customization documentation.
If you need to use a one-off stroke
value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value.
<svg class="stroke-[#243c5a]">
<!-- ... -->
</svg>
Learn more about arbitrary value support in the arbitrary values documentation.