Dock

Free

A macOS-style launcher bar on any edge of its container. The item under the pointer and its neighbours grow — by transform only: each control scales from the centre of its edge and the items slide apart by the room they took, so nothing is laid out again and a target never shrinks — and the swell follows keyboard focus too. An APG toolbar with one tab stop and arrow keys along the dock (in the order the eye sees under RTL); items are real links through the link adapter, with aria-current on the current page, or buttons; badges, disabled items, labels on hover and focus, and no magnification under reduced motion.

</>sv-dock docklauncherapp launchermacosmagnificationtoolbarquick launchp-dockprimeng
import { SvDockComponent } from '@styloviz/layout/dock';

Demo & usage

Basic usage

Usage example — open the gallery for the full interactive demo.

An interactive demo for this component lives in the gallery.

Open live demo

More examples

Items

example.htmlAngular
readonly apps: SvDockItem[] = [
  { id: 'home', label: 'Overview', icon: 'home', route: '/workspace' },   // a link, through SV_LINK_ADAPTER
  { id: 'mail', label: 'Mail', icon: 'mail', route: '/workspace/mail', badge: 12 },
  { id: 'new', label: 'New document', icon: 'plus' },                   // no route or href: a button
  { id: 'billing', label: 'Billing', icon: 'credit-card', disabled: true },
  { id: 'help', label: 'Help', icon: 'info', href: 'https://example.com/help', external: true },
];

A vertical dock on the left edge

example.htmlAngular
<div class="relative h-96">
  <sv-dock [items]="tools" position="left" size="sm" ariaLabel="Tools" />
</div>

Gentle, or no, magnification

example.htmlAngular
<sv-dock [items]="apps" [magnificationScale]="1.25" />
<sv-dock [items]="apps" [magnification]="false" />

Migrating from PrimeNG p-dock

example.htmlAngular
<!-- PrimeNG -->
<p-dock [model]="items" position="bottom" />

<!-- Styloviz: MenuItem { label, icon, routerLink, url, command } → SvDockItem { id, label, icon | image, route, href } -->
<sv-dock [items]="items" position="bottom" (itemSelect)="run($event.item)" />

When to use

  • An app launcher or a set of workspace tools that should stay one move away along an edge of a canvas, desktop-style page or kiosk.
  • A short set — about four to eight items. Past that the swell and the labels get crowded; use a sidebar or a menu.
  • Not as the main navigation of a phone app — use Bottom Navigation, whose labels are always visible — and not for a handful of secondary actions on one page, where a Toolbar or Speed Dial fits.

Compare with

  • Speed Dial / FAB — Speed Dial hides a few actions behind one floating button and fans them out on demand. Dock keeps a row of launchers on screen along an edge, magnifying the one under the pointer.
  • Bottom Navigation — Bottom Navigation is the phone app bar — three to five destinations with visible labels, Tab between links. Dock is an icon-only launcher bar on any edge of a container, one tab stop with arrow keys, labels on hover and focus.

Async states

None — this component has nothing to load, so it has no loading, empty or error state to drive.

Item identity & owned state

Item key
itemKey — set this when your rows have no id, so selection survives a reorder.

Inputs

NameTypeDefaultDescription
itemsreadonly SvDockItem[][]The launchers, in order along the dock.
itemKeySvItemKey<SvDockItem>'id'What identifies an item — a property name or a function.
activeRoutestring''The path the reader is on, so the item whose `route` matches (longest match, on segment boundaries) is `aria-current="page"` and marked with a dot. Controlled — a routed host writes `[activeRoute]="router.url"`.
positionSvDockPosition'bottom'The container edge the dock sits on; also its orientation.
placementSvDockPlacement'absolute'`absolute` pins it to `position`'s edge of the nearest positioned ancestor; `static` leaves it in the flow.
sizeSvDockSize'md'Resting item size.
magnificationbooleantrueGrow the item under the pointer (or keyboard focus) and its neighbours. Off under reduced motion regardless.
magnificationScalenumber1.6The scale of the item under the pointer, 1–2 (values outside are clamped).
ariaLabelstring''The toolbar's accessible name. Empty uses the `dock` label ('Dock').
labelsPartial<SvLayoutLabels>{}Per-instance overrides for the package labels.

