Try 'magnetic button'
View code

Specification

Catalogue
No. 15 of 110
Interaction
Text Animation
Element
Text
Preview
Live component
Imports
react 19.3.1
Added

Notes

An underline draws itself under the phrase that matters, then a ring around one fact, once.

It points at what matters in reading order, then rests. Underline and ring only: no solid highlight behind the words.

Underline draws in 0.7s after 0.2s; the ring in 0.8s after 1s; cubic-bezier(.65, 0, .35, 1). Starts when 60% is in view; drawn at once under reduced motion. One or two marks per page, in the brand colour.

The names, figures and pictures in the demo are sample content; a real build uses the client's own.

Code

React and plain CSS
"use client";

import { useRef } from "react";
import { useArrived } from "@/components/pieces/motion-helpers";
import type { LivePreviewProps } from "@/components/live/types";
import { PieceStage } from "@/components/pieces/stage/PieceStage";
import "./marker-text.css";

function MarkerTextDemo() {
  const ref = useRef<HTMLDivElement>(null);
  const arrived = useArrived(ref, 0.6);
  return (
    <div className="dm">
      <div ref={ref} className="mk" data-drawn={arrived || undefined}>
        <h2 className="mk-h">
          Physio for runners who want to{" "}
          <span className="mk-mark">
            keep running
            <svg viewBox="0 0 200 20" preserveAspectRatio="none" aria-hidden="true">
              <path d="M3 12c40-6 92-9 134-6 22 1.6 42 3.4 60 1.6" pathLength={1} />
            </svg>
          </span>
        </h2>
        <p className="mk-p">
          Most clients are seen the{" "}
          <span className="mk-ring">
            same week
            <svg viewBox="0 0 120 44" preserveAspectRatio="none" aria-hidden="true">
              <path d="M70 5C36 1 6 8 5 22c-1 14 30 19 60 18 30-1 51-8 50-20C114 9 92 3 60 4" pathLength={1} />
            </svg>
          </span>
          , and every plan is written down for you to take home.
        </p>
      </div>
    </div>
  );
}

export default function MarkerTextEntry(props: LivePreviewProps) {
  return (
    <PieceStage {...props} label="Hand-drawn emphasis" sample replay>
      <MarkerTextDemo />
    </PieceStage>
  );
}

More like this

Sweeping headline phrase

Text AnimationText and code

Statement that reads with the scroll

Scroll, Text AnimationText and code

Cookie choice that folds away

FeedbackOverlays and toasts

Read more that glides open

Layout AnimationText and code

Steps that scroll past a picture that holds

ScrollPage sections

File upload with progress per file

Loading, FeedbackForms and inputs