LayoutSplit
Searchastronomic.dev# Split
To set two blocks side by side, like a text and an image, stacked when there is no room.
Static: no JavaScript.
## Usage
```astro
import Split from "@astronomic-dev/ui/components/Split.astro";
```
## Examples
### Text and an image
Side by side while the Split is at least 40rem wide, stacked below that.
```astro
---
import Media from "@astronomic-dev/ui/components/Media.astro";
import Split from "@astronomic-dev/ui/components/Split.astro";
import Stack from "@astronomic-dev/ui/components/Stack.astro";
// Your own image file.
import shelves from "../../photos/studio-shelves.webp";
---
<Split ratio="3/2" class="items-center">
<Stack gap="item">
<h3 class="m-0 text-2xl font-semibold">A studio of four</h3>
<p class="m-0 text-muted">We work with a few clients at a time, from the first idea to the launch, and stay on to help after.</p>
</Stack>
<Media src={shelves} alt="Plates and bowls on white shelves in the studio." ratio="4/3" />
</Split>
```
### Reversed
reverse puts the second child first when side by side; stacked, the source order stays.
```astro
---
import Split from "@astronomic-dev/ui/components/Split.astro";
---
<Split ratio="1/2" reverse>
<p class="m-0 rounded-card bg-surface-2 p-4 text-muted">First in the source: shown on the right</p>
<p class="m-0 rounded-card bg-surface-2 p-4 text-muted">Second in the source: shown on the left</p>
</Split>
```
## Props
### Split
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `as` | `HTMLTag` | `"div"` | The element to render, such as article. |
| `ratio` | `"1/1" \| "2/1" \| "1/2" \| "3/2" \| "2/3"` | `"1/1"` | The widths of the first and second child, side by side. |
| `reverse` | `boolean` | `false` | Puts the second child first when side by side. Stacked, the order stays the source order. |
| `gap` | `"item" \| "blocks" \| "section"` | `"blocks"` | The space between the two children: a spacing role, set by the preset. |
| `class` | `string` | None | More classes, merged with cn(), so yours win on conflicts. |
| Slot | Description |
| --- | --- |
| `default` | Exactly two children: the first and the second side. |
Any other attribute goes on the rendered element.
## Accessibility
- Renders a plain <div> with no role, so it adds nothing for a screen reader.
- reverse changes only where the sides show, never the reading or tab order. Put the side a reader needs first first in the source.
- It switches by its own width, not the screen's, so it also stacks in a narrow column. It is not a @container: a part inside it still measures its own.
Split
FreeTo set two blocks side by side, like a text and an image, stacked when there is no room.
- File
- Split.astro
- Group
- Layout
- Kind
- Static: no JavaScript
- Examples
- 2
Examples
Drag the orange handle to set the width. Frames get real breakpoints.
- Static
- Interactive
- Framed
Text and an image
Side by side while the Split is at least 40rem wide, stacked below that.
A studio of four
We work with a few clients at a time, from the first idea to the launch, and stay on to help after.

Force statemain.astro
examples/split/main.astro
---
import Media from "@astronomic-dev/ui/components/Media.astro";
import Split from "@astronomic-dev/ui/components/Split.astro";
import Stack from "@astronomic-dev/ui/components/Stack.astro";
// Your own image file.
import shelves from "../../photos/studio-shelves.webp";
---
<Split ratio="3/2" class="items-center">
<Stack gap="item">
<h3 class="m-0 text-2xl font-semibold">A studio of four</h3>
<p class="m-0 text-muted">We work with a few clients at a time, from the first idea to the launch, and stay on to help after.</p>
</Stack>
<Media src={shelves} alt="Plates and bowls on white shelves in the studio." ratio="4/3" />
</Split>Reversed
reverse puts the second child first when side by side; stacked, the source order stays.
First in the source: shown on the right
Second in the source: shown on the left
Force statereverse.astro
examples/split/reverse.astro
---
import Split from "@astronomic-dev/ui/components/Split.astro";
---
<Split ratio="1/2" reverse>
<p class="m-0 rounded-card bg-surface-2 p-4 text-muted">First in the source: shown on the right</p>
<p class="m-0 rounded-card bg-surface-2 p-4 text-muted">Second in the source: shown on the left</p>
</Split>Minimal · Light