Skip to content

Focus

The focus ring shows keyboard users where they are. Every control that can take focus must show it. Use this page to add the ring to your own controls.

The ring has two parts:

  • an inner ring in ink (--rp-color-focus-inner). It carries the contrast: at least 3:1 against the surface in both themes.
  • a halo in gold (--rp-color-focus-halo) around it. It is decoration and is exempt from contrast.

The inner ring is a CSS outline, so it stays visible in Windows high-contrast mode, where shadows are removed. The halo is a shadow.

Add .rp-focusable to the control. The ring appears on :focus-visible, which means keyboard focus, not a mouse click. Libraries that manage focus themselves can set data-focus-visible instead.

<button class="rp-material-secondary rp-focusable">Export</button>
  • Never remove the ring with outline: none unless you draw the same ring another way.
  • Do not clip it. Leave room for the halo, or the parent’s overflow: hidden will cut it off.
  • Show focus on the control itself, not on a wrapper around it.

In each panel the first sample shows the ring as if it had focus. The second is live: press Tab to reach it.

Light, on canvas
Light, on raised
Dark, on canvas
Dark, on raised