# Split

Two regions side by side at a set ratio, stacked on narrow screens.

**Our choice:** No standard exists for a fixed split: two regions in a CSS grid. A draggable divider would follow the APG Window Splitter pattern.

_Diagram: A split puts two regions side by side in the content area at a set ratio, such as an invoice and its payments at two to one._

## Live example

### Invoice and payments (2:1)

```html
<div data-split="2:1">
  <section aria-labelledby="invoice-title">
    <h3 id="invoice-title">Invoice INV-2025-0318</h3>
    <p>Analytical Engines Ltd., issued 12 March 2025, due 11 April 2025.</p>
    <section data-scroll="inline" aria-labelledby="invoice-lines" tabindex="0">
      <table>
        <caption id="invoice-lines">Invoice lines</caption>
        <thead>
          <tr><th scope="col">Description</th><th scope="col">Quantity</th><th scope="col">Amount</th></tr>
        </thead>
        <tbody>
          <tr><td>Brass gear set</td><td>4</td><td>€720.00</td></tr>
          <tr><td>Punch card reader</td><td>1</td><td>€440.00</td></tr>
          <tr><td>Shipping</td><td>1</td><td>€80.00</td></tr>
        </tbody>
      </table>
    </section>
  </section>
  <aside aria-labelledby="payments-title">
    <h3 id="payments-title">Payments</h3>
    <ul>
      <li>14 March 2025: €500.00 by bank transfer</li>
      <li>28 March 2025: €400.00 by bank transfer</li>
    </ul>
    <p><strong>Open: €340.00</strong></p>
    <p><a href="?invoice=INV-2025-0318&amp;view=reminder">Send a payment reminder</a></p>
  </aside>
</div>
```

### Shipping and billing (1:1)

```html
<div data-split>
  <section aria-labelledby="ship-title">
    <h3 id="ship-title">Ship to</h3>
    <address>
      Analytical Engines Ltd.<br>
      12 St James's Square<br>
      London SW1Y 4JH<br>
      United Kingdom
    </address>
  </section>
  <section aria-labelledby="bill-title">
    <h3 id="bill-title">Bill to</h3>
    <address>
      Analytical Engines Ltd., Accounts payable<br>
      PO Box 1815<br>
      London EC1A 1BB<br>
      United Kingdom
    </address>
  </section>
</div>
```

### Customer and activity (1:2)

```html
<div data-split="1:2">
  <section aria-labelledby="summary-title">
    <h3 id="summary-title">Bletchley Instruments</h3>
    <dl>
      <dt>Customer since</dt>
      <dd>2019</dd>
      <dt>Orders this year</dt>
      <dd>18</dd>
    </dl>
  </section>
  <section aria-labelledby="activity-title">
    <h3 id="activity-title">Recent activity</h3>
    <ol>
      <li>Order 1041 shipped by PostNL, 11 March 2025</li>
      <li>Invoice INV-2025-0301 paid in full, 4 March 2025</li>
      <li>Credit note CN-2025-0012 issued for a damaged reader, 27 February 2025</li>
    </ol>
  </section>
</div>
```

## Attributes

| Attribute or value | Where | Effect |
| --- | --- | --- |
| `data-split="[1:1 \| 1:2 \| 2:1]"` | the wrapper of exactly two regions | empty means 1:1 (equal halves) |

### Breakpoint

40rem of the wrapper's own inline size. A container query condition cannot read a custom property, so it is written as a length; to move it, write your own @container dui-split rule.

## Accessibility

- The divider is not draggable: a resizable divider is the APG Window Splitter pattern (role="separator" with aria-valuenow and arrow keys) and needs script, so it is out of scope; see explainers/split-view.md.
- Source order is the reading and Tab order in both layouts; the ratio never reorders the regions (WCAG 1.3.2, 2.4.3).
- Nothing scrolls sideways at 320px (WCAG 1.4.10).

## Specifications

- [APG Window Splitter pattern](https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/)
- [WCAG 1.4.10 Reflow](https://www.w3.org/WAI/WCAG22/Understanding/reflow.html)
- [MDN Grid layout](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Grid_layout)
- [MDN Container queries](https://developer.mozilla.org/en-US/docs/Web/CSS/Guides/Containment/Container_queries)

## See also

- [Layouts](https://domestic-ui.odonckers.dev/layouts/index.md)
- Source: [`css/layout/split.css`](https://github.com/odonckers/domestic-ui/blob/main/css/layout/split.css), [`examples/layouts/split.html`](https://github.com/odonckers/domestic-ui/blob/main/examples/layouts/split.html)

## How other systems do it

For comparison only; these are not the standard this system follows.

- [Apple Human Interface Guidelines: Split views](https://developer.apple.com/design/human-interface-guidelines/split-views)
- [Material Design 3: Scaffold: Panes](https://m3.material.io/foundations/layout/scaffold/panes)
- Vercel Geist: No equivalent
