Id of the focusable element to track.
OptionalgroupOrOptions: string | FocusSetOptions
Focus group name or FocusSetOptions.
true when the element currently holds focus.
Track a TextInput — the same focusId the input registers with the
focus system:
function LoginForm() {
const focused = useFocusState('username');
return (
<Box flexDirection="column">
<TextInput focusId="username" value={username} onChange={setUsername} />
<Text dimColor>{focused ? 'editing username' : 'press Tab'}</Text>
</Box>
);
}
Track whether a focusable element currently holds focus.
Re-renders whenever focus moves; returns
truewhilefocusIdis the active focus target (optionally constrained to a focus group).