Watch the address bar. Current path: /glyphnav/astro/docs/
Docs
Install the package — Astro stays a peer dependency:
pnpmaddglyphnav
Attach once in a shared layout's bundled client script:
---import{ClientRouter}from'astro:transitions';---<head><ClientRouter/></head><script> import {navigate} from 'astro:transitions/client'; import {attachGlyphnav} from 'glyphnav/astro';// Bundled scripts run once, even across ClientRouter swaps. const glyph = attachGlyphnav(navigate, {duration:250});// await glyph.navigate('/about/', { history: 'replace' });</script>
Or animate only explicit navigation and selected links:
constglyph=attachGlyphnav(navigate,{intercept:'none'});awaitglyph.navigate('/about/',{history:'replace',state:{from:'docs'}});// Opt one anchor into animation:constunlink=glyph.link(document.querySelector('a'));unlink();glyph.detach();// remove listeners and cancel animation
Animation and interception options:
attachGlyphnav(navigate,{duration:250,// total animation time in millisecondseffect:'scramble',// 'decode' or 'scramble'commit:'before',// 'after' animates before navigatingintercept:'links',// 'none' animates only explicit callsscope:'tail',// preserve the common path prefixanimatePopState:true,// opt into browser back/forward animation});
Served under the /astro base with Astro's ClientRouter. attachGlyphnav(navigate) animates eligible links and awaits Astro's real navigation. The title link returns to the picker with a full page load.