A presence animation is one line. The compositor runs it.
kinetic('div').preset(fadeUp) gives you a component that animates in and out: fades, slides, zooms and height collapses. It runs on CSS transitions with no JavaScript animation loop, and renders on the server with its hidden state inlined.
bun add @pyreon/kinetic @pyreon/kinetic-presets - presets
- 122 in kinetic-presetsSix of them also ship in kinetic itself.
- modes
- transition · collapse · stagger · group
- engine
- CSS transitions, no per-frame JavaScriptWaits for transitionend, with a 5 s safety timeout.
- accessibility
- prefers-reduced-motion respectedGate a reveal on
useReducedMotion()until #4336 lands.
- 122 presets, each a named export you can tree-shakepackages/ui-system/kinetic-presets/src/presets.ts (presets map: 122 keys, counted)
- ~200 B gzip for one imported preset (fadeUp: 286 B minified, 202 B gzip, author-measured)bun build of
import { fadeUp }from kinetic-presets lib, minify + gzip -9; guarded by src/__tests__/tree-shake.test.ts - 4 modes from one factory: transition, collapse, stagger, grouppackages/ui-system/kinetic/src/manifest.ts; docs/src/content/docs/kinetic.md "The Four Modes"
synthetic · author-run · M3 Max · record of 2026-11-05
Every result, including where we lose →Motion that is cheap to run and easy to write.
One factory, immutable chains
kinetic('div').preset(fadeUp)is a component and a builder in one value. Every chain call returns a new component, so you defineFadeUponce at module scope and fork variants from it.The browser does the animating
Kinetic applies the start and end styles (or classes) across a double
requestAnimationFrameand waits fortransitionend. Animatetransform,opacityandfilterand the work stays on the compositor thread.Height: auto, animated
.collapse()animates between 0 and the content's measured height, then setsheight: autoso the content stays responsive. The content stays in the DOM, so find-in-page and screen readers still reach it.Safe for every user and every crawler
On the server, initially hidden content is emitted with its hidden style inlined, so scroll-reveal sections are in the HTML. For readers who ask for less motion, render the plain element instead of the reveal, as the recipe below does.
The same panel, with less ceremony.
A presence boundary, a conditional, a key and four animation props for one panel.
import { useState } from 'react'
import { AnimatePresence, motion } from 'motion/react'
export function Panel() {
const [open, setOpen] = useState(false)
return (
<div>
<button onClick={() => setOpen((v) => !v)}>Toggle</button>
<AnimatePresence>
{open && (
<motion.div
key="panel"
initial={{ opacity: 0, y: 16 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: 16 }}
transition={{ duration: 0.3 }}
>
<p>Hello</p>
</motion.div>
)}
</AnimatePresence>
</div>
)
}Define the animated box once. show takes the signal read; leave runs before it hides.
import { signal } from '@pyreon/reactivity'
import { kinetic } from '@pyreon/kinetic'
import { fadeUp } from '@pyreon/kinetic-presets'
const FadeUp = kinetic('div').preset(fadeUp)
export function Panel() {
const open = signal(false)
return (
<div>
<button onClick={() => open.update((v) => !v)}>Toggle</button>
<FadeUp show={open()} onAfterLeave={() => console.log('gone')}>
<p>Hello</p>
</FadeUp>
</div>
)
}Coming from Motion (AnimatePresence)?
Enter and exit for one element.
import { AnimatePresence, motion } from 'motion/react'
export function Notice({ saved }: { saved: boolean }) {
return (
<AnimatePresence>
{saved && (
<motion.div
key="saved"
initial={{ opacity: 0, x: 16 }}
animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: 16 }}
>
Saved
</motion.div>
)}
</AnimatePresence>
)
}A transition-mode component unmounts its child after the leave animation by default, which is what AnimatePresence exists for. Pass unmount={false} to keep it in the DOM, hidden.
import { kinetic } from '@pyreon/kinetic'
import { fadeLeft } from '@pyreon/kinetic-presets'
const SlideIn = kinetic('div').preset(fadeLeft)
export function Notice(props: { saved: () => boolean }) {
return <SlideIn show={props.saved}>Saved</SlideIn>
}Pick a preset, toggle it.
A few of the 122 presets on one box, and a collapse panel. Toggle runs the leave animation; pick a preset to replay the enter.
const Box = kinetic('div').preset(fadeUp)
<Box show={() => shown()}>Hello</Box> // shown: true
const Panel = kinetic('div').collapse()
<Panel show={() => open()}>…</Panel> // open: truePicking a preset replays its enter; Toggle runs the leave. With reduced motion on, kinetic skips the animation and only the state changes.
show: true
- Invoice #1042 paid
- New comment on Launch plan
- Ada joined the team
- Weekly report ready
The whole motion toolkit.
- kinetic(tag) a component and an immutable builder in one value
- Four modes: transition, collapse (height 0 ↔ auto), stagger and group
- Style or class config:
.enter()/.enterTo()objects, or.enterClass({ active, from, to })for Tailwind - Lifecycle callbacks: onEnter, onAfterEnter, onLeave and onAfterLeave, as props or through
.on() - 122 presets: fades, slides, zooms, flips, blur, clip-path reveals, perspective, swing and more
- 5 factories: createFade, createSlide, createScale, createRotate and createBlur with direction, distance, duration and easing
- 5 utilities: compose, withDuration, withEasing, withDelay and reverse, so you tune a preset without forking it
- Safety timeout: a transition whose
transitionendnever fires completes aftertimeout(5 s by default), so a leave never strands an element - SSR-safe: initially hidden content is rendered with its hidden state, not dropped
- Native: a kinetic box with a fade, scale or slide preset compiles to the primitives' Transition on iOS and Android; other presets warn by name
Things to build with it.
Collapse mode animates height between 0 and the measured content height, which a plain CSS transition to auto still cannot do in every browser.
import { signal } from '@pyreon/reactivity'
import { kinetic } from '@pyreon/kinetic'
const Collapse = kinetic('div').collapse({ transition: 'height 250ms ease-out' })
export function Faq(props: { q: string; a: string }) {
const open = signal(false)
return (
<section>
<button aria-expanded={open()} onClick={() => open.update((v) => !v)}>
{props.q}
</button>
<Collapse show={open()}>
<p>{props.a}</p>
</Collapse>
</section>
)
}Transition mode with a faster fadeLeft: the notice slides in on save, leaves two seconds later and unmounts after its leave animation. Readers who ask for less motion get a plain notice.
import { Show } from '@pyreon/core'
import { signal } from '@pyreon/reactivity'
import { useReducedMotion } from '@pyreon/hooks'
import { kinetic } from '@pyreon/kinetic'
import { fadeLeft, withDuration } from '@pyreon/kinetic-presets'
const SlideIn = kinetic('div').preset(withDuration(fadeLeft, 250, 180))
export function SaveButton() {
const saved = signal(false)
const reduced = useReducedMotion()
let timer: ReturnType<typeof setTimeout> | undefined
const save = () => {
saved.set(true)
clearTimeout(timer)
timer = setTimeout(() => saved.set(false), 2000)
}
return (
<div>
<button onClick={save}>Save</button>
<Show when={() => !reduced()}>
<SlideIn show={() => saved()}>Saved</SlideIn>
</Show>
<Show when={() => reduced() && saved()}>
<div>Saved</div>
</Show>
</div>
)
}An IntersectionObserver flips one signal. On the server the section renders with its hidden style inlined, so the heading is in the HTML. Readers who ask for less motion get the plain section.
import { Show, onMount } from '@pyreon/core'
import { signal } from '@pyreon/reactivity'
import { useReducedMotion } from '@pyreon/hooks'
import { kinetic } from '@pyreon/kinetic'
import { blurInUp } from '@pyreon/kinetic-presets'
const Reveal = kinetic('section').preset(blurInUp)
export function Feature(props: { title: string }) {
const seen = signal(false)
const reduced = useReducedMotion()
let el: HTMLElement | null = null
onMount(() => {
const io = new IntersectionObserver(([entry]) => {
if (entry?.isIntersecting) seen.set(true)
})
if (el) io.observe(el)
return () => io.disconnect()
})
return (
<div ref={(node) => { el = node }}>
<Show
when={reduced}
fallback={
<Reveal show={seen()}>
<h2>{props.title}</h2>
</Reveal>
}
>
<section>
<h2>{props.title}</h2>
</section>
</Show>
</div>
)
}Factory, presets, helpers.
Every export has a reference page with its signature, an example and the mistakes people make with it.
- kinetic
- kinetic.preset
- kinetic.enter
- kinetic.enterTo
- kinetic.enterTransition
- kinetic.leave
- kinetic.leaveTo
- kinetic.leaveTransition
- kinetic.enterClass
- kinetic.leaveClass
- kinetic.collapse
- kinetic.stagger
- kinetic.group
- kinetic.on
- kinetic.config
- useTransitionState
- useAnimationEnd
- presets
- fade
- scaleIn
- slideUp
- slideDown
- slideLeft
- slideRight
- presets
- fadeUp
- blurInUp
- bounceIn
- zoomIn
- flipX
- clipCircle
- swingInTop
- springIn
- createFade
- createSlide
- createScale
- createRotate
- createBlur
- compose
- withDuration
- withEasing
- withDelay
- reverse
Good to know before you start.
Presence, not physics
Kinetic animates elements entering and leaving. For drag-driven springs or scroll-linked timelines, pair it with a physics library; the bouncy presets use cubic-bezier curves.
Animate transform, opacity and filter
Width, height, top and left run on the main thread. For height, use collapse mode.
Import presets by name
Named imports tree-shake to what you use. The presets map pins all 122 (about 2.2 KB gzip, author-measured), and a misspelled presets[name] animates nothing without an error.
Animate single elements for now
Stagger and group modes do not render compiled lists correctly yet (#4359): a stagger list renders no children and a group list never unmounts removed rows. Use transition and collapse mode until the fix lands.
Reduced motion and reveals
An initially hidden box that later shows stays hidden under reduced motion (#4336). Until the fix lands, gate reveals on useReducedMotion() and render the plain element for those readers.
What people ask first.
Why CSS transitions instead of a JavaScript animation engine?
Because the browser already interpolates transform, opacity and filter off the main thread. Kinetic only decides when each phase starts and ends, so a busy main thread does not stutter the animation.
Does it work with Tailwind?
Yes. .enterClass({ active, from, to }) and .leaveClass() take utility classes, and a preset can carry class fields instead of style objects.
What happens with prefers-reduced-motion?
Visuals are skipped and the element goes straight to its end state. onEnter → onAfterEnter and onLeave → onAfterLeave still fire, so logic that waits for an animation keeps working.
Does it run on iOS and Android?
Partly, and experimentally. A kinetic box with a fade, scale or slide preset compiles to the same native transition as <Transition> from @pyreon/primitives; presets with no native analogue warn by name. <Transition> is the portable spelling.
Is it faster than Motion?
We ran kinetic against Motion and do not publish the result yet: in that run kinetic measured faster than our own hand-written CSS baseline, which the same work cannot do. Until the harness explains that, there is no claim. Don't trust us; that is the point.
Built to be used together.
Everything that appears can arrive. Everything that leaves can go quietly.
bun add @pyreon/kinetic @pyreon/kinetic-presets