Skip to main content
The Toolbar component renders a row of action buttons above the Gantt chart. When connected via the api prop it automatically enables and disables built-in buttons based on the current selection and chart state.

Basic setup

Place Toolbar before the Gantt element so it renders above the chart. Adjust the height of the chart container to account for the toolbar’s height.

Toolbar props

IApi
The Gantt API object. Connects the toolbar so built-in button states (enabled/disabled) track the chart selection.
IButtonConfig[]
Array of button descriptors. Overrides the default button set.

Default toolbar buttons

The defaultToolbarButtons array and the getToolbarButtons() helper give you a copy of the built-in button configuration:
Built-in button IDs: Separators between button groups use { comp: "separator" }.

Customising the button list

Call getToolbarButtons() to get a modifiable copy of the defaults, then filter or extend it before passing to Toolbar:

Fully custom toolbar

You can build a completely custom toolbar by constructing the items array yourself and wiring handlers that call api.exec:
When building a custom toolbar without the api prop, use api.getReactiveState().selected to derive reactive selection state for conditional button visibility.

Button config fields

string
Unique identifier for the button. Used to match the action dispatched when the button is clicked.
'button' | 'icon' | 'separator'
required
The control type. "button" renders a labelled button, "icon" renders an icon-only button, "separator" renders a visual divider.
string
Button label (for comp: "button") or keyboard shortcut hint (for comp: "icon").
string
Icon class name (e.g. "wxi-plus").
string
Visual style variant, e.g. "primary", "secondary", "danger".
() => void
Click handler for custom buttons. Built-in buttons handle their own actions automatically.
(task, state, target?) => boolean
Function returning true to disable the button based on the current task, state, or target.
(task, state, target?) => boolean
Function returning true to hide the button based on the current task, state, or target.