A shared Motion-powered highlight that slides between items on hover, or fades per-item on click. React component.
Made by AxylA shared pill highlight slides between nav items on hover — move slowly to see the spring.
A per-item fade background activated on click, useful for menus and sidebars.
One motion.div lives inside the container and slides to whichever item is active. This is the same pattern used by the sidebar hover highlight.
Each item renders its own motion.div overlay. Framer Motion's layoutId animates between items on click.
| Prop | Type | Default |
|---|---|---|
mode? | "parent" | "children" | "children" |
trigger? | "hover" | "click" | "click" |
value? | string | null | - |
defaultValue? | string | null | - |
onValueChange? | (value: string | null) => void | - |
className? | string | - |
style? | CSSProperties | - |
transition? | Transition | { type: "spring", stiffness: 350, damping: 35 } |
exitDelay? | number | 0 |
disabled? | boolean | false |
containerClassName? | string | - |
boundsOffset? | Partial<{ top: number; left: number; width: number; height: number }> | - |
| Prop | Type | Default |
|---|---|---|
value? | string | - |
disabled? | boolean | false |
activeClassName? | string | - |
className? | string | - |
style? | CSSProperties | - |
transition? | Transition | - |
asChild? | boolean | false |
Use mode="parent" for navigation bars, tab rows, and any horizontal/vertical list where you want one smooth background element sliding between items. The spring physics make the motion feel natural even when the cursor skips quickly across items.
Use mode="children" for menus, sidebars, and selection lists where each item independently fades in its background. The shared layoutId cross-fades between items on click.
Avoid using trigger="hover" with mode="children" and widely-spaced items — the per-item fade-in/out can feel noisy. In that case, prefer mode="parent" which slides a single element.
HighlightItem sets aria-selected and data-active on each item wrapper. The highlight overlay itself is decorative (pointer-events-none) and invisible to assistive technologies. Keyboard navigation is not wired automatically — connect it via the controlled value/onValueChange API if needed.
When prefers-reduced-motion: reduce is set, useReducedMotion() collapses the transition to duration: 0 — the highlight still moves to the active item's bounds, just instantly instead of animating.
Built by Axyl. A motion-first component registry for React.
Last updated: 9/14/2026