import React from 'react'; import { render, Box, Text, useFocus, useInput, useFocusManager, } from '../../src/index.js'; function Focus() { const {focus} = useFocusManager(); useInput(input => { if (input === '1') { focus('1'); } if (input === '2') { focus('2'); } if (input === '3') { focus('3'); } }); return ( Press Tab to focus next element, Shift+Tab to focus previous element, Esc to reset focus. ); } type ItemProperties = { readonly id: number; readonly label: string; }; function Item({label, id}: ItemProperties) { const {isFocused} = useFocus({id}); return ( {label} {isFocused && (focused)} ); } render();