Flex Shrink

    Utilities for controlling how flex items shrink.

    Use to allow a flex item to shrink if needed:

    Don’t shrink

    Use shrink-0 to prevent a flex item from shrinking:

    1. <div class="flex ...">
    2. <div class="flex-1 h-16 ...">
    3. 01
    4. </div>
    5. <div class="shrink-0 h-16 w-32 ...">
    6. 02
    7. </div>
    8. 03
    9. </div>
    10. </div>

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

    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:shrink-0 to apply the shrink-0 utility at only medium screen sizes and above.

    1. <div class="shrink md:shrink-0">
    2. </div>

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


    tailwind.config.js

    Learn more about customizing the default theme in the documentation.

    Arbitrary values

    If you need to use a one-off flex-shrink 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="shrink-[2]">
    2. <!-- ... -->

    Learn more about arbitrary value support in the documentation.