Knit UI
GitHub

Playground

Loading playground…

true
false
Playground
<Transition
  mounted
  transition="fade"
  duration={250}
  timingFunction="ease"
  keepMounted={false}
/>

Examples

Controlled

Toggle mounted on and off to watch the animation play.

Loading example…

ControlledSourceStorybook

All Presets

Every built-in transition preset side by side — click Show/Hide to compare.

Loading example…

All PresetsSourceStorybook

Keep Mounted

keepMounted keeps the child in the DOM (display:none) instead of unmounting it.

Loading example…

Keep MountedSourceStorybook

With Delays

Enter and exit delays let you stagger reveals — useful for sequential animations.

Loading example…

With DelaysSourceStorybook

Slow Motion

Slow duration makes it easy to observe the transition in detail.

Loading example…

Slow MotionSourceStorybook

Props

PropTypeDefaultDescription
children required(styles: TransitionStyle) => ReactElementRender function that receives the computed transition styles.
mounted requiredbooleantrueWhether the child should be visible/mounted.
durationnumber | undefined250Enter transition duration in ms.
enterDelaynumber | undefinedDelay in ms before the enter transition starts.
exitDelaynumber | undefinedDelay in ms before the exit transition starts.
exitDurationnumber | undefineddurationExit transition duration in ms (defaults to `duration`).
keepMountedboolean | undefinedfalseWhen true the child stays in the DOM with `display:none` after exiting rather than being unmounted.
onEnter(() => void) | undefinedCalled when the enter transition starts.
onEntered(() => void) | undefinedCalled when the enter transition ends.
onExit(() => void) | undefinedCalled when the exit transition starts.
onExited(() => void) | undefinedCalled when the exit transition ends.
timingFunctionstring | undefined
ease · ease-in · ease-out · ease-in-out · linear
"ease"CSS transition timing function.
transitionMantineTransition | undefined
fade · fade-up · fade-down · fade-left · fade-right · scale · scale-y · scale-x · skew-up · skew-down · rotate-left · rotate-right · slide-down · slide-up · slide-left · slide-right · pop · pop-top-left · pop-top-right · pop-bottom-left · pop-bottom-right
"fade"Transition preset name (or a custom style object).