Beta
This hook handles focus with the keyboard arrows.
Roving focus definition
function MyComponent() { const [rootElement, setRootElement] = setRootElement(null) useRovingFocus({ rootElement: rootElement, }) return ( <div ref={setRootElement}> <button>Button</button> <button>Button</button> <button>Button</button> </div> )} Copy
function MyComponent() { const [rootElement, setRootElement] = setRootElement(null) useRovingFocus({ rootElement: rootElement, }) return ( <div ref={setRootElement}> <button>Button</button> <button>Button</button> <button>Button</button> </div> )}
This hook handles focus with the keyboard arrows.