Resizable
Pannelli affiancati o impilati con maniglie tra loro: trascinali o usa la tastiera del divisore di finestre di WAI-ARIA, con dimensioni minime e massime, pannelli comprimibili, dimensioni bidirezionali e salvataggio opzionale.
Angular: disponibile Vue: disponibile React: disponibile React Native: non ancora disponibile
Utilizzo
Sidebar: 30%
<div class="demo-stack" style="max-width: 32rem; width: 100%">
<sone-resizable-group [(sizes)]="sizes"
style="height: 14rem; border: var(--border-width-thin) solid var(--border); border-radius: var(--radius-lg)">
<sone-resizable-panel defaultSize="30" minSize="15" collapsible>
<div style="display: grid; place-items: center; height: 100%; font-weight: var(--font-weight-semibold)">Sidebar</div>
</sone-resizable-panel>
<sone-resizable-handle withHandle />
<sone-resizable-panel defaultSize="70" minSize="30">
<sone-resizable-group direction="vertical">
<sone-resizable-panel defaultSize="60">
<div style="display: grid; place-items: center; height: 100%; font-weight: var(--font-weight-semibold)">Content</div>
</sone-resizable-panel>
<sone-resizable-handle />
<sone-resizable-panel defaultSize="40">
<div style="display: grid; place-items: center; height: 100%; font-weight: var(--font-weight-semibold)">Console</div>
</sone-resizable-panel>
</sone-resizable-group>
</sone-resizable-panel>
</sone-resizable-group>
<p style="margin: 0; color: var(--text-secondary)">Sidebar: {{ sidebar() }}%</p>
</div>Importazione
import {
SoneResizableGroupComponent,
SoneResizableHandleComponent,
SoneResizablePanelComponent,
} from "@surface-one/angular/resizable";Riferimento API
SoneResizableGroupComponentComponente
`sone-resizable-group` — resizable panels (shadcn/ui Resizable, spartan/ui Resizable): `sone-resizable-panel`s side by side (`direction="horizontal"`) or stacked (`vertical`), with a `sone-resizable-handle` between each pair. Sizes are percentages of the group, two-way as `[(sizes)]` (one per panel); each panel's `defaultSize`, `minSize`, `maxSize` and `collapsible` set the rest. A handle is a WAI-ARIA window splitter: drag it, or focus it and use the arrow keys, Home / End and Enter (collapse or restore a collapsible panel). Give `autoSaveId` and a `storage` (`localStorage`, or your own `getItem` / `setItem`) to keep the sizes between visits; the library never touches storage by itself.
| Nome | Tipo | Predefinito |
|---|---|---|
direction | ResizableDirection | "horizontal" |
sizesbidirezionaleThe panels' sizes in percent, two-way: `[(sizes)]`. Empty: their defaults. | readonly number[] | [] |
autoSaveIdKeep the sizes in `storage` under this id. | string | null | null |
storageWhere `autoSaveId` keeps them — pass `localStorage`, or your own. | ResizableStorage | null | null |
SoneResizableHandleComponentComponente
`sone-resizable-handle` — the window splitter between two panels (`role="separator"`, its value the size of the panel before it). `withHandle` draws a grip.
| Nome | Tipo | Predefinito |
|---|---|---|
withHandleDraw a grip on the handle. | boolean | false |
disabled | boolean | false |
label | — | $localize`:Names the splitter between two resizable panels:Resize panels` |
SoneResizablePanelComponentComponente
`sone-resizable-panel` — one panel; its size is a percentage of the group.
| Nome | Tipo | Predefinito |
|---|---|---|
defaultSizeIts size before any is bound or stored (percent); left out, it shares the rest. | null | null |
minSize | number | 0 |
maxSize | number | 100 |
collapsibleIt collapses to `collapsedSize` when dragged well past `minSize`, or on Enter. | boolean | false |
collapsedSize | number | 0 |
id | string | null | null |