RovingFocus
One Tab stop for a group of controls; the arrow keys move between them. The pattern of toolbars, radio groups and grids of options.
import { RovingFocus } from '@sypnia/ui/react'
On this page
A group of three
Code
import { Button, RovingFocus } from '@sypnia/ui/react';
// Tab reaches the group once; the arrows move inside it.
export default function Group() {
return (
<RovingFocus label="Align" className="sy-row">
<Button size="sm" icon="align-left">Left</Button>
<Button size="sm" icon="align-center">Centre</Button>
<Button size="sm" icon="align-right">Right</Button>
</RovingFocus>
);
} When to use it
Use it when
- A group of related controls of your own.
Do not use it when
- Toolbar, RadioGroup and Tabs: they already rove.
For everyone
- Left and Right (or Up and Down) move; Home and End go to the ends; the group has a name.
Props
| RovingFocus | Type | Default |
|---|---|---|
className | string | |
label | string | |
loop | boolean | true |
orientation | "both" | "horizontal" | "vertical" | horizontal |