Tailwind CSS on GitHub

Grid Auto Rows

Utilities for controlling the size of implicitly-created grid rows.

Default class reference

Class
Properties
auto-rows-autogrid-auto-rows: auto;
auto-rows-mingrid-auto-rows: min-content;
auto-rows-maxgrid-auto-rows: max-content;
auto-rows-frgrid-auto-rows: minmax(0, 1fr);

Usage

Use the auto-rows-{size} utilities to control the size implicitly-created grid rows.

<div class="grid grid-flow-row auto-rows-max">
  <div>1</div>
  <div>2</div>
  <div>3</div>
</div>

Responsive

To control the grid-auto-rows property at a specific breakpoint, add a {screen}: prefix to any existing grid-auto-rows utility. For example, use md:auto-rows-min to apply the auto-rows-min utility at only medium screen sizes and above.

<div class="grid grid-flow-row auto-rows-max md:auto-rows-min">
  <div>1</div>
  <div>2</div>
  <div>3</div>
</div>

For more information about Tailwind's responsive design features, check out the Responsive Design documentation.

Customizing

By default Tailwind includes four general purpose grid-auto-rows utilities. You can customize these in the theme.gridAutoRows section of your tailwind.config.js file.

  // tailwind.config.js
  module.exports = {
    theme: {
      extend: {
        gridAutoRows: {
          '2fr': 'minmax(0, 2fr)',
        }
      }
    }
  }

Learn more about customizing the default theme in the theme customization documentation.

Variants

By default, only responsive variants are generated for grid-auto-rows utilities.

You can control which variants are generated for the grid-auto-rows utilities by modifying the gridAutoRows property in the variants section of your tailwind.config.js file.

For example, this config will also generate hover and focus variants:

  // tailwind.config.js
  module.exports = {
    variants: {
      extend: {
        // ...
+       gridAutoRows: ['hover', 'focus'],
      }
    }
  }

Disabling

If you don't plan to use the grid-auto-rows utilities in your project, you can disable them entirely by setting the gridAutoRows property to false in the corePlugins section of your config file:

  // tailwind.config.js
  module.exports = {
    corePlugins: {
      // ...
+     gridAutoRows: false,
    }
  }