Performance
What Keyframery runs in the browser, what it costs (about 7 KB gzipped, no dependencies), and the one variable to change on slow devices.
What runs
- One
MutationObserverthat watches for shadcn parts appearing and changing state - Two listeners in the capture phase,
pointerdownandkeydown, that remember the last press - Animations of
transform,opacityandfilteronly, which the browser runs off the main thread where it can - Ghosts, the copies of leaving elements, which are removed as soon as their animation ends or is cancelled
Nothing runs while nothing changes.
Size
The layer is about 7 KB gzipped once your bundler minifies it: cuts.tsx, its stylesheet and the engine. Each helper adds about 1.5–2.5 KB.
Lists
ListCut measures its items once per render, in a layout effect. Only items in or near the viewport animate, so a list of thousands stays fast. Key items by a stable id, and avoid re-rendering the whole list on every keystroke elsewhere on the page.
Slow devices
Blur is the most expensive part of a rack focus. If you target low-end phones, turn it off:
:root {
--kf-blur: 0px;
}Turning motion off in tests
Keep Playwright and other end-to-end tests fast and steady by turning Keyframery's motion off, or check that a cut actually played.
Dialog
Animate the shadcn/ui Dialog: it grows out of the button that opened it and closes back into it. Works on Base UI and Radix, with no code changes.