Components
Toolbar
Toolbar is a view that displays toolbar items. Toolbar provides a consistent way to display actions and controls, typically at the bottom of the screen.
Toolbar is a view that displays toolbar items. Toolbar provides a consistent way to display actions and controls, typically at the bottom of the screen.
Examples
Basic Usage
Preview unavailable for this example in the static docs build.
Show code
<Toolbar items={[
{ content: <Button>Back</Button>, placement: 'navigation' },
{ content: <Button>Cancel</Button>, placement: 'cancellationAction' },
{ content: <Text style={{ fontWeight: 'bold' }}>Title</Text>, placement: 'principal' },
{ content: <Button>Done</Button>, placement: 'confirmationAction' },
]}></Toolbar>With Destructive Action
Preview unavailable for this example in the static docs build.
Show code
<Toolbar items={[
{ content: <Button>Back</Button>, placement: 'navigation' },
{ content: <Button>Cancel</Button>, placement: 'cancellationAction' },
{ content: <Text style={{ fontWeight: 'bold' }}>Edit</Text>, placement: 'principal' },
{ content: <Button>Delete</Button>, placement: 'destructiveAction' },
]}></Toolbar>API
| Prop | Type | Required | Description |
|---|---|---|---|
items | IToolbarItem[] | Yes | Toolbar items |
Inherits additional props from IBaseElementComponent<'div'>.
Overview
Toolbar is a view that displays toolbar items. Toolbar provides a consistent way to display actions and controls, typically at the bottom of the screen.
SwiftUI Correspondence: Similar to SwiftUI's .toolbar() modifier.
With Destructive Action
Include destructive actions:
Notes
- Toolbar renders as a horizontal
role="toolbar"region. - Use
aria-labeloraria-labelledbyso assistive technology can describe the toolbar purpose. - Toolbar requires an array of items with
contentandplacement. - Placement options:
navigation,cancellationAction,principal,automatic,confirmationAction,destructiveAction. - Toolbar groups items by placement and keeps the placement order stable.
- Toolbar is commonly used at the bottom of screens.
- Toolbar provides consistent spacing and alignment.
Best Practices
- Placement: Use appropriate placement for each action
- Consistency: Maintain consistent toolbar patterns
- Destructive actions: Use
destructiveActionplacement for dangerous actions - Accessibility: Ensure toolbar items are accessible
- Mobile: Consider mobile interaction patterns when designing toolbars