Outline
Use to hide the default browser outline on focused elements.
It is highly recommended to apply your own focus styling for accessibility when using this utility.
The outline-none
utility is implemented using a transparent outline under the hood to ensure elements are still visibly focused to Windows high contrast mode users.
<button class="focus:outline-black ...">Button A</button>
By default, Tailwind provides three outline utilities. You can customize these by editing the theme.outline
section of your tailwind.config.js
file.
You can also provide an outline-offset
value for any custom outline utilities using a tuple of the form [outline, outlineOffset]
:
// tailwind.config.js
theme: {
extend: {
outline: {
blue: ['2px solid #0000ff', '1px'],
}
}
}
By default, only responsive, focus-within and focus variants are generated for outline utilities.
For example, this config will also generate hover and active variants:
If you don’t plan to use the outline utilities in your project, you can disable them entirely by setting the outline
property to false
in the corePlugins
section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ outline: false,
}
}