Use on a big title (48px and up) that greets or guides: eyes look at the pointer, at the focused control or at the element marked as target, blink on fast moves and smile on click.
When not to use
Not for small text, gradient or stroked titles, or dense data screens. For a calm title that only needs a mark use Pill Headline.
Use Counter Eyes on a large title that greets or guides the person: the welcome line of a dashboard, a sign-in card, an empty state. The closed counters of a few letters (the two o of "Good", for example) become eyes that look at the pointer, at the control that has focus or, at rest, at the next action. The title stays real text in your own font; nothing is added to the page tree. It is meant for titles of 48px and up, where a counter is big enough to hold a pupil. For body text, small headings or a title that must never draw attention, use plain text.
CounterEyes is the scope: it listens to the pointer, to focus and to clicks anywhere inside it. CounterEyes.Text goes inside your heading and wraps the text whose counters become eyes. Mark the element the eyes should look at when nobody is pointing with data-counter-eyes-target; without one they rest centered.
Counters are measured from the font your page actually renders, so no glyph shape is hard-coded. A letter is skipped when its counter is too small to read as an eye, and measurements are redone when web fonts finish loading or the text reflows.
preset chooses which letters get eyes: pair (default, two neighbours that read as a face), crowd (every letter with a closed counter, up to 12) or single (the biggest counter). letters and count override the preset.
Set the character for the whole app with MotionKitProvider, or per instance with temperament (calm, lively, playful). It changes motion intensity only, never the drawing.
The default demo: a finance workspace greets the person by name. The two o of "Good" follow the pointer anywhere in the card and, at rest, look at the primary action, marked with data-counter-eyes-target.
Move your pointerTouch and move
Ledgerly
Thu, 30 Oct
Good morning, Mara
Three expense reports are waiting for your approval. Everything else is on track.
Charge. The pointer enters the scope: the pupils change from muted-foreground to the text color in 120 ms and grow from a small size to full size, with the spring's overshoot.
Action. Each pupil slides toward the pointer on a spring, inside the real shape of its counter. It never touches the stroke.
Settle. When the pointer stops, the pupil arrives with weight: it runs into the stroke and flattens against it (up to 35% squash, scaled by intensity), then rebounds and rests. A fast flick of the pointer (above 1,200 px/s) blinks every eye: the counter closes to a thin slit and opens again, and the pupils pop back to size. A click or a tap makes the eyes smile for 400 ms.
At calm there is no overshoot, no squash and no blink; the gaze still travels and the smile still shows.
The title is real text. The eyes are an SVG with aria-hidden and pointer-events: none laid over it, so a screen reader announces the heading once, as written, and the text stays selectable. The component adds no role and no label.
The eyes carry no information. Anything the person needs must be in the text or the controls next to it.
Nothing in the component is focusable. The text is not a control and the focus rings of your inputs and buttons are untouched.
The text keeps your foreground color. The pupils use muted-foreground at rest, which meets AA on the page background, and the text color when awake. Both follow your theme in light and dark.
Limit: the eyes are drawn over the glyphs, so a title with a gradient fill or a text stroke will not match them. Use a solid color.
There is no key map. Focus drives the gaze instead: when a control inside the scope receives focus the eyes look at it, and when focus leaves they go back to the marked target. When a password input has focus, the eyes close.
With reduced motion the eyes are open and awake at once: pupils in the text color, centered in their counters, with no intro, no gaze, no overshoot, no blink and no smile. The picture is complete and static.
One requestAnimationFrame loop per scope, and only while something moves: the gaze, a squash, a blink or the smile. It stops once everything rests.
Only the pupil transform, the lid path and the pupil fill change. The SVG is absolutely positioned over the text, so nothing reflows.
The loop and its timers stop when the scope leaves the viewport or the tab is hidden. Off screen the counters are drawn closed; the first time the scope is visible they open once (intro={false} skips this and keeps them open).
Counters are measured once per glyph and font on an offscreen canvas and cached. The measurement is redone only when web fonts finish loading or the text size changes.
Touch has no hover: a touch on the scope makes the eyes look at the touched point, and a tap smiles. The component sets no touch-action, so the page scrolls as usual.
interactive={false} removes the pointer, focus and click handling; the eyes then rest on the marked target.
Technical sheet
Motion
calm
260 ms · bounce 0
lively
400 ms · bounce 0.3
playful
540 ms · bounce 0.45
Main spring of each temperament. Set it with the temperament prop or MotionKitProvider; the default is lively.
Size
Not measured yet · budget 15.0 kB gzip
Component and MotionKit helpers; excludes react, react-dom.
Dependencies
motion
Triggers
pointer movement, keyboard focus, press, entering the viewport
Reduced motion
Eyes open, pupils centred and still in the text color; no tracking, blink, squash, smile or intro.
Keyboard
Tab
The eyes look at the focused control; on a password field they close
Browsers
Last 2 versions of Chrome, Edge, Firefox and Safari (iOS 16.4+)