Motion
Motion in the kit is tokenised like everything else: durations and easings have
names, and components reference the names. One table —
packages/core/src/config/motion.ts —
is the source of truth for both animation drivers.
| Duration token | ms |
|---|---|
instant | 0 |
quick | 100 |
fast | 150 |
base | 200 |
slow | 300 |
deliberate | 450 |
ambient | 600 |
loop | 1000 |
| Easing token | Curve |
|---|---|
standard | ease-in-out |
decelerate | ease-out |
accelerate | ease-in |
gentle | ease |
linear | linear |
transition preset | Motion (web and native) |
|---|---|
fast | 150ms ease-in-out |
medium | 200ms ease-in-out |
slow | 300ms ease-in-out |
bouncy | spring (damping 10, mass 0.9, stiffness 100) |
pulse | 600ms ease-in-out |
spin | 700ms linear |
stripe | 180ms linear |
linear | 200ms linear |
ease | 200ms ease |
ease-in | 200ms ease-in |
ease-out | 200ms ease-out |
ease-in-out | 200ms ease-in-out |
Read the primitives from @knitui/core:
import { DURATIONS, EASINGS, MOTION_PRESETS } from "@knitui/core";The transition prop
transition names a preset from the table above. With Tamagui v3 a preset is the
same motion on every driver: the web CSS driver and the native Reanimated
driver are both built from MOTION_PRESETS, so transition="bouncy" is one
spring on iOS, Android and the web.
<Box transition="fast" bg="color2 hover:color3" />Use the object form to restrict or retime it:
<Box
transition={{ preset: "fast", properties: "transform, opacity", enter: "medium", exit: "fast" }}
/>
<Box transition={{ preset: "ease-out", duration: 250 }} /> // keep the curve, retime it
<Box transition="100ms ease-out" /> // a duration is plain CSS
<Box transition="none" /> // set, never animateproperties replaces v2's animateOnly: a property the transition does not name
is set rather than animated. transition="none" animates nothing and completes
exits immediately.
Enter and exit
Mount and unmount styles are clauses on the properties they change — there are no
enterStyle / exitStyle objects:
<AnimatePresence>
{open ? (
<Box key="panel" transition="medium" opacity="1 enter:0 exit:0" y="0 enter:8px exit:8px" />
) : null}
</AnimatePresence>Raw lengths inside a clause need units (8px); a bare 8 would be read as a
token name.
To act when a transition finishes, use onTransition:
<Box
transition="medium"
onTransition={({ phase, cause, finished }) => {
if (phase === "end" && cause === "exit") cleanUp();
}}
/>phase is "start" or "end"; cause is "enter", "exit" or "update".
Presets
A motion preset pairs a transition with enter / exit values, so "fade in" means the same thing everywhere:
import { motionPresets, useMotionPreset } from "@knitui/components";
const motion = useMotionPreset("fade");useMotionPreset resolves a named recipe to plain props (a transition plus the
matching enter: / exit: clauses) that you pass to an animated frame, with
reduced motion already applied. Overlay components (Popover, Tooltip,
HoverCard, Modal, Drawer) accept a preset by name through their animation
prop, and they animate out before unmounting — which is why they share one
transition engine rather than each running their own timer.
The interactive playground — tweak any prop from the Controls panel.
Loading example…
Press feedback
import { usePressScale } from "@knitui/components";usePressScale is the shared press-down animation: a small scale on the UI thread
via Reanimated on native, a CSS transform on the web. Every control in the kit uses
it, so press feedback is consistent and never runs on the JS thread.
Two implementations, one contract
| Platform | Mechanism |
|---|---|
| Native | Reanimated worklets on the UI thread |
| Web | CSS transitions and requestAnimationFrame painters |
That split is why animation code inside the kit is platform-split (.native.tsx
/ .web.tsx) rather than branching at runtime — a worklet cannot be conditionally
compiled.
Reduced motion
useReducedMotion() reads the OS setting on both platforms, and the kit's own
transitions already respect it: durations collapse to instant rather than being
skipped, so nothing ends up mid-transition.
import { useReducedMotion } from "@knitui/hooks";Height transitions
Animating height is the hard case, because the natural height has to be measured
first. Collapse and Spoiler share one implementation (CollapseBox) that
measures with the content pinned absolute, then animates a clip — on native by
hand with Reanimated, on the web through a real CSS transition.
If you write your own and it never opens, the measurement came back as zero because the content was already clipped. See Troubleshooting.