Grain Gradient Nav
- group .........
- Menus and navigation
- source ........
- https://ui.aryank.space/components/grain-gradient-nav
- markdown ......
- /lab/grain-gradient-nav.md
- human .........
- /lab/grain-gradient-nav
── WHAT_IT_IS ────────────────────────────────────────────────────────────────────────────────
A floating header pill you can drag by its dot handle, that opens into a mega menu. Hovering the wordmark or a link opens a panel beneath the bar; running along the menu slides one strip sideways while its height retargets, so the whole thing reads as a single surface reshaping rather than as panels swapping. Scrolling collapses the links to zero width and shrinks the pill to the wordmark until you hover it again, and the contact panel is wider than the others, so opening it widens and re-centres the bar in the same motion. Ships the two-column link panels with arrow chips, the contact panel with a working enquiry form (text, email, option pills, textarea, drag-and-drop attachments, consent), and the Grain Gradient Field shader as the pill's surface.
── BEHAVIOUR ────────────────────────────────────────────────────────────────────────────────
* One strip, not four panels
Every panel sits side by side in a single row that slides horizontally, while the wrapper's height animates to the panel you moved to. Both use the same 0.8s cubic-bezier(0.5, 0, 0, 1), which is what fuses a sideways slide and a vertical resize into one gesture instead of two.
* The slide only animates between panels
Opening from closed snaps the strip into place with no transition. Animating on the way in would drag it across from wherever the last hover left it, which reads as the menu rewinding.
* The pill is max-content wide, so collapsing centres itself
Scroll collapses the link list to zero width; because the bar is sized by its contents and centred with a transform, it re-centres for free. Deriving the bar's width from its own measured box instead feeds the min-width straight back into the next measurement and the bar grows without bound.
* The strip is absolutely positioned for a sizing reason
Four panels of nowrap links in a flex row would set the max-content width of the bar to the sum of all of them. Taking the strip out of flow lets it contribute height but never width.
* Dragging moves position, not a transform
The handle writes into top/left rather than a translate, because the panel below has to recompute how much vertical room is left as the bar moves. A transform would leave that measurement stale.
* Closing is a hover, not a click
A full-screen overlay sits behind the bar while a panel is open and closes it on mouse-enter; the drag handle closes it too. There is nothing to dismiss and no click target to find.