Splitter

A component that divides your layout into resizable sections.

Source code

Click here to see the source code for this component on GitHub. Feel free to copy it and adjust it for your own use.

Installation

npx ui-thing@latest add splitter

Usage

Basic

We can put the parts together to build a simple layout with a resizable sidebar.

Handle

We can pass teh withHandle prop to the UiSplitterHandle component to show a handle.

We can even pass in a custom icon to display for the handle.

Do note that the handle will be rotated because of this class that is added to it [&[data-orientation=vertical]>div]:rotate-90.

Collapsible

We can use the collapsible prop to make the panels go down to the collapsedSize when the minSize is reached.

Persist Layout with SSR

We can use the autoSaveId prop to persist the layout data into the local storage.

Try changing the layout and then refresh the page to see the layout persist.