Lists support built-in keyboard navigation using the useNavigation hook. This creates an accessible, keyboard-friendly experience following WAI-ARIA patterns.
Use the navigation prop to enable or disable keyboard navigation:
<List ariaLabel="example" navigation={true}>
<ListButtonItem headline="Headline 1" onClick={() => {}} />
<ListButtonItem headline="Headline 2" onClick={() => {}} />
<ListButtonItem headline="Headline 3" onClick={() => {}} />
</List>
When navigation is false, each item is a separate tab stop:
<List ariaLabel="example" navigation={false}>
<ListButtonItem headline="Headline 1" onClick={() => {}} />
<ListButtonItem headline="Headline 2" onClick={() => {}} />
<ListButtonItem headline="Headline 3" onClick={() => {}} />
</List>
When navigation is enabled:
| Key | Action |
|---|---|
| Arrow Down | Move to next item |
| Arrow Up | Move to previous item |
| Arrow Right | Move to next item |
| Arrow Left | Move to previous item |
| Enter / Space | Activate the focused item |
| Tab | Move focus out of the list |
Navigation wraps around - pressing down on the last item moves to the first.
The navigation system uses tabIndex management:
This follows the WAI-ARIA grid layout pattern.
With navigation enabled:
With navigation disabled:
Always provide an ariaLabel for the list:
<List ariaLabel="Search results" navigation={true}>
{/* items */}
</List>
<List ariaLabel="User menu options" navigation={true}>
{/* items */}
</List>
This helps screen reader users understand the list's purpose.
Enable navigation for:
Disable navigation for:
Lists use the useNavigation hook internally:
// Simplified internal implementation
function List({ navigation = true, children, ariaLabel }) {
const rootRef = useNavigation({ enabled: navigation });
return (
<ul ref={rootRef} aria-label={ariaLabel}>
{children}
</ul>
);
}
See the useNavigation documentation for more details on the underlying hook.