Dock
Uma barra de ferramentas de desenho acoplada à borda superior, inferior, esquerda ou direita de uma tela, com navegação por setas e dicas.
Angular: disponível Vue: disponível React: disponível React Native: ainda não disponível
Uso
Tool: select · Tab into the dock, then use the arrow keys.
<div class="demo-stack" style="width: 100%">
<sone-segmented size="sm" ariaLabel="Dock position" [options]="positions" [(value)]="position" />
<div class="demo-canvas" style="position: relative; height: 24rem; border: var(--border-width-thin) solid var(--border); border-radius: var(--radius-lg); background: var(--surface-base)">
<sone-dock [position]="$any(position())" ariaLabel="Drawing tools">
@for (t of tools; track t.id) {
<button soneDockItem [label]="t.label" [shortcut]="t.key" [active]="tool() === t.id" (click)="tool.set(t.id)">
<sone-icon [icon]="t.icon" />
</button>
}
<div soneDockSeparator></div>
<button soneDockItem label="Undo" shortcut="Ctrl+Z"><sone-icon icon="undo" /></button>
<button soneDockItem label="Redo" shortcut="Ctrl+Shift+Z"><sone-icon icon="redo" /></button>
</sone-dock>
</div>
<p class="text-hint">Tool: {{ tool() }} · Tab into the dock, then use the arrow keys.</p>
</div>Importação
import {
SoneDockComponent,
SoneDockGroupDirective,
SoneDockItemDirective,
SoneDockSeparatorDirective,
} from "@surface-one/angular/dock";Referência da API
SoneDockComponentComponente
A toolbar of drawing tools docked to one edge of a canvas — `position` picks the edge (top, bottom, left, right) and with it the direction: a row on top or bottom, a column on the sides. `floating` (the default) pins it inside the nearest positioned ancestor; without it the dock sits in the flow. A WAI-ARIA toolbar: one Tab stop, arrow keys along its direction, Home / End.
| Nome | Tipo | Padrão |
|---|---|---|
positionThe edge it docks to. | DockPosition | "bottom" |
alignWhere along that edge: centred, or at its start or end. | DockAlign | "center" |
size | DockSize | "default" |
floatingPin to the edge of the nearest positioned ancestor (`position: relative`). | boolean | true |
ariaLabel | string | $localize`:Toolbar of drawing tools:Tools` |
SoneDockGroupDirectiveDiretiva
A labelled run of related tools (`role="group"`).
| Nome | Tipo | Padrão |
|---|---|---|
soneDockGroup | string | null | null |
SoneDockItemDirectiveDiretiva
One tool of a dock — an icon button named by `label`, which is also its tooltip (with the `shortcut`, if any). `[active]` makes it a toggle (`aria-pressed`): the current drawing tool. Leave it unset for a plain action (zoom, undo).
| Nome | Tipo | Padrão |
|---|---|---|
labelobrigatórioThe accessible name and the tooltip. | string | — |
shortcutA key that picks the tool (`V`, `Shift+R`) — shown in the tooltip, announced as `aria-keyshortcuts`. | string | null | null |
active`true` / `false`: a toggle; unset: a plain button. | boolean | undefined | undefined |
disabled | boolean | false |
SoneDockSeparatorDirectiveDiretiva
A rule between groups of tools, across the dock's direction.