Detent web components
By Shane Logsdon

Navigation

Compact Action Dock

Implemented

Compact action dock with proximity scaling

detent-compact-action-dock

Port status
Catalog status
implemented
Origin
upstream
Phase
4
Wave
phase-4-cinematic
Group
Navigation

7.1 KB gzip for the class module · inlines the shared spring

Variants

Each action is one real button. Hovering or focusing an item scales it with the pinned springSnappy (380 / 30 / 0.5), lifts it 2 px and shows its tooltip; Escape dismisses the tooltip without moving focus. The badge caps at 99+ and the active item is announced with aria-current="page".

The same four items at size="lg", variant="icon-label", anchored bottom-left: the label is the accessible name and no tooltip is rendered at all. The third action is disabled, so it leaves the tab order. The bottom-center position and the sm size are shown in the API tables and the example module instead.

Recorded states

  • hover recorded state; no setter
  • active recorded state; no setter

Usage

Import

import '/components/compact-action-dock/define.js';

// or register it yourself
import { DetentCompactActionDock } from '/components/compact-action-dock/compact-action-dock.js';

Attributes

  • active-id
  • hide-on-scroll
  • position
  • size
  • variant

Properties

  • items

Slots

No slots are recorded for this component.

Events

No events are recorded for this component.

Example

Runnable example: site/examples/compact-action-dock.ts. The snippet below is generated from the catalogued attributes.

<detent-compact-action-dock
  active-id
  hide-on-scroll
  position="bottom-right"
  size="md"
  variant="icon-only"
></detent-compact-action-dock>

Property-only values

const element = document.querySelector('detent-compact-action-dock');
if (element !== null) {
  // items: DockItem[]
  element.items = [];
}

Source

The pinned upstream source for this row:

  • src/components/ui/SmallFloatingDock.tsx sha256 57ea59760b3c…

Native files

The native module and its artifacts:

  • src/components/compact-action-dock/compact-action-dock.ts
  • src/components/compact-action-dock/styles.css
  • src/components/compact-action-dock/define.ts
  • docs/components/compact-action-dock.md
  • site/examples/compact-action-dock.ts
  • tests/browser/compact-action-dock.spec.ts
  • evidence/components/compact-action-dock.md

API

Boolean attributes follow HTML presence semantics: present means true, absent means false, and disabled="false" still means disabled.

Attributes

Attributes
AttributePropertyTypeDefaultNotes
active-idactiveIdstringundefinedKebab-case attribute; camelCase property.
hide-on-scrollhideOnScrollbooleanfalsePresence semantics: present means true, absent means false.
positionposition'bottom-right' | 'bottom-center' | 'bottom-left''bottom-right'Kebab-case attribute; camelCase property.
sizesize'sm' | 'md' | 'lg''md'Kebab-case attribute; camelCase property.
variantvariant'icon-only' | 'icon-label''icon-only'Kebab-case attribute; camelCase property.

Properties

Properties
PropertyTypeDefaultNotes
itemsDockItem[][]Property-only: assign from script; not accepted as an attribute.

Events

No custom events are recorded for this component.

Slots

No slots are recorded for this component.

CSS customisation

  • Framer Motion springs/AnimatePresence ported to CSS transitions, WAAPI or the shared rAF spring helper.
  • React state/hooks replaced by element-owned state with pre-upgrade property preservation.
  • item.icon is a documented local icon name (sparkles, terminal, code, bell, search, settings) with the label first character as a text fallback, instead of a ReactNode.
  • className is dropped in favour of the parts and custom properties.
  • The badge fill is darkened to #be123c with white ink (6.29:1) because upstream rose-500 on white measured about 3.6:1 at 9px (PC-12.6).
  • The proximity-aware hover scale is implemented as the per-item hover scale the pinned source actually performs; no pointer-distance gradient exists in the source.
  • hide-on-scroll animates the presence spring out before the dock becomes hidden and un-hides before animating back in.
  • The badge is aria-hidden and never joins the accessible name, and there is no roving tabindex (one plain button per item, as upstream).

What it does

A minimal floating dock for three to five primary actions: hover scaling, numeric badges, contextual tooltips, three screen positions and optional hide-on-scroll.

Upstream behaviour
  • Proximity-aware hover scale with elastic spring snap-back physics
  • Supports 3 to 5 actions with numeric unread badges and contextual tooltips
  • Configurable screen positioning (bottom-right, bottom-center, bottom-left)
  • Optional hide-on-scroll behavior with smooth viewport transitions
  • Full keyboard tab navigation and WCAG AA focus rings
Differences from upstream
  • Framer Motion springs/AnimatePresence ported to CSS transitions, WAAPI or the shared rAF spring helper.
  • React state/hooks replaced by element-owned state with pre-upgrade property preservation.
  • item.icon is a documented local icon name (sparkles, terminal, code, bell, search, settings) with the label first character as a text fallback, instead of a ReactNode.
  • className is dropped in favour of the parts and custom properties.
  • The badge fill is darkened to #be123c with white ink (6.29:1) because upstream rose-500 on white measured about 3.6:1 at 9px (PC-12.6).
  • The proximity-aware hover scale is implemented as the per-item hover scale the pinned source actually performs; no pointer-distance gradient exists in the source.
  • hide-on-scroll animates the presence spring out before the dock becomes hidden and un-hides before animating back in.
  • The badge is aria-hidden and never joins the accessible name, and there is no roving tabindex (one plain button per item, as upstream).
Previous: SlidePagination Next: Comparison Table

Docs

Components

Project