Basic usage
this is regular text this is a keyboard + shortcut
this is regular text this is a keyboard + shortcut
save as Callout I’m hoping
this is a callout
this is regular text
this is regular text this is a keyboard + shortcut
Setting the text decoration color
Use the decoration-*
utilities to change the color of an element’s text decoration.
I’m Derek, an astro-engineer based in Tattooine. I like to build X-Wings at My Company, Inc. Outside of work, I like to watch pod-racing and have light-saber fights.
<div>
<p>
I’m Derek, an astro-engineer based in Tattooine. I like to build X-Wings at
<a class="underline decoration-sky-500">My Company, Inc</a>.
Outside of work, I like to <a class="underline decoration-pink-500">watch
pod-racing</a> and have <a class="underline decoration-indigo-500">light-saber</a> fights.
</p>
</div>
Changing the opacity
Use the color opacity modifier to control the opacity of an element’s text decoration color.
I’m Derek, an astro-engineer based in Tattooine. I like to build X-Wings at My Company, Inc. Outside of work, I like to watch pod-racing and have light-saber fights.
<div>
<p>
I’m Derek, an astro-engineer based in Tattooine. I like to build X-Wings at
<a class="underline decoration-sky-500/30">My Company, Inc</a>.
Outside of work, I like to <a class="underline decoration-pink-500/30">watch
pod-racing</a> and have <a class="underline decoration-indigo-500/30">light-saber</a> fights.
</p>
</div>
You can use any value defined in your opacity scale, or use arbitrary values if you need to deviate from your design tokens.
<strong class="underline decoration-sky-500/[.33]"></strong>
Applying conditionally
Hover, focus, and other states
Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:decoration-blue-400
to only apply the decoration-blue-400
utility on hover.
<p class="underline decoration-sky-600 hover:decoration-blue-400">
<!-- ... -->
</p>
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:decoration-blue-400
to apply the decoration-blue-400
utility at only medium screen sizes and above.
<p class="underline decoration-sky-600 md:decoration-blue-400">
<!-- ... -->
</p>
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 text decoration colors. You can customize your color palette by editing theme.colors
or theme.extend.colors
in your tailwind.config.js
file.
tailwind.config.js
module.exports = {
theme: {
extend: {
colors: {
'regal-blue': '#243c5a',
},
}
}
}
Alternatively, you can customize just your text decoration colors by editing theme.textDecorationColor
or theme.extend.textDecorationColor
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 text-decoration-color
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.
<p class="decoration-[#50d71e]">
<!-- ... -->
</p>
Learn more about arbitrary value support in the arbitrary values documentation.