API Reference

Complete reference for all React Motion Router components, hooks, and utilities. Everything you need to build smooth navigation experiences.

Router
The main router component that wraps your application
<Router
initPath?: string
defaultTransitionName?: TransitionName
transitions?: Transition[]
decorators?: Decorator[]
>
{children}
</Router>

Props

optional
initPath

Initial path for server-side rendering. Specifies which route to render initially.

optional
defaultTransitionName

Default transition name to use for route changes when no specific transition is defined. Defaults to "cupertino".

optional
transitions

Array of custom transitions to register with the router.

optional
decorators

Array of custom decorators to register with the router.

Route
Defines a route and its associated component
<Route
path: Path | Path[]
element: ReactNode
/>

Props

required
path

The URL path pattern to match, based on path-to-regexp. Can be a single path or array of paths.

required
element

The React element (page component) to render when this route matches.

Screen
Required wrapper component for page components to enable transitions
<Screen>
{children}
</Screen>

Props

extends
ComponentPropsWithRef<"div">

Inherits all standard div props with ref support.