Toolbar
Toolbar groups controls into one tab stop. Tab to it, then move with the
arrow keys, Home and End:
Pressed: nothing yet
import { Paragraph, View } from '@hozo/core'import { Button, Toolbar } from '@hozo/ui'import { useState } from 'react'
export function ToolbarDemo() { const [last, setLast] = useState('nothing yet') return ( <View className="items-start gap-3"> <Toolbar accessibilityLabel="Formatting" items={[ { render: (props) => ( <Button {...props} tone="quiet" size="sm" onPress={() => setLast('Bold')}> Bold </Button> ), }, { render: (props) => ( <Button {...props} tone="quiet" size="sm" onPress={() => setLast('Italic')}> Italic </Button> ), }, { disabled: true, render: (props) => ( <Button {...props} tone="quiet" size="sm" disabled> Strikethrough </Button> ), }, ]} /> <Paragraph className="text-sm text-hozo-text-body">{`Pressed: ${last}`}</Paragraph> </View> )}items:{ render, disabled? }for each control.renderis given the props that make the control part of the toolbar: a rovingtabIndex, the key handler, a focus handler and a ref. Spread them onto your control, as the example does withButton.- One tab stop. Tab enters the toolbar on the control used last, and leaves it on the next Tab. A disabled item is skipped.
orientationishorizontalby default, so Left and Right move.verticaluses Up and Down.wrapmakes the ends wrap around.accessibilityLabelnames the toolbar, so a reader hears what the controls are for.