Skip to content

Splitter

Stable

A draggable bar between two panes that people can also move with the keyboard.

Also known as resizable, resizable panels, split view, split pane

Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.

Sidebar and main area

Sidebar (160px)
Main area. Drag the bar, or focus it and press the arrow keys.

Horizontal means a vertical bar between left and right panes. The first pane gets its width from the value.

When to use it

Lets people change how much room a side pane or panel gets. It works with a mouse, a finger and the keyboard.

Made of: Bar · Line · Hit area

Use it for

  • A resizable sidebar next to the main area.
  • A split between an editor and its output.
  • A pane people can collapse with a double click.

Not for

  • Showing or hiding content without resizing: use Collapsible.
  • Switching between views: use Tabs.

Do and avoid

Invoices
Receipts
Invoice 0142
Do. A labelled bar lets people give the side pane more room.
Invoices
Invoice 0142
Avoid. The side pane is crushed too small, with no way to bring it back.

Do

  • Put the bar in a flex row or column between the two panes.
  • Set min and max so neither pane can disappear by accident.
  • Save the size so it comes back next visit.
  • Offer a button as well when a pane can collapse.

Avoid

  • Do not expect it to size the panes. You set the first pane from value.
  • Do not leave out the label.
  • Do not use it to switch views. Use Tabs.
  • Do not make the first pane smaller than its content needs without a way to bring it back.

On a phone

  • It is dragged with a finger, and the handle gets a wider invisible touch area on touch screens.
  • The drag handles pointer events only and stops the page from scrolling while the finger is on the handle.
  • Arrow keys and double click do not exist on a phone, so offer a button that does the same job as onToggle.
  • The value, min and max are pixels that you pass in, so choose limits that leave room on a 360px screen.

Build your next AI screen with Tattva.

Free and open, with the code. Start in one line.

Get started