Pro
Corner snap
A floating panel that sits in a corner of its container. Drag the grip and let go: the panel carries the speed of your hand, works out which corner that throw is heading for, and a spring settles it there.
pnpm dlx shadcn@latest add @caliper/corner-snapWhen to use
Use it for
- Picture-in-picture video, call windows, mini players and chat bubbles.
- Any helper that should stay out of the way but within reach.
Skip it when
- Panels that need free placement; use `FloatingPanel`.
- Containers that are not positioned; it needs one as its reference.
Decisions
Why it is built this way, so you know what to keep when you change your copy.
Behaviour
- Throws are projected
- The corner is chosen from where the panel would be a fifth of a second later at the speed of release, so a flick travels and a nudge does not.
- The spring starts at your speed
- The settle begins with the release velocity, so there is no pause between the hand and the animation.
Usage
- Keyboard corners
- The arrow keys on the grip move it to the corner in that direction and the move is announced.
Installation
pnpm dlx shadcn@latest add @caliper/corner-snap
Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. Pro installs with your access token, set up once per project. See Pro access. The first part also adds Caliper UI’s tokens; import them once as in Installation.
Usage
Import it from your copy of the source. The example behind the preview comes with the source. It is built from CornerSnap and nearestCorner.
import { CornerSnap, nearestCorner } from "@/components/ui/corner-snap"
The worked example comes with Pro
The 29-line example behind the preview opens here, ready to copy.
- 626 Pro parts, blocks and page templates, all with source
- $149 once, with lifetime updates. No renewal
- A full refund within 14 days if it is not for you
API reference
CornerSnap
component
Also accepts the native props of its root element and a ref.
nearestCorner
component
Accessibility
It exposes status semantics, with aria-label and aria-hidden kept in step with state. Changes that matter are announced through a live region.
Motion
It checks prefers-reduced-motion itself and settles immediately instead of travelling. Every state is still reachable.
Related
- Floating panelA small window that floats over the page and stays out of the way: notes beside a record, an assistant beside a form. Drag it, resize it, shrink it to its title bar or let it fill the space.
- Snap guidesA small canvas of cards you arrange by dragging, with a design tool's alignment help: cards snap to each other's edges and centres and to the canvas centre, guide lines show what they line up with, and the gaps to their neighbours are measured as they move.
- DockA floating dock of icon destinations with a gliding active pill.
