Skip to content
@pyreon/kinetic + kinetic-presets
ui system · animation

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
Documentation
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.
A presence animation in one line, run by the compositor Code: const FadeUp = kinetic('div').preset(fadeUp), used as <FadeUp show={() => open()}>. When open() turns true a card fades and slides up into a list; later it fades out before unmounting. A timeline underneath shows the main thread doing two small steps (apply styles across a double requestAnimationFrame, then transitionend) while the compositor runs the transform and opacity transition. @PYREON/KINETIC · PRESENCE Panel.tsx const FadeUp = kinetic('div') .preset(fadeUp) <FadeUp show={() => open()}> open() → false open() → true Saved draft main thread compositor 2× rAF transitionend transform + opacity the enter, zoomed in no JavaScript animation loop · reduced motion jumps to the end state
  • 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 →
why teams pick it

Motion that is cheap to run and easy to write.

  1. 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 define FadeUp once at module scope and fork variants from it.

  2. The browser does the animating

    Kinetic applies the start and end styles (or classes) across a double requestAnimationFrame and waits for transitionend. Animate transform, opacity and filter and the work stays on the compositor thread.

  3. Height: auto, animated

    .collapse() animates between 0 and the content's measured height, then sets height: auto so the content stays responsive. The content stays in the DOM, so find-in-page and screen readers still reach it.

  4. 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 difference

The same panel, with less ceremony.

React + Motion

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>
  )
}
Pyreon + kinetic

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

Coming from Motion (AnimatePresence)?

Enter and exit for one element.

Motion (AnimatePresence)
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>
  )
}
Pyreon

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>
}
try it

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.

preset
const Box = kinetic('div').preset(fadeUp)
<Box show={() => shown()}>Hello</Box>  // shown: true

const Panel = kinetic('div').collapse()
<Panel show={() => open()}>…</Panel>  // open: true

Picking a preset replays its enter; Toggle runs the leave. With reduced motion on, kinetic skips the animation and only the state changes.

Hello

show: true

  • Invoice #1042 paid
  • New comment on Launch plan
  • Ada joined the team
  • Weekly report ready
what's included

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 transitionend never fires completes after timeout (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
recipes

Things to build with it.

An FAQ accordion

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>
  )
}
A "Saved" notice that comes and goes

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>
  )
}
A scroll reveal that search engines still read

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>
  )
}
api

Factory, presets, helpers.

Every export has a reference page with its signature, an example and the mistakes people make with it.

kinetic · 15
  • 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
hooks · 2
  • useTransitionState
  • useAnimationEnd
built-in presets · 7
  • presets
  • fade
  • scaleIn
  • slideUp
  • slideDown
  • slideLeft
  • slideRight
kinetic-presets · 9
  • presets
  • fadeUp
  • blurInUp
  • bounceIn
  • zoomIn
  • flipX
  • clipCircle
  • swingInTop
  • springIn
factories and utilities · 10
  • createFade
  • createSlide
  • createScale
  • createRotate
  • createBlur
  • compose
  • withDuration
  • withEasing
  • withDelay
  • reverse
good to know

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.

questions

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.

Everything that appears can arrive. Everything that leaves can go quietly.

bun add @pyreon/kinetic @pyreon/kinetic-presets
Read the motion guide