Editor component renders a side panel (or modal) that lets users view and edit task properties. It connects to the Gantt chart through the shared api object.
Basic setup
Editor must receive the same api instance as Gantt. Using bind:this={api} on Gantt is the simplest way to achieve this.Editor props
The Gantt API object. Connects the editor to the chart so it can read and write task data.
Array of editor field descriptors. Overrides the default set of fields rendered in the panel.
Controls where the editor appears. Use
"modal" to open it as a centred dialog.When
true, changes are saved automatically as the user edits fields. Set to false to require an explicit save action.Show or hide the title bar at the top of the editor. Pass
false to remove it entirely.Configuration for the button bar at the bottom of the editor. Accepts an
items array of toolbar-style button descriptors.Default editor items
ThedefaultEditorItems array defines the built-in fields shown in the editor. You can import it directly or call getEditorItems() to get a fresh copy that has task-type options populated from the current config.
| Key | Component | Notes |
|---|---|---|
text | text | Task name |
details | textarea | Description |
type | select | Task type; hidden for segment tasks |
start | date | Start date; hidden for summary tasks |
end | date | End date; hidden for summary and milestone tasks |
duration | counter | Duration; hidden for summary and milestone tasks |
progress | slider | Progress percentage; hidden for milestones |
links | links | Dependency links; hidden for segment tasks |
Editor item fields
Each item in theitems array is an object with the following properties:
The control type. Built-in values:
"text", "textarea", "date", "counter", "slider", "combo", "select", "multiselect", "radio", "checkbox", "links", "twostate".The task property this field reads from and writes to.
Display label shown above the field.
Function that returns a dynamic label based on the current field value.
Control-specific configuration options (e.g.
{ format: "%d-%m-%Y" } for date fields, { min: 1, max: 100 } for sliders).Function that returns
true to hide the field for a particular task.Function that returns
true to disable the field for a particular task and state.Customising the field list
UsegetEditorItems() to start from the defaults, then filter, reorder, or extend the array:
Custom controls
You can register your own Svelte components as editor controls withregisterEditorItem. The registered name is then used as the comp value in an item descriptor.
Field validation
Addrequired to make a field mandatory, or provide a validation function and an optional validationMessage for custom rules:
Readonly mode
To open the editor in a non-editable view, passreadonly to the Gantt component. You can also selectively disable individual fields using the isDisabled callback on each item: