ViewportPadding

Primitive #67

🔍 Problem it solves

A popover or tooltip that touches the viewport edge feels cramped and may obscure scrollbars. Users expect a small gap (padding) between the floating element and the screen edge.

✅ Solution

constrainToViewport() takes a padding object (top/right/bottom/left) and adjusts the element's position so it stays within the viewport with the specified gap.

🧩 Used by components

Tooltip, Popover, Dropdown, ContextMenu, Select.

🎮 Interactive demo