> For the complete documentation index, see [llms.txt](https://docs.realmacsoftware.com/elements-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.realmacsoftware.com/elements-docs/using-elements/components/layout-components/flex.md).

# Flex

The Flex component is a one-dimensional layout tool based on CSS Flexbox. It arranges child components in a row or column and gives you responsive control over direction, wrapping, spacing, and alignment.

{% embed url="<https://youtu.be/zS3g9dL31Ac>" %}

### How to Use Flex

You’ll find Flex under **Layout** in the Components list.

1. Drag **Flex** onto the page.
2. Add components to its drop zone.
3. Choose a row or column direction.
4. Set wrapping, gaps, alignment, and justification.
5. Adjust settings at each breakpoint as required.

### Component Settings

#### Tags

Add tags when this Flex should be controlled by a [Filter](/elements-docs/using-elements/components/data-and-organisation/filter.md) or [Filter Tags](/elements-docs/using-elements/components/data-and-organisation/filter-tags.md) component. Each collection item contains one tag title.

#### Filter

Enable filtering to make the Flex a filterable item. Use its parent as the group or provide a custom Group ID, then choose the Dim, Zoom Out, or Slide transition.

#### Flexbox Settings

**Direction** controls the main axis. Choose Row, Row Reverse, Column, or Column Reverse.

**Wrap Items**

* **No Wrap** — Keeps all children on one line. This is the default.
* **Wrap** — Moves items onto additional lines when space runs out.
* **Wrap Reverse** — Wraps additional lines in the opposite cross-axis direction.

**Gap**

Horizontal and Vertical gaps independently control spacing between items. Both default to theme spacing 2.

**Align**

* **Align Content** positions multiple wrapped lines on the cross axis.
* **Align Items** positions children within the current line.

**Justify**

* **Justify Content** distributes items along the main axis.
* **Justify Items** controls item justification where supported.

#### Link

The Link group can make the whole Flex clickable. Avoid wrapping multiple interactive child controls inside one link.

### Tips and Best Practices

* **Use Row for horizontal groups:** It is ideal for buttons, badges, and navigation items.
* **Use Column for stacks:** It gives vertical layouts consistent gap control.
* **Reset child auto margins:** Auto margins on Buttons can override the Flex Gap and Justify settings.

### Related Components

* [Grid](/elements-docs/using-elements/components/layout-components/grid.md) — Creates two-dimensional row-and-column layouts.
* [Container](/elements-docs/using-elements/components/layout-components/container.md) — Groups content and can act as a Flex item.

| Common Control                                                                                                     | Description                                                             |
| ------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------- |
| [Link](/elements-docs/using-elements/components/common-controls/link.md)                                           | Link to a page, resource, anchor, email address, or website.            |
| [Layout](/elements-docs/using-elements/components/common-controls/layout.md)                                       | Control positioning, stacking, visibility, overflow, and isolation.     |
| [Sizing](/elements-docs/using-elements/components/common-controls/sizing.md)                                       | Set width, height, and responsive size constraints.                     |
| [Spacing](/elements-docs/using-elements/components/common-controls/spacing.md)                                     | Add responsive margin and padding.                                      |
| [Typography & Text Styles](/elements-docs/using-elements/components/common-controls/typography-and-text-styles.md) | Control fonts, text spacing, decoration, colour, and semantic wrappers. |
| [Backgrounds](/elements-docs/using-elements/components/common-controls/backgrounds.md)                             | Apply colour, image, gradient, SVG, video, and hover backgrounds.       |
| [Transitions](/elements-docs/using-elements/components/common-controls/transitions.md)                             | Choose what animates and set its timing curve, duration, and delay.     |
| [Effects](/elements-docs/using-elements/components/common-controls/effects.md)                                     | Apply shadows, opacity, and hover effects.                              |
| [Filters](/elements-docs/using-elements/components/common-controls/filters.md)                                     | Apply blur, brightness, saturation, shadow, and backdrop effects.       |
| [Transforms](/elements-docs/using-elements/components/common-controls/transforms.md)                               | Scale, rotate, move, and skew components.                               |
| [Borders](/elements-docs/using-elements/components/common-controls/borders.md)                                     | Set border style, colour, opacity, width, radius, and hover states.     |
| [Advanced](/elements-docs/using-elements/components/common-controls/advanced.md)                                   | Add CSS classes and IDs, or change supported HTML tags.                 |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.realmacsoftware.com/elements-docs/using-elements/components/layout-components/flex.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
