FocusableElement

The FocusableElement component is a wrapper component that makes an element focusable.

A wrapper component that makes an element focusable. The element must be a child of a FocusableGroup component and the HTML tag used as wrapper must be focusable, for example, input, button, a, select, textarea, etc.

Props

The FocusableElement component will receive all HTML attributes and events for the HTML tag used as wrapper. Some important props are:

NameTypeDefaultDescription
idstring-The element id. Must be unique
asstringdivThe HTML tag to be used as wrapper
onFocusfunction-Callback function to be called when the element receives focus. It returns a object with focus result that includes prev, current and direction
onBlurfunction-Callback function to be called when the element loses focus. It returns a object with focus result that includes next, current and direction
nextUp / nextDown / nextRight / nextLeftstringNextFocusableThe next element or group by direction. In the case of group, must be an object { kind: 'group', id: 'group-0 }
ordernumber-The order of the element. No default value. This is needed when the group is setted to navigate byOrder. If no setted, byOrder will be ignored.