Glass Scene Dock
A floating glass navigation dock pinned over scroll-driven gradient scenes — no image files needed. A travelling glass highlight glides between icons while scrolling crossfades the backdrop. Pass image per scene to use photography instead. Fully light/dark aware.
Installation#
pnpm dlx shadcn@latest add @davinciui/glass-scene-dockUsage#
API Reference#
| Prop | Type | Default |
|---|---|---|
scenesBackground scenes in order: id plus either image (+ optional alt) for photography, or background / darkBackground CSS gradients — no files needed. Optional title for screen readers. The dock shows one item per scene. | GlassScene[] | — |
itemsDock controls (id, label, icon). Defaults to five thin-stroke icons: home, overview, focus, contact, settings. | GlassDockItem[] | — |
defaultIndexInitially selected scene and dock item. | number | 0 |
modeDensity hint for the host surface. Card compacts the dock rhythm; layout otherwise follows the container width automatically. | "card" | "preview" | "fullscreen" | "preview" |
enableScrollWhen false the internal scroller locks and selection is click/keyboard only. | boolean | true |
enableHoverHovering an item glides the glass highlight, which stays where you leave it. Hover never moves the background — scenes travel on scroll, tap, click, or keyboard only. Touch and reduced-motion fall back to tap/click. | boolean | true |
transitionDurationTarget crossfade settle time in milliseconds (200–2000). Tunes the scroll-smoothing spring. | number | 650 |
onSceneChangeFires when the active scene changes via scroll, click, or keyboard. | (index: number) => void | — |
Accessibility#
Dock items are native buttons with aria-label and aria-current inside a nav labelled Scene navigation; focus-visible rings are provided and focus moves the glass highlight. Inactive scenes are aria-hidden and an aria-live region announces the active scene title.
Motion#
Scroll progress drives scene opacity and small scale and translate through a spring tuned by transitionDuration, while the highlight glides with a layout spring. useReducedMotion makes the spring near-instant, removes scale and translate drift, disables hover and smooth scrolling, and a media query removes icon transitions.
View source
Keep in mind
Need a custom component?
I build bespoke UI components & websites tailored to your brand.

