Skip to content
caliper ui docs

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.

Pro
pnpm dlx shadcn@latest add @caliper/corner-snap

Video call

Throw the call window toward a corner.

Sprint planning · bottom right

Maya Chen on a video call

Installs components/ui/corner-snap.tsxDepends on lucide-reactMotion honours reduced motion

When 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

terminal
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.

example.tsx
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
Checking your licence…

API reference

CornerSnap

component

Also accepts the native props of its root element and a ref.

PropTypeDefaultDescription
title *string—Names the panel; it is also the handle's name.
defaultCornerCorner"bottom-right"
cornersCorner[]allCornersThe corners it may rest in.
insetnumber16Gap kept from the container's edges, in pixels.
onCornerChange((corner: Corner) => void)—

nearestCorner

component
PropTypeDefault
x *number—
y *number—

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.

KeyBehaviour
←Moves to the previous item or value.
→Moves to the next item or value.
↑Moves to the previous item or value.
↓Moves to the next item or value.

Motion

It checks prefers-reduced-motion itself and settles immediately instead of travelling. Every state is still reachable.

All Surfaces examples