<GlideCN>
The framework-specific router adapter that listens to navigation events, freezes exiting DOM contexts using FrozenRouter to eliminate white flashes, and manages scroll restoration.
Adapter & Architecture
<GlideCN> coordinates the transition lifecycle between leaving and entering pages.
When a route change occurs, it locks the exiting view using the FrozenRouter pattern, executes exit variants, remembers scroll position in sessionStorage, and smoothly mounts the incoming view without layout jumps.
import { GlideCNProvider, GlideCN } from '@/components/glidecn';export default function RootLayout({ children }: { children: React.ReactNode }) { return ( <html lang="en"> <body> <GlideCNProvider defaultTransition="slide"> {/* Next.js App Router Adapter */} <GlideCN mode="wait" restoreScroll={true}> {children} </GlideCN> </GlideCNProvider> </body> </html> );}GlideCN Properties
childrenRequiredReact.ReactNodeThe active router or view elements. Must be wrapped inside GlideCN to orchestrate Framer Motion AnimatePresence.
mode"wait" | "sync" | "popLayout"AnimatePresence sequencing mode. "wait" ensures the exiting view finishes its exit animation before the new view mounts; "sync" animates both simultaneously; "popLayout" pops exiting nodes from document flow.
"wait"restoreScrollbooleanAutomatically caches window scroll coordinates in sessionStorage per route and restores them on navigation and back/forward history.
truerouteKeystringExplicit key representing current route. Auto-detected from pathname or router.asPath if omitted. Useful for tab sub-routes.
auto-detected (pathname)classNamestringCSS classes applied to the intermediate motion container rendered inside AnimatePresence.
"w-full flex-1 flex flex-col"Property Guides
Fine-tune transition modes, configure custom route keys for subroutes, and manage scroll restoration behavior.