Outputs

EventPayload typeDescription
itemSelectSvDockSelectionAn item was activated — by a click or tap, or by Enter / Space. Not emitted for a disabled item, or for a modified click (a new tab or window) on a link, which the browser handles.

Customization & theming

  • `position`: `bottom` (default), `top`, `left` or `right` — a physical edge, like a drawer's; it also sets the orientation.
  • `placement`: `absolute` pins the dock to that edge of the nearest positioned ancestor; `static` leaves it in the flow.
  • `size`: `sm` 40 px, `md` 48 px, `lg` 56 px items. `magnification` turns the swell off; `magnificationScale` (1–2, default 1.6) sets the peak.
  • Items take an `icon` (a registered glyph name) or an `image` (only safe URLs load); a `badge` (count or short text); `route` (via `SV_LINK_ADAPTER`) or `href` (with `external` for a new tab); `disabled`. `itemKey` sets identity.
  • The bar is a tinted surface (`bg-white/85`, `dark:bg-gray-900/85`), items use the `gray-*` tokens, the focus ring and current-page dot `primary-*`, badges `danger-*`.
  • Strings come from the `layout` labels: `dock` (the toolbar name, overridden by `ariaLabel`) and `dockNewTab`.
  • The magnification and fitting math is exported as pure functions — `svDockLayout`, `svDockScale`, `svDockPointerIndex`, `svDockFit` — for a custom dock.

Best practices

  • Do: Give every item a short, unique `label` — it is the accessible name and the tooltip of an icon-only control.
  • Do: Bind `[activeRoute]="router.url"` for routed items, so the current page is announced and is where Tab lands.
  • Do: Make the container `relative` and leave room on the dock's side for the swell (about 0.6 of an item at the default scale).
  • Don't: Don't hide an item that is unavailable — set `disabled`, so it can still be found and is announced as unavailable.
  • Tip: On a phone, magnification never starts (touch has no hover) — the dock is a plain bar of 40–56 px targets.

Accessibility

  • A `role="toolbar"` named by `ariaLabel` (default "Dock"), with `aria-orientation`. One tab stop (roving tabindex): Tab lands on the current page, else the last item used, and leaves the dock.
  • Arrow keys along the dock move between items (←/→ for a horizontal dock — mirrored under RTL so the arrows follow what the eye sees; ↑/↓ for a vertical one), Home/End go to the ends, Enter and Space activate. `itemSelect` reports whether the pointer or the keyboard did it.
  • Every item is a real `<a href>` or `<button>` named by its label, with the badge read after it ("Mail, 12") and "(opens in a new tab)" for an external link. The current route is `aria-current="page"`.
  • A disabled item stays focusable (APG: discoverable) with `aria-disabled="true"` and never activates. An unsafe `href`/`route` (`javascript:`, `data:`) is never rendered: the item is shown unavailable.
  • The label shows on hover AND on keyboard focus, stays while the pointer is over it, and Escape hides it (WCAG 1.4.13).
  • Magnification is `transform` only and only ever enlarges a target (WCAG 2.5.8); it is off for touch and entirely off under `prefers-reduced-motion` — no transform at all. Focus outlines survive forced colors.
  • It fits its container at any width (WCAG 1.4.10): when the row is longer than the room, the items shrink evenly — never below 32 px, so every target stays above 24 px with a legible glyph — and magnification pauses; when even that does not fit, the dock scrolls along its axis, so no control is cut off.

Feedback on Dock

Spotted a gap in this page, or something that didn't work as described? Comments are GitHub Discussions in the public styloviz/community repo, so posting needs a GitHub account.

Loads giscus.app and GitHub — nothing is fetched until you click.