Tailwind svg stroke color. このページでは、Tailwind CSSを使用してSVGのストローク幅を設定する方法について説明しています。 Jun 21, 2016 · Issue 1 I'm trying to change the stroke color of an inline svg on hover. In this example, we will create two SVG elements and apply stroke colors to them using Tailwind CSS SVG stroke color classes. colors in your tailwind. Jan 5, 2022 · What operating system are you using? macOS Describe your issue with tailwindcss v2. Jul 23, 2025 · As it is XML-based, you can easily edit or change the SVG icon colors with Tailwind. In the following example, we will create an SVG element and set a condition to change its stroke color on hover. Jul 23, 2025 · Stroke Width of an SVG Element is a key property that defines the thickness of the outline for shapes like circles, rectangles, and paths. This is the most frequent issue! You apply a Tailwind class like fill-red-500 Usage Use fill-current to set the fill color of an SVG to the current text color. Beautiful hand-crafted SVG icons, by the makers of Tailwind CSS. Usage Use . It is the stroke class to be applied to the SVG element. This will change the svg color to #E53E3E. These utilities are great for basic line thicknesses, but they don't cover a continuous range of values, such as 0. Useful for styling icon sets like Zondicons that are drawn entirely with fills. You can customize these values by editing theme. Examples Basic example Use rotate-<number> utilities like rotate-45 and rotate-90 to rotate an element by degrees: Dec 1, 2020 · Learn how to change SVG color fill on hover using Tailwind CSS with practical examples and expert advice from the Stack Overflow community. Building complex components from a constrained set of primitive utilities. 5 Jan 25, 2022 · With the recent addition of fill-* and stroke-* classes, it would be great if more SVG properties were added to Tailwind. 5, 1. css ou app web. Jul 23, 2025 · This class accepts lots of value in tailwind CSS in which all the properties are covered in form. Jan 7, 2023 · Tailwind classes do not work outside of the class context. Unfortunately it's not possible for me to change the icon color. Using custom values Customizing your theme By default, Tailwind makes the entire default color palette available as stroke colors. Approach: You can simply customize the class of SVG by adding text-colo r or background-color in icons, but in this process, you have to carefully use the utilities for styling the SVG like fill and stroke in Tailwind CSS. Jan 21, 2022 · For some reason setting color: #ffffff in CSS doesn't apply to my SVG. Check out all other Tailwind CSS classes and examples on how to use them in our Tailscan Library. SVG stroke 用于样式化 SVG 元素的描边工具。 Using custom values Customizing your theme By default, Tailwind makes the entire default color palette available as stroke colors. Stroke color Use . SVG stroke Attribute The stroke attribute defines the color of the outline of an element. Responsive To control the stroke width of an SVG element at a specific breakpoint, add a {screen}: prefix to any existing width utility. Mar 16, 2026 · senior-webdesign // VocÊ é um Webdesigner Sênior especializado em HTML5, Tailwind CSS e JavaScript moderno. Jul 17, 2023 · I think the second path is a border around the ThumbsUp, so if you use fill it'll fill all the area with the color you want but that covers the wrist too. stroke-1 Feb 8, 2026 · 」っていうお悩み。 SVGファイルの中に、最初から stroke="#000000" みたいな色指定が直接書き込まれていると、Tailwind のクラスよりもそっちが優先されちゃうことがあるのよ。 頑固な男と一緒ね、なかなか上書きさせてくれないの。 Aug 19, 2024 · Besides, we can also pass regular properties such as stroke, fill, width and height of the <svg> to the Heroicon, which is assigned to the <svg> element. , stroke-0, stroke-1, stroke-2). Use the stroke-current utility to set the stroke color to the current text color: Complete Tailwind CSS fill and stroke utilities for SVG styling. This makes it easy to set an element's stroke color by combining this class with an existing text color utility. Mar 13, 2021 · I have seen @adamwathan 's live streams & he does className="w-5 h-5 text-white" fill="currentColor" to style an SVG through Tailwind. Useful for styling icon sets like Heroicons that are drawn entirely with strokes. This makes it easy to set an element’s stroke color by combining this class with an existing text color utility. <heroicon : type = "desktop-computer" :color= "text-white" class = "w-auto h-6 mr-3" /> For each color in colors config of tailwind a stroke- {color} class is created, analog to bg- and text- classes. config. In CSS, we used Stroke Property. js file. Using variants to style your site in dark mode. Stroke Width classes: stroke-0: This class set the stroke width to zero. g. In this post, we use Heroicons with both TailwindCSS and non-Tailwind classes. ai 🎯 FULL RECREATION PROMPTCreate a SaaS landing page hero section with the following exact specifications:Page LayoutThe entire page is h-screen flex flex-col bg-background overflow-hidden — the Navbar + Hero fill exactly 100vh with no scroll. Using custom values Customizing your theme By default, Tailwind makes the entire default color palette available as fill colors. Simply added fill-current text-red-600. Fill colors, stroke colors, stroke widths with interactive examples. This is because Tailwind's stroke- utilities are designed for specific, predefined values (e. Jan 15, 2026 · The stroke utility class in Tailwind CSS allows you to specify the color of strokes applied to SVG elements. In Tailwind CSS, adjusting the stroke width is simple and can be done using utility classes. Some properties I reach for often which would be a good start (instead of h Tailwind lets you conditionally apply utility classes in different states using variant modifiers. Tailwind CSS offers a range of utility classes to simplify working with the stroke property, enabling developers to apply consistent and reusable stroke styles for SVGs effortlessly. extend. By replacing that hex code with currentColor, the SVG is forced to inherit the text color of its parent element. On the other hand, if you use stroke, it only changes the color of the border and will not fill it with your color. The following example shows my problem, I want the icon's background to be red and the icon's color to be blue. 19, changing the svg color was working fine, using eg: "fill-current text-green-600" as in the docs. Additionally, discover the use cases of animated SVGs. Jul 19, 2020 · We can adjust three other aspects of the SVG with Tailwind utilities: fill color, stroke color, and stroke width. Basic usage Setting the stroke color Use the stroke-{color} utilities to change the stroke color of an SVG. 0. Looking at my source the class does have stroke-color-cyan-500, but the line is invisible unless I put a color in style statement. Stroke Classes: stroke-current: This class is used to set the stroke color of an SVG to the current text color. You can customize your color palette by editing theme. Feb 28, 2026 · Comprehensive Tailwind CSS utility-first styling patterns including responsive design, layout utilities, flexbox, grid, spacing, typ by MassimilianoPili Usage Use stroke-current to set the stroke color of an SVG to the current text color. Jul 4, 2023 · Learn how to create SVG animations using Tailwind CSS. SVG stroke 用于设置 SVG 元素描边样式的工具。 Oct 12, 2025 · Learn how to use stroke linecap in Tailwind CSS v4 to style SVG elements. Access ALL prompts for stunning animated websites in one click: motionsites. Use a free and open-source set of SVG icons built for Tailwind CSS and the Flowbite UI component library featuring hundreds of solid and outline styles 使用 使用 stroke-current 将 SVG 的 stroke 颜色设置为当前的文本颜色。通过将该类与现有的 文本颜色功能类 相结合,可以轻松设置元素的 stroke 颜色。 对于像 Heroicons 这样完全用 stroke 绘制的图标集很有用。 Basic usage Setting the stroke color Use the stroke-* utilities to change the stroke color of an SVG. Browse and search all Tailwind utility classes or CSS properties on one page. This makes it easy to set an element’s fill color by combining this class with an existing text color utility. Utilities for styling the stroke width of SVG elements. Discover the different options and how to apply them in your projects. This property can only be applied to elements that have a shape or text content elements. For example, adding the class md:stroke-2 to an element would apply the stroke-2 utility at medium screen sizes and above. stroke-current and . Setting the stroke color Use the stroke- {color} utilities to change the stroke color of an SVG. stroke-current with source code and live preview. Sep 12, 2022 · By default, Tailwind makes the entire default color palette available as stroke colors. Check the color palette Learn how to use icons and SVG elements in Tailwind CSS projects. Tailwind CSS Text Stroke Plugin Add custom text stroke utilities to your Tailwind CSS project using this plugin. It's a path exported from Illustrator and put through Peter Collingridge's SVG optimiser. I wanted to apply a stroke-dasharray styling to a <circle> element using tailwind classes but after some researching, it seems tailwind does not provide any classes to style those attributes as can be seen in this discussion on the tailwind github repo. Using and customizing the color palette in Tailwind CSS projects. If an SVG has a hardcoded color like fill="#FF0000", the icon will always be red, even if you hover over it. Tailwind provides a range of built-in classes, along with the flexibility to use arbitrary values, enabling precise control over stroke thickness for SVG elements Find the best landing pages for your design inspiration based on your preference Style SVGs effortlessly with Tailwind CSS utilities for fill, stroke, and stroke-width, ensuring flexible, accessible, and theme-consistent designs across projects. When declared, the CSS value overrides any value of the element's stroke SVG attribute. README Tailwind CSS Text Indent Plugin This plugin adds utilities to use text-fill, text-stroke and paint-order with Tailwind CSS. 6 days ago · The stroke CSS property defines the color or SVG paint server used to draw an element's stroke. Flowbite SVG Icons Flowbite Icons is a free and open-source collection of premium SVG icons built for the Tailwind CSS, Figma and the Flowbite Ecosystem. The page uses two Google Fonts imported via CSS: Instrument Serif Cheat sheet to learn Tailwind CSS quickly. Nov 18, 2022 · By default, Tailwind makes the entire default color palette available as stroke colors. The value of the stroke attribute can be a color name, rgb value or a hex value. Tailwind CSS SVG Stroke Width - Learn how to effectively manage SVG stroke width using Tailwind CSS with practical examples and best practices. Aug 15, 2024 · I'm using tailwind for styling in my React project. Use esta skill SEMPRE que o usuário pedir site, página web, landing page, dashboard, componente HTML, interface web, layout, template, portfólio, e-commerce, blog, painel admin, ou qualquer deliverable que seja um arquivo . In CSS, we did that by using the CSS Stroke-width property. This is crucial for building modern, interactive buttons in UI frameworks like Tailwind CSS. stroke-current to set the stroke color of an SVG to the current text color. As such, stroke only has an effect on elements that can be given a stroke (for example, <rect> or <ellipse>); see the page on the SVG stroke attribute for a complete list. strokeWidth in your tailwind. fill-current, and the colors are implemented using text color classes. Jun 7, 2025 · Fills and strokes Previous Next There are several ways to color shapes (including specifying attributes on the object) using inline CSS, an embedded CSS section, or an external CSS file. Most SVG you'll find around the web use inline CSS, but there are advantages and disadvantages associated with each type. With Tailwind's stroke class, you can easily define the stroke color to achieve the desired visual effect. This guide outlines the core usages, conditional applications, customization techniques, and more when working with Tailwind's fill utilities. Esta skill DEVE ser ativada para Usage Use stroke-current to set the stroke color of an SVG to the current text color. Using utilities to style elements on hover, focus, and more. Jun 2, 2020 · 0 In Tailwind, there is no text-white-500 it's just text-white. Utilities for styling the stroke of SVG elements. Tailwind CSS Stroke The stroke property is primarily associated with SVG elements to define the outline color for visual elements such as shapes, lines, and text. Use utilities like stroke-indigo-500 and stroke-lime-600 to change the stroke color of an SVG: This can be useful for styling icon sets like Heroicons. Here we use the stroke attribute to set the outline Oct 15, 2020 · This is awesome - thanks @tsdexter! I have just used this and adapted slightly to use the gradient on the stroke rather than fill. Jul 6, 2023 · Master SVG color manipulation with Tailwind CSS. Utilities for styling and customizing the fill of SVG elements using Tailwind CSS. So far you are doing it right by using fill-current. 1. When you're working with SVGs in Tailwind CSS, you might notice that the standard utility classes for stroke-width don't always apply as expected. Tailwind CSS provides fill-color-value utilities to add fill to the SVGs. Jul 23, 2025 · This class accepts lots of value in tailwind CSS in which all the properties are covered in class form. Oct 4, 2020 · I downloaded the svg files and assign the path to the svg to the image's src tag. Learn fill, stroke, and advanced techniques for dynamic icons. Complete guide with examples and troubleshooting tips. The stroke attribute can be used with the following SVG elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textPath>, <tref> and <tspan>. colors or theme. html, . With Tailwind's stroke-width class, you can easily adjust the thickness of strokes to achieve the desired visual effect. Jun 24, 2022 · I wanna ask something about how to change stroke color when button was hovered in tailwind, so I already made this code like this: Utilities for styling the stroke width of SVG elements. Oct 29, 2023 · これにより SVG の色は CSS や Tailwind CSS の text-color クラスで動的に制御できるようになります。 fill: SVG の内部を塗りつぶす色を指定。 stroke: SVG のアウトラインの色を指定。 Borders border-color Utilities for controlling the color of an element's borders. Hi, using tailwind 3. For example, use hover:stroke-2 to only apply the stroke-2 utility on hover. You can configure the size, color, and stroke width via Tailwind CSS and our configurator tool and you can also import them in Aug 5, 2023 · In such cases, the stroke-{color} class should be used. Stroke is a set of Tailwind CSS classes. To make a proper SVG icon styled with Tailwind remove the stroke , fill and stroke-width attributes and use proper TailwindCSS utility classes instead: Learn how to manage stroke width in Tailwind CSS with utility classes, responsive design, user states, and customization for scalable, refined web design. Neiter the fill or stroke actions do something but when i write text-slate-900 it changes the color of the icon. strokeWidth or theme. Hover, focus, and other states Tailwind lets you conditionally apply utility classes in different states using variant modifiers. Aug 26, 2022 · I am using react + tailwindcss v3, but I am unable to figure out how could I change the SVG stroke color on hover of its parent element. Mar 4, 2026 · Provides comprehensive Tailwind CSS utility-first styling patterns including responsive design, layout utilities, flexbox, grid, 1 stars | by Mischio95 Usage Use stroke-current to set the stroke color of an SVG to the current text color. You can copy our examples and paste them into your project! Feb 11, 2020 · Currently for SVGs, the only possible classes for fill and stroke are . How can I do the same for linearGradient? I have the following SVG: SVG stroke 用于设置 SVG 元素描边样式的实用工具。 Tailwind CSS class . Sep 28, 2025 · Tailwind CSS makes styling the fill color of an inline SVG very easy, primarily using the fill-{color} utilities. The articles I read on styling in SVG stroke 用于设置 SVG 元素描边样式的工具类。 Responsive To control the stroke width of an SVG element at a specific breakpoint, add a {screen}: prefix to any existing width utility. By default, Tailwind includes stroke-width utilities for creating basic grids with up to 6 equal width rows. Apr 9, 2025 · The stroke-width utility class in Tailwind CSS allows you to control the width of strokes applied to SVG elements. Mar 26, 2025 · I recently tried coding with tailwind css and so far i understood everything, the problem i'm having is how do i style svg icons. Stroke Utilities for styling the stroke of SVG elements. with tailwindcss v3. How it looks with the code below How I want it to look Interestingly, it works if i replace currentColor with #ffffff in the Feb 8, 2026 · Set SVG fill colors in Tailwind CSS with fill-{color} utilities. There are more than 400+ icons available in the collection and they come in two main styles: solid and outline. In this example, the fill is set to the current text color with fill-current. 2. 6 stroke styles isn’t included when I compile, however everything seems to be working such as other styles on the svg element and autocomplete in vs code. The problem is when I need to have them as different colors, and there is no way to have two different colors that correspond with the current for either fill or stroke. Covers all Tailwind colors for SVG icons, responsive fills, and dark mode support. 11, changing the svg color is not working anymore, using eg: "fill-green-600" as in the docs. This class is used to set the width of a border in an SVG shape. It allows you to apply an outline-like stroke around text using CSS properties supported by WebKit-based browsers. This becomes an issue when we need to change the color of an SVG image during mouse hover, for example, using Tailwind CSS classes like `fill-white` or `bg-white`. Jan 5, 2021 · I'm running a react app with Tailwind and using HeroIcons, trying to apply className="stroke-current stroke-1" or any different stroke-width to the JSX element does nothing, I have to edit the stro Tailwind CSS Fill The fill property in CSS is used to set the color of SVG shapes, such as paths, circles, rectangles, etc. Click to copy. You have a class that is working in the fill-blue-500 on the SVG element itself so you can either carry on in that way or you can change it to fill-current and then it will adopt whatever the parent element's text color is which is helpful for things like changing color on hover. This is the code where I have rendered the SVG component imp. Useful for styling icon sets like Feather that are drawn entirely with strokes. For more information about Tailwind's responsive design features, check out the Responsive Design documentation. aigyuuihjwwlsnzvuwtchwbgpihlmtaqvwebvavrixwlpswpa