all AI news
Make an Animated Menu like Stripe with React, Tailwind, and AI
Nov. 3, 2023, 3:41 p.m. | Yoav Ganbar
DEV Community dev.to
Written by Steve Sewell.
How does Stripe make this awesome morphing menu animation?
Let’s recreate this in React with just a few lines of logic:
```ts
const [hovering, setHovering] = useState(null);
const [popoverLeft, setPopoverLeft] = useState(null);
const [popoverHeight, setPopoverHeight] = useState(null);
const refs = useRef<(HTMLElement | null)[]>([]);
const onMouseEnter = (index: number, el: HTMLElement) => {
setHovering(index);
setPopoverLeft(el.offsetLeft);
const menuElement = refs.current[index];
if (menuElement) {
setPopoverHeight(menuElement.offsetHeight);
}
};
```
We’ll also use AI and Tailwind to create the markup, …
ai animated animation logic null react steve stripe tailwindcss webdev
More from dev.to / DEV Community
Jobs in AI, ML, Big Data
Software Engineer for AI Training Data (School Specific)
@ G2i Inc | Remote
Software Engineer for AI Training Data (Python)
@ G2i Inc | Remote
Software Engineer for AI Training Data (Tier 2)
@ G2i Inc | Remote
Data Engineer
@ Lemon.io | Remote: Europe, LATAM, Canada, UK, Asia, Oceania
Artificial Intelligence – Bioinformatic Expert
@ University of Texas Medical Branch | Galveston, TX
Lead Developer (AI)
@ Cere Network | San Francisco, US