Floating Panel
A window inside the page that the user drags, resizes, minimises and maximises, without blocking the page.
c2-floating-panel is a window inside the page: a support chat, an inspector beside a canvas, a tool palette, a call’s mini window. It is not modal, so the page around it stays usable. CSS sets where it first appears and how big it is (--c2-floating-panel--inset, --width and --height; the bottom-right corner of the window by default), and from there the user drags it by its title bar, resizes it from any edge or corner, minimises, maximises and closes it. rect holds the user’s place and size, and storage-key keeps it, with the state, in localStorage for the next visit. boundary="viewport" (the default) keeps the panel inside the window; boundary="parent" keeps it inside its nearest positioned ancestor, as in the examples below. Minimised panels dock to the bottom edge and line up from the right, or with minimize="collapse" fold to their title bar where they are. A press or focus brings a panel to the front of the others in its boundary, and the front one matches :state(active).
With the keyboard, the title bar is a handle: the Arrow keys move the panel by 10px (Shift: 50px) and Home puts it back at its CSS place. The grip in the bottom-right corner resizes it the same way, and Escape restores a maximised panel without ever closing it. show() opens the panel and moves focus into it; close() asks before-close first, which a listener can cancel, and returns focus to where it was. Fill the title, icon, actions and footer slots; the body scrolls. The host writes nothing on itself: style its state with :state(minimized), :state(maximized), :state(active) and :state(dragging).
Import
import '@c2n/components/floating-panel'Usage
Drag the title bar to move the panel, or an edge to resize it.
Focus the title bar and use the Arrow keys; Home puts it back.
Support chatDrag the title bar to move the panel, or an edge to resize it.
Focus the title bar and use the Arrow keys; Home puts it back.
Support chatRestore the panel from its docked title bar.
Support chatRestore the panel from its docked title bar.
Support chatDocked panels line up from the right.
Meeting notesDocked panels line up from the right.
Meeting notesA rounder, more compact panel that folds in place when minimised.
PropertiesA rounder, more compact panel that folds in place when minimised.
Properties