# Split

Supply UI 1.1.0. Layout.

A side part and a main part next to each other (a sidebar and its page, a rail and its list) that stack when the box is too narrow for the main part to keep `at` of its width (a share like `55%`; a length is never wider than the box). Follows its box, not the window, so it works in a card. Use it, never a one-line row, for anything sidebar-like inside a card

A side part and a main part next to each other (a sidebar and its page, a rail and its list). They stack when the box is too narrow for the main part to keep `at` of its width ("50%" by default). Follows its box, not the window.

## Options

| Option | Type | Default | What it does |
| --- | --- | --- | --- |
| `at` | `string` |  | The share of the box the main part must keep before the two stack: `"50%"` by default, or a share like `"55%"`. |
| `gap` | `1 \| 2 \| 3 \| 4 \| 6 \| 8 \| 12` |  | The space between the two parts; the page's gutter by default. |
| `side` | `string` |  | The width the side part (the first child) starts from, as a CSS length: `"16rem"`. |

It also takes the 280 attributes of the element or UI SDK part it renders (`className`, `aria-label`, events…).

## Without React

Classes: `div.ui-split` + `--split-at`, `--side`

## In the examples

- A sidebar with sections: Pick a section; its numbers change beside it (https://www.supply.family/ui/#scene-studio-sidebar)
- Icons in a rail: A narrow column, a name on hover, ink for where you are (https://www.supply.family/ui/#scene-rail)

## Layout: notes

**States.** Layout follows the box it is in, not the window: `Split`, `Grid`, `AppShell` and the site parts stack when their box is narrow, at any width of the window.

**Do**
- Space with `gap` (`Stack`, `Row`, `Grid`), never with margins on children.
- Put the page's sections straight on the page, under their titles; a `Card` is one thing a person picks or acts on.
- Check every screen at 320, 375 and 768 px with the narrow check of rule 10.

**Don't**
- Don't give a box a fixed width, or a `min-height` together with an `aspect-ratio`.
- Don't nest a card in a card.
- Don't put two `<main>`s on a page: a screen shown inside another page takes `Main as="div"`.
