> ## Documentation Index
> Fetch the complete documentation index at: https://developers.hubspot.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

---
id: 9bede5fc-46c1-4135-ac69-22f73cf54db8
---

# AutoGrid

> A responsive grid layout component that automatically arranges components. 

Use the `AutoGrid` component to arrange components into columns based on available space and specified column width restraints. Includes two modes: fixed column sizing (default), and flexible column sizing. For both modes, the layout will be responsive automatically, whether you're using it in an app card, app home page, or app settings page.![Screenshot of a simple implementation of the AutoGrid component](https://developers.hubspot.com/hubfs/Knowledge_Base_2023-24-25/developer/ui-extensions-component-autogrid-simple-example-no-flex.png)```jsx theme={null}
import { AutoGrid, Tile } from "@hubspot/ui-extensions";

<AutoGrid columnWidth={250} gap="small">
  <Tile>Item 1</Tile>
  <Tile>Item 2</Tile>
  <Tile>Item 3</Tile>
  <Tile>Item 4</Tile>
</AutoGrid>;
```## Props

\<table>

\<thead><tr><th>Prop</th>
            \<th>Type</th>
            \<th>Description</th></tr></thead>
        

\<tbody>

\\<tr><td>`columnWidth`
         
      Required</td>
      \\<td>`number`</td>
      \\<td>Sets width of each column in pixels. When `flexible` is `true`, acts as minimum width before expanding.</td></tr><tr><td>`children`</td>
\<td>`ReactNode`</td>
\<td>Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components.</td></tr><tr>
  \<td>`flexible`</td>

  \<td>
    \`boolean`

    \**Default:** `false`
  \</td>

  \<td>When `false`, columns have exact `columnWidth`. When `true`, columns expand equally to fill available space with `columnWidth` as the minimum.</td>
\</tr><tr>
  \<td>`gap`</td>

  \<td>
    \`"extra-large"` | `"extra-small"` | `"flush"` | `"large"` | `"lg"` | `"md"` | `"medium"` | `"sm"` | `"small"` | `"xl"` | `"xs"`

    \**Default:** `"flush"`
  \</td>

  \<td>Sets spacing between grid items.</td>
\</tr><tr><td>`testId`</td>
\<td>`string`</td>
\<td>Used by `findByTestId()` to locate this component in tests.</td></tr>

\</tbody>

\</table>

## Examples### Flexible grid with minimum column widthWith `flexible` set to `true`, the specified `columnWidth` is used as a minimum width. Compare the width of the tiles in this example to the example at the top of the page, which doesn't include `flexible={true}`.![Screenshot of a simple implementation of the AutoGrid UI extension component](https://developers.hubspot.com/hubfs/Knowledge_Base_2023-24-25/developer/ui-extensions-component-autogrid-simple-example-with-flex.png)```jsx theme={null}
import { AutoGrid, Tile } from "@hubspot/ui-extensions";

<AutoGrid columnWidth={250} gap="small" flexible={true}>
  <Tile>Item 1</Tile>
  <Tile>Item 2</Tile>
  <Tile>Item 3</Tile>
  <Tile>Item 4</Tile>
</AutoGrid>;
```### Fixed card layout with large gap![Screenshot of the AutoGrid component with custom gap](https://developers.hubspot.com/hubfs/Knowledge_Base_2023-24-25/developer/ui-extensions-component-autogrid-custom-gap.png)```jsx theme={null}
import { AutoGrid, Card, Heading, Text } from "@hubspot/ui-extensions";

<AutoGrid columnWidth={300} gap="large" flexible={false}>
  <Card>
    <Heading>Product A</Heading>
    <Text>Description here</Text>
  </Card>
  <Card>
    <Heading>Product B</Heading>
    <Text>Description here</Text>
  </Card>
</AutoGrid>;
```##### Related components- [Flex](https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensions/ui-components/standard-components/flex.md)
- [Divider](https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensions/ui-components/standard-components/divider.md)
- [Tile](https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensions/ui-components/standard-components/tile.md)
