<Editor> component renders a task edit form that opens when a task is activated. It can be displayed as a sidebar panel or a modal dialog. It connects to the Gantt through the shared IApi instance.
Import
Basic usage
Props
The Gantt API instance. Obtain it from the
init callback or a ref on <Gantt>. Required to read the active task and dispatch save/delete actions.Custom field definitions for the editor form. When non-empty, replaces the default set of fields. When empty, the default fields from
getEditorItems() are used.Controls where the editor is rendered.
'sidebar' positions it alongside the Gantt chart; 'modal' opens it as an overlay dialog.Layout variant passed to the underlying editor widget.
When
true, all fields are rendered as read-only text and no save/delete buttons are shown in the top bar.When
true, changes are saved immediately as each field is edited. When false, changes are buffered and only committed when the Save button is clicked.Controls the editor’s top action bar. Pass
true to show the default Close/Delete buttons (and Save when autoSave is false). Pass false to hide the top bar entirely. Pass a configuration object to provide custom buttons.Controls the editor’s bottom action bar. Pass
true for the default bar, false to hide it, or a configuration object for custom buttons.When
true, focus is moved to the first input field when the editor opens.Additional keyboard shortcut handlers merged with the default hotkeys. The default hotkeys include
Ctrl+Z and Ctrl+Y for undo/redo when undo is enabled on the Gantt.Additional CSS class names appended to the editor container element.
Helper functions
getEditorItems(options?)
Returns the default array of editor field definitions. Use this to obtain the full set and then add, remove, or modify individual fields before passing the result to the items prop.
defaultEditorItems
The static default editor item array. Useful as a reference for the available field keys.
Default field keys
| Key | Component | Description |
|---|---|---|
text | text | Task name |
type | select | Task type (task / summary / milestone) |
start | date | Start date |
end | date | End date |
duration | counter | Duration in days (or hours) |
progress | slider | Completion percentage |
details | text | Free-text notes field |
links | links | Dependency links panel |
Registering custom field components
UseregisterEditorItem to register any React component as an editor field type. Once registered, reference it by name in the comp field of an item definition.
Configuring fields
Reordering and filtering default fields
Adding a custom field
Sidebar vs modal
Validation
Add avalidation function and optional validationMessage to any item definition. The function receives the current field value and must return true when valid.
Validation runs on every change when
autoSave is true, and on save when autoSave is false. If any field is invalid, the task is not saved.