# gantt-holidays

> Gantt timeline marks holidays and excludes them from working-day task calculations.

**Framework:** react  **Component:** Gantt  **Variant:** holidays

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/react/ts/gantt-holidays.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-react-gantt
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/gantt-holidays/Gantt.tsx

```tsx
import { GanttComponent, type TaskFieldsModel, Inject, Selection, DayMarkers, HolidaysDirective, HolidayDirective, ColumnsDirective, ColumnDirective, type LabelSettingsModel } from '@syncfusion/ej2-react-gantt';
import { projectNewData } from '../datasource/gantt-data';

const Holidays = () => {
  const taskFields: TaskFieldsModel = {
    id: 'TaskID',
    name: 'TaskName',
    startDate: 'StartDate',
    endDate: 'EndDate',
    duration: 'Duration',
    progress: 'Progress',
    dependency: 'Predecessor',
    parentID: 'ParentId'
  };
  const labelSettings: LabelSettingsModel = {
    rightLabel: 'TaskName'
  };
  const splitterSettings = {
    columnIndex: 1
  };
  const projectStartDate: Date = new Date('03/25/2025');
  const projectEndDate: Date = new Date('07/20/2025');
  return (
    <div className='control-pane'>
      <div className='control-section'>
        <GanttComponent id='Holidays' dataSource={projectNewData} highlightWeekends={true} treeColumnIndex={1}
          taskFields={taskFields} labelSettings={labelSettings} height='650px' taskbarHeight={25} rowHeight={46}
          projectStartDate={projectStartDate} projectEndDate={projectEndDate} splitterSettings={splitterSettings}>
          <ColumnsDirective>
            <ColumnDirective field='TaskID' visible={false} width='80' ></ColumnDirective>
            <ColumnDirective field='TaskName' width='280'></ColumnDirective>
            <ColumnDirective field='StartDate'></ColumnDirective>
            <ColumnDirective field='EndDate'></ColumnDirective>
            <ColumnDirective field='Duration'></ColumnDirective>
            <ColumnDirective field='Predecessor'></ColumnDirective>
            <ColumnDirective field='Progress'></ColumnDirective>
          </ColumnsDirective>
          <HolidaysDirective>
            <HolidayDirective from='03/28/2025' to='03/28/2025' label='Good Friday'></HolidayDirective>
            <HolidayDirective from='03/30/2025' to='03/30/2025' label='Easter Sunday'></HolidayDirective>
            <HolidayDirective from='05/26/2025' to='05/26/2025' label='Memorial Day'></HolidayDirective>
            <HolidayDirective from='07/04/2025' to='07/04/2025' label='Independence Day'></HolidayDirective>
          </HolidaysDirective>
          <Inject services={[Selection, DayMarkers]} />
        </GanttComponent>
      </div>
    </div>
  )
}
export default Holidays;
```
