Helpers
Focus ring
The ring that shows where keyboard focus is. Every Moey component already has one; these classes give it to your own elements, in any color.
<div class="cluster">
<a href="#focus-ring" class="focus-ring link-reset bg-1 rounded px-3 py-2">focus-ring</a>
<a href="#focus-ring" class="focus-ring theme-green link-reset bg-1 rounded px-3 py-2">theme-green</a>
<a href="#focus-ring" class="focus-ring theme-red link-reset bg-1 rounded px-3 py-2">theme-red</a>
<a href="#focus-ring" class="focus-ring-inset link-reset bg-1 rounded px-3 py-2">focus-ring-inset</a>
</div>
Press Tab to move through them. The ring shows for the keyboard only — a mouse click doesn't draw it.
Ring the whole box
focus-within-ring rings a whole box when anything inside it has keyboard focus — a search field with buttons, a custom input made of parts.
/
<div class="focus-within-ring hstack gap-2 bg-surface rounded-lg px-3 py-2 border max-w-md">
<i class="mi mi-search text-muted"></i>
<input class="flex-1 min-w-0 bg-transparent border-0 p-0" placeholder="Search…" aria-label="Search">
<kbd>/</kbd>
</div>
| Class | What it does |
|---|---|
focus-ring | a ring outside the edge on keyboard focus |
focus-ring-inset | a ring inside the edge (in clipped or scrolling boxes) |
focus-within-ring | a ring around the box when something inside has keyboard focus |
theme-<color> | the ring's color |