tsimport {XDSToolbar} from '@xds/core/Toolbar'
| Guidance | Practices |
|---|---|
| Do | Put secondary actions like "Back" on the left, and primary actions like "Save" on the right. |
| Do | Make temporary toolbars like bulk selection visually distinct so users can tell they're contextual — for example, with a background color or border. |
| Do | Visually separate the toolbar from the content below it — with a divider, a background variant, or both. |
| Do | Use Toolbar as a card header when the header has interactive actions like filter or add — it gives you slot layout, keyboard navigation, and size cascading. If the header is just a title with no actions, a LayoutHeader or Section is enough. |
| Don't | Put too many actions in one toolbar — move less common items into a MoreMenu. |
| Don't | Set size on individual child buttons — set it once on the toolbar and it cascades automatically. |
| Don't | Use Toolbar for app-wide navigation like main menu links or sign out — use TopNav or LayoutHeader for that. |
| Prop | Type | Description |
|---|---|---|
labelrequired | string | Accessible label for the toolbar, applied as aria-label. |
startContent | ReactNode | Content aligned to the start (left in LTR). |
centerContent | ReactNode | Centered content. Switches layout to CSS grid (1fr auto 1fr). |
endContent | ReactNode | Content aligned to the end (right in LTR). |
density | 'compact' | 'default' (default: 'default') | Toolbar density. Controls minimum height. |
gap | SpacingStep (default: 2) | Gap between items within each slot. |
orientation | 'horizontal' | 'vertical' (default: 'horizontal') | Orientation for keyboard navigation. Controls arrow key direction. |
variant | XDSSectionVariant (default: 'transparent') | Visual variant passed to XDSSection. |
xstyle | StyleXStyles | StyleX styles for layout customization. Must be a stylex.create() value. |