No.47 · Buttons
Draw Link
A text link whose underline follows your hand: it draws in from the side you arrive on and leaves out the far side, like a stroke passing under the words.
The prompt
Written for the variant you picked above: In a sentence
Build a text link with an underline that travels. The underline is a pseudo-element under the text (height max(1px, 0.07em), accent colour) scaled on X from 0. On mouseenter, detect which half of the link the pointer entered from and set data-from; the underline grows from that side (transform-origin left or right) over 520ms on cubic-bezier(0.65,0,0.35,1). On mouseleave, detect the exit side and shrink the line toward it — so a pointer passing through left-to-right draws the stroke in from the left and wipes it out to the right, like a pen passing under the word. A small ↗ arrow nudges up-right and brightens. Focus shows the full underline and a soft ring. On touch the underline rests at 40% opacity so links are recognisable. Selected variant — In a sentence (editorial): In a sentence: three links inside a large Instrument Serif sentence (clamp 1.9–3rem, muted #a7a1ab text) — "Currently building Vitrine, writing about interface motion, and studying at GUtech." — each with its ↗ arrow. This selection takes precedence over references to other themes or options in the general brief. Implement this selected appearance; do not add a variant picker or alternative appearances unless requested. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: Hover from either side: the underline enters from that side and exits through the side you leave. Motion: 520ms ease-in-out scaleX with a direction-dependent origin; arrow nudge 520ms expo-out. Accessibility: A real link; focus-visible shows the underline and a ring. Reduced motion makes it instant. Responsive behavior: Scales with its font size (em-based line and arrow). Touch: Underline rests visible at reduced opacity. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.
Notes
- Interaction
- Hover from either side: the underline enters from that side and exits through the side you leave.
- Motion
- 520ms ease-in-out scaleX with a direction-dependent origin; arrow nudge 520ms expo-out.
- Accessibility
- A real link; focus-visible shows the underline and a ring. Reduced motion makes it instant.
- Responsive
- Scales with its font size (em-based line and arrow).
- On touch
- Underline rests visible at reduced opacity.