@@ -144,6 +144,84 @@ npm start
144144
145145\* Required
146146
147+ ## Extra Columns Support
148+
149+ You can add custom columns to the task list by using the ` extraColumns ` prop:
150+
151+ ``` javascript
152+ import { Gantt , Task , ExtraColumn } from ' gantt-task-react' ;
153+
154+ // Define extra columns
155+ const extraColumns: ExtraColumn [] = [
156+ {
157+ key: " status" ,
158+ title: " Status" ,
159+ width: " 100px" ,
160+ },
161+ {
162+ key: " assignee" ,
163+ title: " Assignee" ,
164+ width: " 120px" ,
165+ },
166+ {
167+ key: " priority" ,
168+ title: " Priority" ,
169+ width: " 80px" ,
170+ render : (task ) => (
171+ < span className= {` priority-${ task .extraColumns ? .priority }` }>
172+ {task.extraColumns?.priority}
173+ </span>
174+ ),
175+ },
176+ ];
177+
178+ // Add extra data to your tasks
179+ const tasks: Task[] = [
180+ {
181+ id: "1",
182+ name: "Task 1",
183+ start: new Date(),
184+ end: new Date(),
185+ progress: 50,
186+ type: "task",
187+ extraColumns: {
188+ status: "In Progress",
189+ assignee: "John Doe",
190+ priority: "High",
191+ },
192+ },
193+ ];
194+
195+ <Gantt
196+ tasks={tasks}
197+ extraColumns={extraColumns}
198+ nameColumnWidth="200px"
199+ fromColumnWidth="130px"
200+ toColumnWidth="130px"
201+ />
202+ ` ` `
203+
204+ ### ExtraColumn Interface
205+
206+ | Parameter Name | Type | Description |
207+ | : ------------ - | : -------------------------------------- | : ---------------------------------------------------------------------- - |
208+ | key\* | string | Unique key for the column, used to access data in task .extraColumns |
209+ | title\* | string | Column header title |
210+ | width | string | Column width (e .g ., " 100px" , " 120px" ). Defaults to listCellWidth |
211+ | render | ` (task: Task) => React.ReactNode` | Optional custom render function for complex column content |
212+
213+ ### Column Width Configuration
214+
215+ You can customize the width of the default columns:
216+
217+ | Parameter Name | Type | Description |
218+ | :---------------- | :----- | :----------------------------------------------- |
219+ | nameColumnWidth | string | Width of the Name column (e .g ., " 200px" ) |
220+ | fromColumnWidth | string | Width of the From/Start date column (e.g., "130px") |
221+ | toColumnWidth | string | Width of the To/End date column (e.g., "130px") |
222+
223+ \*Required
224+
147225## License
148226
149227[MIT](https:// oss.ninja/mit/jaredpalmer/)
0 commit comments