1 | interface Input {
|
2 | /**
|
3 | * Enable or disable this component's focus, while still maintaining its position in the list of focusable components.
|
4 | */
|
5 | isActive?: boolean;
|
6 | /**
|
7 | * Auto focus this component, if there's no active (focused) component right now.
|
8 | */
|
9 | autoFocus?: boolean;
|
10 | }
|
11 | interface Output {
|
12 | /**
|
13 | * Determines whether this component is focused or not.
|
14 | */
|
15 | isFocused: boolean;
|
16 | }
|
17 | /**
|
18 | * Component that uses `useFocus` hook becomes "focusable" to Ink,
|
19 | * so when user presses <kbd>Tab</kbd>, Ink will switch focus to this component.
|
20 | * If there are multiple components that execute `useFocus` hook, focus will be
|
21 | * given to them in the order that these components are rendered in.
|
22 | * This hook returns an object with `isFocused` boolean property, which
|
23 | * determines if this component is focused or not.
|
24 | */
|
25 | declare const useFocus: ({ isActive, autoFocus }?: Input) => Output;
|
26 | export default useFocus;
|