Resizable panes

A resizable pane has a grip in its corner that the reader drags to make it bigger or smaller. It is the CSS resize property, set up by one class. In a row it resizes sideways, which makes a split view; in a column it resizes up and down.

A resizable box

Drag the grip at the bottom-right corner. The box can grow and shrink both ways, down to a small minimum and no wider than the space it is in. Content that no longer fits scrolls, so the box is also a scroll area, and it takes the same role, label and tabindex.

Notes from the meeting. Drag the corner to make this box bigger, or smaller until the text needs to scroll. The size is the reader's choice and lasts until the page is reloaded.

<div class="resizable panel" role="region" aria-label="Notes" tabindex="0"
     style="width: 300px; height: 150px">
  <p>Notes from the meeting. Drag the corner to make this box bigger, …</p>
</div>
A box that resizes both ways, with a starting size

A split view

Put a resizable pane in a row beside a stretch. The pane resizes only sideways, and the stretch takes whatever width is left, so dragging the grip moves the line between them.

Files

Editor. Drag the grip at the bottom-right of the Files pane to change the split.

<div class="row" style="height: 180px">
  <div class="resizable panel" role="region" aria-label="Files" tabindex="0" style="width: 35%">
    <p>Files</p>
  </div>
  <div class="panel stretch">
    <p>Editor. Drag the grip at the bottom-right of the Files pane to change the split.</p>
  </div>
</div>
Two panes side by side; the first sets the split

Up and down

In a column the pane resizes only up and down, for a preview above a console or an editor above its output.

Preview. Drag the grip down to give it more room.

Console

<div class="column">
  <div class="resizable panel" role="region" aria-label="Preview" tabindex="0" style="height: 110px">
    <p>Preview. Drag the grip down to give it more room.</p>
  </div>
  <div class="panel"><p>Console</p></div>
</div>
A pane that resizes up and down

Text areas

A textarea resizes on its own, with no class: it grows down for a longer message and keeps the width of the form.

<label><p>Message</p><textarea name="message"></textarea></label>
A text area, resizable by default

Keyboard and touch

The grip is for a mouse or a pen. There is no keyboard control for it, and phones and tablets often do not show it. So give every pane a starting size that works without any resizing, and treat the grip as a convenience. The pane's content can still be scrolled from the keyboard, because the pane can take focus.

A small optional script can add keyboard resizing later. The pane works without it.