Skip to content

Floating Dock

A floating panel pinned to a corner of the screen, with a margin and the safe area kept clear. It holds anything. The Pro media dock adds drag, snap to the nearest corner, minimise and arrow-key moves, and a video card for picture in picture.

On this page
Used for
  • Mini player
  • Call overlay
  • Picture in picture
  • Chat bubble
  • Floating help

Examples

Corner

Draggable media dockProPro

Installation is part of Pro

Pro components install from a licensed registry. The live preview stays open to everyone.

Picture-in-picture videoProPro

Installation is part of Pro

Pro components install from a licensed registry. The live preview stays open to everyone.

Props

corner
"top-left" | "top-right" | "bottom-left" | "bottom-right"
Default"bottom-right"
Which corner the dock sits in. On the media dock it is controlled; use defaultCorner to leave it to the dock.
margin
number
Default16
Space to the edge in px, on top of the device safe area. The media dock also keeps a drag this far inside the edges.
position
"fixed" | "absolute"
Default"fixed"
Fixed pins it to the viewport; absolute pins it inside the nearest positioned parent, for a frame or an app shell.
label
string
Default"Floating panel"
The accessible name of the panel. The media dock defaults to "Media player".
defaultCorner / onCornerChange (media dock)
DockCorner / (corner) => void
Default"bottom-right"
Starts in a corner and reports each change, from a drag or from the keys. Save it to bring the dock back where the person left it.
minimized / defaultMinimized / onMinimizedChange (media dock)
boolean / boolean / (min) => void
Defaultfalse
Folds the body away and leaves the header as a pill. The children stay mounted.
draggable (media dock)
boolean
Defaulttrue
false removes the grip and the drag, leaving a dock that only minimises.
title / pill (media dock)
ReactNode / ReactNode
The header content. While minimised the header shows pill instead, for a tiny cover, the track name and a play button; without a pill it keeps the title.
src / poster / duration (video card)
string / string | ReactNode / number
Default - / gradient / 90
A video URL and its poster. Without a src it plays a generated colour-scene clip of `duration` seconds, so a demo needs no file.
nativePip / onClose / onExpand (video card)
boolean / () => void / () => void
Defaultfalse
nativePip adds the browser's picture-in-picture button (needs a src and browser support); onClose and onExpand add their buttons.

Accessibility

  • The dock is a labelled region (label). The media dock's grip is a button: focus it and press the arrow keys to move to the next corner, and a status message says where it went.
  • Dragging is never the only way: every move has the arrow keys, and Minimise and Restore are real buttons that report aria-expanded.
  • A minimised dock hides its body from tab and from screen readers (inert) while it stays mounted.
  • The video card's controls are always visible, and the seek bar is a native range input with the time as its value text.

Placing it

  • Put it once, high in the tree (the app shell), so it survives page changes and the player does not restart.
  • It uses z-index: 40. Raise it with className if your app has a higher overlay.
  • The safe area is read by CSS (env(safe-area-inset-*)); add viewport-fit=cover to your viewport meta tag to use it on a phone.
  • Drags are kept margin inside the edges; the safe area counts only for where it settles.

What it handles

  1. 01Pins a panel to one of four corners of the screen or of a parent, with a margin and the device safe area kept clear.
  2. 02Holds anything: it never looks at its children, so a player, a call or a video card all fit.
  3. 03Stays in its corner when the window resizes, because it is anchored with CSS and not with measured pixels.
  4. 04Pro: drags by its grip or title, travels to the nearest corner on release (a quick flick throws it a little further) and stays inside the screen while dragging.
  5. 05Pro: moves between corners with the arrow keys on the grip and says where it went, so it has no pointer-only action.
  6. 06Pro: minimises to a pill and back with its content still mounted, so a video keeps playing and a call keeps its state.

States

First render
Nothing. The dock paints in its corner
none
Corner changes (Free)
It is in the new corner at once
none
Release after a drag (Pro)
It travels from where it was let go to the nearest corner
420ms, ease out
Arrow key on the grip (Pro)
It travels to the next corner along the row or column
420ms, ease out
Minimise or restore (Pro)
The body folds shut or open; the header stays as a pill
180ms, ease out
Reduced motion
The dock jumps to its corner and the body folds at once
0ms

Works with

When to use

When to use

  • A mini player, a call or a video that stays on screen while people use the rest of the app.
  • A small panel pinned to a corner: a chat bubble, a help button, a status card.

When not to use

  • A panel that opens from an edge and covers the page: use Sheet.
  • Capsules for running agents, which stack on their own: use Activity Stack.
  • A tip tied to one control: use Popover.

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Floating Dock to my app and wire it to my own data.
  • I need a mini player, a call or a video that stays on screen while people use the rest of the app. Set that up with the Knowns UI Floating Dock.
  • Which Floating Dock props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "floating-dock" }) and search_docs({ query: "floating dock" }).

Need help?

Stuck on Floating Dock, or found something off? We read every message.