Borders
Utilities for controlling the color of an element's outline.
Use the outline-*
utilities to change the color of an element’s outline.
outline-blue-500
outline-cyan-500
outline-pink-500
<button class="outline outline-offset-2 outline-blue-500 ...">Button A</button>
<button class="outline outline-offset-2 outline-cyan-500 ...">Button B</button>
<button class="outline outline-offset-2 outline-pink-500 ...">Button C</button>
Use the color opacity modifier to control the opacity of an element’s outline color.
outline-blue-500/50
<button class="outline-2 outline-blue-500/50 ...">Save Changes</button>
You can use any value defined in your opacity scale, or use arbitrary values if you need to deviate from your design tokens.
<button class="outline-4 outline-pink-400/[.55] ..."></button>
Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:outline-blue-400
to only apply the outline-blue-400
utility on hover.
<button class="outline hover:outline-blue-400">
<!-- ... -->
</button>
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:outline-blue-400
to apply the outline-blue-400
utility at only medium screen sizes and above.
<button class="outline md:outline-blue-400">
<!-- ... -->
</button>
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 outline 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 outline colors by editing theme.outlineColor
or theme.extend.outlineColor
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 outline-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.
<button class="outline-[#243c5a]">
<!-- ... -->
</button>
Learn more about arbitrary value support in the arbitrary values documentation.