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
initPathInitial path for server-side rendering. Specifies which route to render initially.
optional
defaultTransitionNameDefault transition name to use for route changes when no specific transition is defined. Defaults to "cupertino".
optional
transitionsArray of custom transitions to register with the router.
optional
decoratorsArray of custom decorators to register with the router.
Route
Defines a route and its associated component
<Route
path: Path | Path[]
element: ReactNode
/>
Props
required
pathThe URL path pattern to match, based on path-to-regexp. Can be a single path or array of paths.
required
elementThe 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.
Each page component must be wrapped with Screen for transitions to work properly.