Resizable
A split-pane layout arranging Resizable.Panel and Resizable.Handle parts along a shared axis.
View code
// A session per group, since each one drags along its own axis.
let rowSession = new ResizeSession();
let columnSession = new ResizeSession();
<Resizable aria-label="Layout panes" data-resizable-group>
<Resizable.Panel
id="one"
defaultSize={50}
minSize={25}
data-resizable-panel
data-resizable-min="25"
mix={[center(), weight("semibold")]}
>
One
</Resizable.Panel>
<Resizable.Handle
aria-label="Resize the first pane"
aria-controls="one stack"
data-resizable-handle
mix={[resizeHandle("horizontal", rowSession)]}
/>
<Resizable.Panel id="stack" defaultSize={50} minSize={25} data-resizable-panel>
{/* A group nested in a panel splits that panel along the other axis; the
frame around it is the outer group's, so this one draws none of its own. */}
<Resizable
orientation="vertical"
aria-label="Stacked panes"
data-resizable-group
style={{ border: "none", borderRadius: "0" }}
mix={[bs("100%")]}
>
<Resizable.Panel
id="two"
defaultSize={25}
minSize={15}
data-resizable-panel
data-resizable-min="15"
mix={[center(), weight("semibold")]}
>
Two
</Resizable.Panel>
<Resizable.Handle
aria-label="Resize the upper pane"
aria-controls="two three"
data-resizable-handle
mix={[resizeHandle("vertical", columnSession)]}
/>
<Resizable.Panel
id="three"
defaultSize={75}
minSize={15}
data-resizable-panel
data-resizable-min="15"
mix={[center(), weight("semibold")]}
>
Three
</Resizable.Panel>
</Resizable>
</Resizable.Panel>
</Resizable>Demo apps
Whole pages built only from @sdxc/ui, each for an invented product with its own palette and type. They open in a new tab.
- Food deliveryBocadoBocado, an invented food delivery app: restaurants by cuisine and delivery time, search with filters, menus with options, a cart, checkout and live order tracking on a drawn map./showcase/bocado/demo
- Issue trackerCairnCairn, an invented issue tracker: grouped issue lists with filters in the address, a drag-and-drop board, projects on a roadmap, cycles with burn-up charts and an inbox./showcase/cairn/demo
- Social networkChorusChorus, an invented social network: a live timeline with pictures, link cards, polls and threads, profiles, grouped notifications, search and messages./showcase/chorus/demo
- Code hostDeltaDelta, a code host whose one repository is its own source: a file tree beside the code, line links, blame and the commits list, every file and commit read from git when the site is built./showcase/delta/demo
- Online storeHangwellHangwell, an invented poster shop: collections with facet filters, product pages with format, size and frame pickers and a room preview, a bag, a checkout that adapts to print files, order tracking, downloads and returns./showcase/hangwell/demo
- CMSInkwellInkwell, a demo CMS built from @sdxc/ui/app: posts with count tabs and quick edit, an editor with a quiet save status and a loud Publish, media and settings./showcase/inkwell/demo
- Music streamingMurmurMurmur, an invented music service: home shelves, search by genre, a library, albums, playlists and artists, with a player that keeps playing while you browse./showcase/murmur/demo
- Team chatParleyParley, an invented team chat: channels and direct messages with unread and mention badges, threads, reactions, edits, pins, search, a quick switcher and teammates who type and post live./showcase/parley/demo
- Photo and video networkPinholePinhole, an invented social network for photographs and short videos: a feed under a story tray, full-screen stories, a vertical reels feed, profiles with highlights, Explore and posts with comments./showcase/pinhole/demo
- Ops dashboardPulsePulse, an invented ops dashboard: Northwind's services with live filters, a peek sheet and a bulk bar, metrics that switch one chart, incidents, deploys and settings./showcase/pulse/demo
- Support inboxRelayRelay, an invented support inbox: mailboxes, conversations and the open conversation on one screen, with contacts, reports and settings./showcase/relay/demo
- CalendarSundialSundial, an invented calendar: day, week and month views, an agenda, events you drag, resize and create on the grid, a second time zone, and a find-a-time view across a team in five zones./showcase/sundial/demo
- Chat assistantTernTern, an invented chat assistant: conversations with streamed replies, code and tables, projects, a canvas, sharing and settings./showcase/tern/demo
- Banking & budgetsTuppenceTuppence, an invented personal bank: multi-currency accounts, a statement by day with search and splits, spending and budgets, savings pots, bills ahead, cards that freeze and a transfer flow, all with fake money./showcase/tuppence/demo
- Streaming serviceVesperVesper, an invented streaming service: profiles, a home of sideways shelves under a billboard, series with seasons and episodes, search, My List and a theater player./showcase/vesper/demo
- Travel bookingWayfernWayfern, an invented travel app: stays, flights, cars and packages from one search, results on a real map, seat maps and boarding passes, and one itinerary of trips that exports to calendars./showcase/wayfern/demo
Every demo, landings and docs sites alike, is listed in the showcase.
Installation
An ordinary dependency: install it, import the theme once, and import the component where it is used.
npm add @sdxc/ui remiximport "@sdxc/ui/theme.css";Usage
import { Resizable } from "@sdxc/ui/app";Renders the root host: a <div> laying Resizable.Panel and
Resizable.Handle children out in a row, or a column when
orientation is "vertical", sharing the resolved axis through context; set aria-disabled="true" to dim the whole group.
Composition
The parts the component publishes, each a static property of the host.
ResizableResizable.PanelRenders a single pane: a<div>that grows and shrinks to fill its share of the group's main axis, clipping overflow with scrolling.Resizable.HandleRenders a draggable divider between two adjacent panels: arole="separator"<div>reachable in Tab order, its bar darkening on hover and ready for&[data-resizing]to color it during a drag.
Examples
Vertical split
View code
let session = new ResizeSession();
<Resizable
orientation="vertical"
aria-label="Editor panes"
data-resizable-group
mix={[is("100%"), maxIs("28rem"), bs("16rem")]}
>
<Resizable.Panel
id="editor"
defaultSize={60}
minSize={20}
data-resizable-panel
data-resizable-min="20"
mix={[center(), text("sm"), weight("semibold")]}
>
Editor
</Resizable.Panel>
<Resizable.Handle
aria-label="Resize the terminal"
aria-controls="editor terminal"
data-resizable-handle
mix={[resizeHandle("vertical", session)]}
/>
<Resizable.Panel
id="terminal"
defaultSize={40}
minSize={20}
data-resizable-panel
data-resizable-min="20"
mix={[center(), text("sm"), weight("semibold")]}
>
Terminal
</Resizable.Panel>
</Resizable>Props
Read from the component's own types, so every prop, every default and every allowed value is listed.
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
orientation | "horizontal" | "vertical" | — | No | Layout axis. Defaults to DEFAULT_ORIENTATION. |
Also accepts everything in TagProps<"div">.
Resizable.Panel
| Prop | Type | Default | Required | Description |
|---|---|---|---|---|
defaultSize | number | — | No | Starting share of the group's main axis, as a percentage (e.g. 30 for 30%). Panels left without one split whatever share remains evenly among themselves. |
minSize | number | — | No | Smallest share of the group's main axis this panel will shrink to, as a percentage. Left unset, the panel can shrink down to nothing. |
maxSize | number | — | No | Largest share of the group's main axis this panel will grow to, as a percentage. Left unset, the panel can grow up to the group's entire main axis. |
Also accepts everything in TagProps<"div">.
Resizable.Handle
Also accepts everything in TagProps<"div">.
Types
| Name | Values | What it decides |
|---|---|---|
Orientation | "horizontal" | "vertical" | Axis the panels lay out along: a row of panels side by side, or a column of panels stacked one above another. |