04.03 · Micro-Interactions

Focus Ring Animation

A ring closes in around the item the Tab key reaches. Best for forms and menus.

Press Tab

Click the first field and press Tab to move through the form, or press Show me.

Try it

Change a setting, then try it again or press Show me.

Ring style

Glow adds a soft halo; Wide fills the gap with color.

Speed

How quickly the ring closes in around the item.

Ring thickness

Thicker rings are easier to spot.

More optionsFewer options

Ring gap

The space between the ring and the item.

Copy the prompt

Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.

Add an animated focus ring to [the links, buttons and form fields on your page]. When keyboard focus moves to an item, draw an outline around it that starts a little further out and faint, then closes in to its place, so each Tab press is easy to follow. Show the ring only for keyboard focus, not after mouse clicks, and never remove the browser's focus outline without drawing this one instead. Make sure the ring stands out against every background it sits on. If the visitor has reduced motion turned on, show the ring at once without closing in. Match the settings listed below.

Replace the words in brackets with your own element. Your settings are added at the end.

Free and open source. If this helped, a star on GitHub helps other people find it.

Star on GitHub

What it is

The full explanation is in README.md.

Good for

  • Forms
  • Buttons
  • Links
  • Menus

Avoid on

  • Non-interactive items