useGlide()
The primary hook to inspect active transitions, mutate configuration dynamically, monitor lifecycle states, and programmatically orchestrate navigation.
Signature & State
Call useGlide() in any client component rendered inside <GlideCNProvider> to read transition state and trigger runtime changes.
const { currentTransition, setTransition, config, setConfig, animationState, reducedMotion, transitionDefinition,} = useGlide();useGlide() Return Object
currentTransitionstringThe machine name of the currently active transition preset (e.g. "slide", "circular-portal").
setTransition(name: string) => voidImperatively switches the active transition before or during route navigation.
The fully merged active configuration object (duration, delay, ease, direction, stagger, custom).
setConfigDynamically updates transition timing, easing, or directional parameters at runtime.
animationState"idle" | "entering" | "exiting" | "complete"Current lifecycle phase of the page transition.
reducedMotionbooleanWhether reduced motion accessibility mode is currently active.
transitionDefinitionDirect reference to the registered transition definition metadata and variant builders.
Return Property Guides
Detailed explanations and code examples for each property and mutator returned by useGlide().
Real-World Recipes
Practical patterns for multi-step wizards, direction orchestration, and preference controllers.
import { useGlide } from '@/components/glidecn';import { useRouter } from 'next/navigation';export function StepControls({ step }: { step: number }) { const { setTransition, setConfig } = useGlide(); const router = useRouter(); const handleNext = () => { setTransition('slide'); setConfig({ direction: 'left' }); router.push(`/wizard/step-${step + 1}`); }; const handleBack = () => { setTransition('slide'); setConfig({ direction: 'right' }); router.push(`/wizard/step-${step - 1}`); }; return ( <div className="flex gap-4"> <button onClick={handleBack}>Back</button> <button onClick={handleNext}>Next</button> </div> );}