A pill cover hinged on a ball guards a destructive action: the first click swings it over, uncovers the real button and turns it into Cancel.
Click meTap me
Changes here apply to every environment of web-console.
Transfer project
Move web-console to another workspace. Members keep their roles.
Archive project
Everyone gets read-only access. Deployments stop at the end of the day.
Delete project
Removes the project, its environments and every deployment log.
safety-cover, lively
Use Safety Cover for one destructive action that deserves a pause but not a modal: delete a project, revoke a token, remove a member. The first click swings a pill cover over its hinge and uncovers the real destructive button; the second click confirms. The column where the cover lands is reserved, so nothing around it moves. For many-step or high-stakes flows that need explanation, use a dialog; for a harmless action, use a regular button.
pnpm dlx shadcn@latest add @motionkit-pro/safety-covernpx shadcn@latest add @motionkit-pro/safety-coveryarn dlx shadcn@latest add @motionkit-pro/safety-coverbunx --bun shadcn@latest add @motionkit-pro/safety-coverRequires a Pro license and the @motionkit-pro registry with your token. See Installation.
import { SafetyCover } from "@/components/ui/safety-cover"
export function DeleteProject() {
return (
<SafetyCover
confirmLabel="Yes, delete"
consequence="Deletes 14 environments and 230 deployments. 6 members lose access."
onConfirm={() => deleteProject()}
>
Delete…
</SafetyCover>
)
}The children are the front of the cover. confirmLabel and cancelLabel name the real button and the back of the cover; onConfirm runs when the uncovered button is clicked and the cover then closes. open, defaultOpen and onOpenChange control it (opening from the open prop never moves focus). describedBy links the confirm button to a warning elsewhere on the page.
consequence says what confirming does, in counts. As the cover swings over, the line rises out from under it on the same timeline, in a row reserved below the buttons (nothing moves when it appears), and it describes the confirm button for screen readers. It wraps to the width of the buttons and never widens the row. disabledReason uses the same reserved line to say why a disabled cover cannot be lifted ("Only owners can delete", or the state after the action: "Scheduled · restore within 7 days").
Presets: guard (default, the cover lands left of the confirm button and closes 1.5 s after pointer and focus leave), mirror (lands right, for left-aligned rows and forms) and latched (never closes on leave, only Cancel or Escape). side and closeAfter (ms or false) override the preset. size is sm (36 px), md (44 px) or lg (52 px); pivot replaces the hinge shape.
Set the character for the whole app with MotionKitProvider, or per instance with temperament (calm, lively, playful). It changes motion intensity only, never the drawing.
Prop
Type
Also accepts all props of Omit<ComponentProps<"div">, "children">.
The default demo: the Danger zone of a project's settings with transfer, archive and delete rows. Lifting the cover uncovers the counts the deletion affects; once confirmed, the cover locks and its reason line says how long the project can be restored.
Click meTap me
Changes here apply to every environment of web-console.
Transfer project
Move web-console to another workspace. Members keep their roles.
Archive project
Everyone gets read-only access. Deployments stop at the end of the day.
Delete project
Removes the project, its environments and every deployment log.
safety-cover, lively
A tokens table where each row's revoke action uses the latched preset, so the cover waits until Cancel or Escape. The consequence names the key that stops working.
Click meTap me
Revoked keys stop working at once.
CI deploys
mk_live_…4f2a · used 2 min ago
Analytics export
mk_live_…9c10 · used Yesterday
Staging bot
mk_test_…77de · used 12 days ago
safety-cover, lively
A member panel with the mirror preset: the cover lands to the right of the confirm button and the consequence line aligns left with it. After removal the cover is disabled with its reason.
Click meTap me
Ada Lindqvist
ada@example.com · Admin
safety-cover, lively
role="group" named by the front label. The cover is a native button with aria-expanded and aria-controls; once open its name becomes the cancel label.inert while covered. It takes focus when the person opens the cover; Escape closes and returns focus to the cover.aria-hidden. The confirm button's aria-describedby combines describedBy and the consequence line; a disabled cover is described by disabledReason.card with a hairline border rim and the confirm button destructive (lightness capped so white text stays at least 4.5:1 in both themes). The consequence line uses muted-foreground at full opacity once shown. Focus shows a 3 px ring.| Key | Action |
|---|---|
| Enter / Space | On the cover: opens it and focuses the confirm button |
| Enter / Space | On the confirm button: confirms; on the Cancel cover: closes |
| Escape | Closes the cover and returns focus to it |
No charge, swing, squash or clack: the cover fades out, jumps to the other column and fades back in as Cancel, and the reverse on close. The consequence line fades in with it, without the rise.
requestAnimationFrame loop runs while the cover moves and stops at rest.Main spring of each temperament. Set it with the temperament prop or MotionKitProvider; the default is lively.
Not measured yet · budget 15.0 kB gzip
Component and MotionKit helpers; excludes react, react-dom.
click, press, keyboard focus
No charge, swing, squash or clack: the cover fades out, jumps to the reserved column and fades back in reading Cancel (and the reverse on close); the consequence line fades in without rising.
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)