受 WebOS Enyo 启发的滑动面板 React 库
开发者发布开源 React 布局库 Sashay,借鉴 WebOS Enyo 的滑动面板交互,支持拖拽边缘调整分栏、面板自动滑入相邻区域,布局状态可写入 URL 保存。该库零运行时依赖,宣称在 1000 个面板下拖拽帧耗时低于 2ms,仅支持 ESM 与 React 19 及以上版本。
报道正文
本文目录11 个章节
Drag the edge between two panes to resize them. The edge settles at a simple fraction of the width, and a pane with no room left slides under its neighbour. The layout can be saved in the URL.
Read the docsnpm i @vcarl/sashay This headline is a pane. Grab the red edge to its right.This headline is a pane. On a phone the edges become tabs: tap one.
Why panes?
Power users want to arrange their screen the way they work. Panes give them that without making the interface complicated: each pane is an ordinary view, and the only new control is the edge between them.
That makes them a good middle ground between a fully customisable UI, where any panel can go anywhere, and a simple responsive layout that decides everything for you.
Hang it in a frame.
// @vcarl/sashay/react
<Sashay
onLayoutChange={save}>
<Pane id="list"
title="List"
focus={1/3}>…</Pane>
<Pane id="detail"
title="Detail"
focus={1/2}>…</Pane>
</Sashay>ESM onlyReact ≥190-dep coreMIT?layout=69.0This code is the layout. Drag an edge, throw it, or click one to open and close.
Snaps to simple fractions.
Dividers rest on fractions with a denominator up to six, so a layout saved on a laptop still makes sense on a monitor. The grid gets finer as the frame gets wider.
Throw it.
A quick throw carries the divider one or two snaps past where you let go. Release speed is read from the last 90 ms, so a slow drag still lands exactly where you put it.
A bar for each pane.
Any pane can have a bar at its bottom for filters, settings or a table of contents. It expands over the pane and works the same on a phone.
Guide: Bottom bars → Open Mine Archived
Deep stacks fold into a spine.
Drill down as far as you like. Panes that no longer fit fold into a slim spine, with a tab for each. Drag cost stays flat at a thousand deep.
Guide: Navigation stacks →1****2
Deep linked pane arrangements
Which panes are open, how wide they are, and which bars are open all fit in a short code you can keep in the URL. Share the link and the other person sees the same arrangement.
See it work.
‹****›
Houseplants
Sun against water. Pick a plant.
Your window faces
Pick a plant on the chart.
Pick a plant.
Houseplants in three panes. Pick a plant, then open its card. Squeeze the chart and your plant stays in view.‹****›
The house
6 things
Parlour
2 things
A house, all the way down. Rooms, dressers, drawers, a tin box. The old levels fold into the spine.Both demos, with source0runtime dependencies**<2msdrag frame at 1,000 panes← →keyboard on every edge, aria-valuenow1.2.1**React ≥19, or the vanilla core · MIT