Ring Offset Width

    Utilities for simulating an offset when adding outline rings.

    Use the utilities to simulate an offset by adding solid white box-shadow and increasing the thickness of the accompanying outline ring to accommodate the offset.

    Changing the offset color

    You can’t actually offset a box-shadow in CSS, so we have to fake it using a solid color shadow that matches the parent background color. We use white by default, but if you are adding a ring offset over a different background color, you should use the ring-offset-{color} utilities to match the parent background color:

    1. <button class="ring ring-pink-500 ring-offset-2 ring-offset-slate-50 dark:ring-offset-slate-900 ...">
    2. </button>

    For more information, see the ring offset color documentation.


    Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:ring-offset-4 to only apply the utility on hover.

    For a complete list of all available state modifiers, check out the 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:ring-offset-4 to apply the ring-offset-4 utility at only medium screen sizes and above.

    1. <button class="ring-2 ring-offset-2 md:ring-offset-4">
    2. <!-- ... -->
    3. </button>

    To customize which ring offset width utilities are generated, add your custom values under key in the theme section of your tailwind.config.js file.

    tailwind.config.js

    Learn more about customizing the default theme in the documentation.

    Arbitrary values

    If you need to use a one-off ring-offset 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. <div class="ring-offset-[3px]">