SVG

Stroke

Utilities for styling the stroke of SVG elements.

Quick reference

Class
Properties
stroke-inheritstroke: inherit;
stroke-currentstroke: currentColor;
stroke-transparentstroke: transparent;
stroke-blackstroke: #000;
stroke-whitestroke: #fff;
stroke-slate-50stroke: #f8fafc;
stroke-slate-100stroke: #f1f5f9;
stroke-slate-200stroke: #e2e8f0;
stroke-slate-300stroke: #cbd5e1;
stroke-slate-400stroke: #94a3b8;
stroke-slate-500stroke: #64748b;
stroke-slate-600stroke: #475569;
stroke-slate-700stroke: #334155;
stroke-slate-800stroke: #1e293b;
stroke-slate-900stroke: #0f172a;
stroke-gray-50stroke: #f9fafb;
stroke-gray-100stroke: #f3f4f6;
stroke-gray-200stroke: #e5e7eb;
stroke-gray-300stroke: #d1d5db;
stroke-gray-400stroke: #9ca3af;
stroke-gray-500stroke: #6b7280;
stroke-gray-600stroke: #4b5563;
stroke-gray-700stroke: #374151;
stroke-gray-800stroke: #1f2937;
stroke-gray-900stroke: #111827;
stroke-zinc-50stroke: #fafafa;
stroke-zinc-100stroke: #f4f4f5;
stroke-zinc-200stroke: #e4e4e7;
stroke-zinc-300stroke: #d4d4d8;
stroke-zinc-400stroke: #a1a1aa;
stroke-zinc-500stroke: #71717a;
stroke-zinc-600stroke: #52525b;
stroke-zinc-700stroke: #3f3f46;
stroke-zinc-800stroke: #27272a;
stroke-zinc-900stroke: #18181b;
stroke-neutral-50stroke: #fafafa;
stroke-neutral-100stroke: #f5f5f5;
stroke-neutral-200stroke: #e5e5e5;
stroke-neutral-300stroke: #d4d4d4;
stroke-neutral-400stroke: #a3a3a3;
stroke-neutral-500stroke: #737373;
stroke-neutral-600stroke: #525252;
stroke-neutral-700stroke: #404040;
stroke-neutral-800stroke: #262626;
stroke-neutral-900stroke: #171717;
stroke-stone-50stroke: #fafaf9;
stroke-stone-100stroke: #f5f5f4;
stroke-stone-200stroke: #e7e5e4;
stroke-stone-300stroke: #d6d3d1;
stroke-stone-400stroke: #a8a29e;
stroke-stone-500stroke: #78716c;
stroke-stone-600stroke: #57534e;
stroke-stone-700stroke: #44403c;
stroke-stone-800stroke: #292524;
stroke-stone-900stroke: #1c1917;
stroke-red-50stroke: #fef2f2;
stroke-red-100stroke: #fee2e2;
stroke-red-200stroke: #fecaca;
stroke-red-300stroke: #fca5a5;
stroke-red-400stroke: #f87171;
stroke-red-500stroke: #ef4444;
stroke-red-600stroke: #dc2626;
stroke-red-700stroke: #b91c1c;
stroke-red-800stroke: #991b1b;
stroke-red-900stroke: #7f1d1d;
stroke-orange-50stroke: #fff7ed;
stroke-orange-100stroke: #ffedd5;
stroke-orange-200stroke: #fed7aa;
stroke-orange-300stroke: #fdba74;
stroke-orange-400stroke: #fb923c;
stroke-orange-500stroke: #f97316;
stroke-orange-600stroke: #ea580c;
stroke-orange-700stroke: #c2410c;
stroke-orange-800stroke: #9a3412;
stroke-orange-900stroke: #7c2d12;
stroke-amber-50stroke: #fffbeb;
stroke-amber-100stroke: #fef3c7;
stroke-amber-200stroke: #fde68a;
stroke-amber-300stroke: #fcd34d;
stroke-amber-400stroke: #fbbf24;
stroke-amber-500stroke: #f59e0b;
stroke-amber-600stroke: #d97706;
stroke-amber-700stroke: #b45309;
stroke-amber-800stroke: #92400e;
stroke-amber-900stroke: #78350f;
stroke-yellow-50stroke: #fefce8;
stroke-yellow-100stroke: #fef9c3;
stroke-yellow-200stroke: #fef08a;
stroke-yellow-300stroke: #fde047;
stroke-yellow-400stroke: #facc15;
stroke-yellow-500stroke: #eab308;
stroke-yellow-600stroke: #ca8a04;
stroke-yellow-700stroke: #a16207;
stroke-yellow-800stroke: #854d0e;
stroke-yellow-900stroke: #713f12;
stroke-lime-50stroke: #f7fee7;
stroke-lime-100stroke: #ecfccb;
stroke-lime-200stroke: #d9f99d;
stroke-lime-300stroke: #bef264;
stroke-lime-400stroke: #a3e635;
stroke-lime-500stroke: #84cc16;
stroke-lime-600stroke: #65a30d;
stroke-lime-700stroke: #4d7c0f;
stroke-lime-800stroke: #3f6212;
stroke-lime-900stroke: #365314;
stroke-green-50stroke: #f0fdf4;
stroke-green-100stroke: #dcfce7;
stroke-green-200stroke: #bbf7d0;
stroke-green-300stroke: #86efac;
stroke-green-400stroke: #4ade80;
stroke-green-500stroke: #22c55e;
stroke-green-600stroke: #16a34a;
stroke-green-700stroke: #15803d;
stroke-green-800stroke: #166534;
stroke-green-900stroke: #14532d;
stroke-emerald-50stroke: #ecfdf5;
stroke-emerald-100stroke: #d1fae5;
stroke-emerald-200stroke: #a7f3d0;
stroke-emerald-300stroke: #6ee7b7;
stroke-emerald-400stroke: #34d399;
stroke-emerald-500stroke: #10b981;
stroke-emerald-600stroke: #059669;
stroke-emerald-700stroke: #047857;
stroke-emerald-800stroke: #065f46;
stroke-emerald-900stroke: #064e3b;
stroke-teal-50stroke: #f0fdfa;
stroke-teal-100stroke: #ccfbf1;
stroke-teal-200stroke: #99f6e4;
stroke-teal-300stroke: #5eead4;
stroke-teal-400stroke: #2dd4bf;
stroke-teal-500stroke: #14b8a6;
stroke-teal-600stroke: #0d9488;
stroke-teal-700stroke: #0f766e;
stroke-teal-800stroke: #115e59;
stroke-teal-900stroke: #134e4a;
stroke-cyan-50stroke: #ecfeff;
stroke-cyan-100stroke: #cffafe;
stroke-cyan-200stroke: #a5f3fc;
stroke-cyan-300stroke: #67e8f9;
stroke-cyan-400stroke: #22d3ee;
stroke-cyan-500stroke: #06b6d4;
stroke-cyan-600stroke: #0891b2;
stroke-cyan-700stroke: #0e7490;
stroke-cyan-800stroke: #155e75;
stroke-cyan-900stroke: #164e63;
stroke-sky-50stroke: #f0f9ff;
stroke-sky-100stroke: #e0f2fe;
stroke-sky-200stroke: #bae6fd;
stroke-sky-300stroke: #7dd3fc;
stroke-sky-400stroke: #38bdf8;
stroke-sky-500stroke: #0ea5e9;
stroke-sky-600stroke: #0284c7;
stroke-sky-700stroke: #0369a1;
stroke-sky-800stroke: #075985;
stroke-sky-900stroke: #0c4a6e;
stroke-blue-50stroke: #eff6ff;
stroke-blue-100stroke: #dbeafe;
stroke-blue-200stroke: #bfdbfe;
stroke-blue-300stroke: #93c5fd;
stroke-blue-400stroke: #60a5fa;
stroke-blue-500stroke: #3b82f6;
stroke-blue-600stroke: #2563eb;
stroke-blue-700stroke: #1d4ed8;
stroke-blue-800stroke: #1e40af;
stroke-blue-900stroke: #1e3a8a;
stroke-indigo-50stroke: #eef2ff;
stroke-indigo-100stroke: #e0e7ff;
stroke-indigo-200stroke: #c7d2fe;
stroke-indigo-300stroke: #a5b4fc;
stroke-indigo-400stroke: #818cf8;
stroke-indigo-500stroke: #6366f1;
stroke-indigo-600stroke: #4f46e5;
stroke-indigo-700stroke: #4338ca;
stroke-indigo-800stroke: #3730a3;
stroke-indigo-900stroke: #312e81;
stroke-violet-50stroke: #f5f3ff;
stroke-violet-100stroke: #ede9fe;
stroke-violet-200stroke: #ddd6fe;
stroke-violet-300stroke: #c4b5fd;
stroke-violet-400stroke: #a78bfa;
stroke-violet-500stroke: #8b5cf6;
stroke-violet-600stroke: #7c3aed;
stroke-violet-700stroke: #6d28d9;
stroke-violet-800stroke: #5b21b6;
stroke-violet-900stroke: #4c1d95;
stroke-purple-50stroke: #faf5ff;
stroke-purple-100stroke: #f3e8ff;
stroke-purple-200stroke: #e9d5ff;
stroke-purple-300stroke: #d8b4fe;
stroke-purple-400stroke: #c084fc;
stroke-purple-500stroke: #a855f7;
stroke-purple-600stroke: #9333ea;
stroke-purple-700stroke: #7e22ce;
stroke-purple-800stroke: #6b21a8;
stroke-purple-900stroke: #581c87;
stroke-fuchsia-50stroke: #fdf4ff;
stroke-fuchsia-100stroke: #fae8ff;
stroke-fuchsia-200stroke: #f5d0fe;
stroke-fuchsia-300stroke: #f0abfc;
stroke-fuchsia-400stroke: #e879f9;
stroke-fuchsia-500stroke: #d946ef;
stroke-fuchsia-600stroke: #c026d3;
stroke-fuchsia-700stroke: #a21caf;
stroke-fuchsia-800stroke: #86198f;
stroke-fuchsia-900stroke: #701a75;
stroke-pink-50stroke: #fdf2f8;
stroke-pink-100stroke: #fce7f3;
stroke-pink-200stroke: #fbcfe8;
stroke-pink-300stroke: #f9a8d4;
stroke-pink-400stroke: #f472b6;
stroke-pink-500stroke: #ec4899;
stroke-pink-600stroke: #db2777;
stroke-pink-700stroke: #be185d;
stroke-pink-800stroke: #9d174d;
stroke-pink-900stroke: #831843;
stroke-rose-50stroke: #fff1f2;
stroke-rose-100stroke: #ffe4e6;
stroke-rose-200stroke: #fecdd3;
stroke-rose-300stroke: #fda4af;
stroke-rose-400stroke: #fb7185;
stroke-rose-500stroke: #f43f5e;
stroke-rose-600stroke: #e11d48;
stroke-rose-700stroke: #be123c;
stroke-rose-800stroke: #9f1239;
stroke-rose-900stroke: #881337;

Show all classes

Basic usage

Setting the stroke color

Use the stroke-{color} utilities to change the stroke color of an SVG.

Stroke - 图1

  1. <svg class="stroke-cyan-500 ...">
  2. <!-- ... -->
  3. </svg>

This can be useful for styling icon sets like Heroicons.


Applying conditionally

Hover, focus, and other states

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.

  1. <svg class="stroke-cyan-500 hover:stroke-cyan-700">
  2. <!-- ... -->
  3. </svg>

For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.

Breakpoints and media queries

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.

  1. <svg class="stroke-cyan-500 md:stroke-cyan-700">
  2. <!-- ... -->
  3. </svg>

To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.


Using custom values

Customizing your theme

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.

tailwind.config.js

  1. 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.

Arbitrary values

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.

  1. <svg class="stroke-[#243c5a]">
  2. <!-- ... -->
  3. </svg>

Learn more about arbitrary value support in the arbitrary values documentation.