Table of Contents

Method UseFocusRing

Namespace
Velvet
Assembly
Velvet.Docs.dll

UseFocusRing()

Exposes an element's focus state — and specifically keyboard/gamepad-visible focus, as distinct from pointer focus — as re-rendering component state. Pass Ref as the target element's refCallback:. For pure styling, the focus-visible: class variant already covers the same distinction without a hook — reach for this when the component must RENDER differently (e.g. a "press A to select" hint), not just restyle.

When composing Ref with other per-element work in one callback, wrap the composed lambda in Hooks.UseCallback: a per-render lambda is a fresh identity each render, so every patch would cycle the ref (cleanup on a still-focused element, then re-setup) — the same re-render feedback an inline ref that writes state on every render would produce.

public static FocusRing UseFocusRing()

Returns

FocusRing