# Gantt Table Head

A Gantt table head is the header section of a Gantt chart grid, wrapping one or more rows that label the columns of the chart. Typically contains a row with a task-name column header and time-period column headers (e.g., weeks, months, sprints). It is designed to be used inside a GanttTable `<table>` structure.

**Status:** beta — implemented and unit-tested in all seven frameworks with an axe-clean demo page; not yet exercised in composed flows.

The component renders a `<thead>` element and passes through its children, which are expected to be GanttTableTr or `<tr>` elements containing `<th>` header cells.

## Implementation Notes

- Renders as a `<thead>` element for the header section of a Gantt chart grid
- Children should be one or more rows with `<th>` cells labeling the task column and time-period columns
- Designed to be used inside a GanttTable `<table>` structure
- Spreads `restProps` onto the `<thead>` element for consumer customization
- No internal state -- purely a structural wrapper

## Props

- `children`: slot (required) -- header rows containing column labels for tasks and time periods
- `...restProps`: Any additional HTML attributes passed to the `<thead>` element

## Usage

```html
<GanttTable label="Q1 2025 schedule">
  <GanttTableHead>
    <GanttTableTr>
      <GanttTableTH scope="col">Task</GanttTableTH>
      <GanttTableTH scope="col">Jan</GanttTableTH>
      <GanttTableTH scope="col">Feb</GanttTableTH>
      <GanttTableTH scope="col">Mar</GanttTableTH>
    </GanttTableTr>
  </GanttTableHead>
  <GanttTableBody>...</GanttTableBody>
</GanttTable>
```

## Keyboard Interactions

None -- this component is a passive container. Keyboard navigation is handled by the parent GanttTable grid.

## ARIA

- Implicit `rowgroup` role from the `<thead>` element -- groups the header rows of the grid

## When to Use

- Use inside GanttTable to provide the `<thead>` header section.
- Use to label the task-name column and time period columns (e.g., weeks, months, sprints).
- Use when the Gantt chart needs clearly labelled column headers for accessibility.

## When Not to Use

- Do not use outside of a GanttTable structure -- use TableHead or DataTableHead for general tables.
- Do not use for body or footer rows -- use GanttTableBody or GanttTableTfoot instead.

## Headless

This headless component provides a `<thead>` element with implicit `rowgroup` role for grouping header rows within a Gantt chart grid. The consumer provides all visual styling including header background, typography, and column alignment.

## Styles

The consumer provides all CSS styling. The component renders with a `.gantt-table-thead` class for targeting. No default styles are included — this is a fully headless component.

## Testing

- Verify the component renders a `<thead>` element with class `gantt-table-thead`
- Verify pass-through attributes are applied

## Advice

- **Designers**: Make header labels concise and readable. For long timelines, consider multi-row headers (e.g., months on one row, weeks on another).
- **Developers**: Use `<th>` elements inside GanttTableTr children for proper header cell semantics. Add `scope="col"` to column headers for screen reader clarity.

## Related components

- `gantt-table` — a Gantt chart table interactive grid for planning schedule visualization <table>
- `gantt-table-tbody` — see components.tsv
- `gantt-table-tfoot` — see components.tsv
- `gantt-table-tr` — see components.tsv
- `gantt-table-th` — a Gantt chart table interactive grid header cell for planning schedule visualization <th>
- `gantt-table-td` — a Gantt chart table interactive grid data cell for planning schedule visualization <td>

## Known limitations

Not in the Web Components catalog, by design. A custom element between a `<table>` and its sections, rows or cells
breaks the content model, and the only form that avoids it, a customized built-in element, does not work in Safari. Without a
framework, write the native element with this component's class hook, or use the HTML catalog's markup. See
[the Web Components spec](https://github.com/LilyDesignSystem/lily-design-system/blob/main/lily-design-system-web-components-headless/spec/index.md).

## References

- WAI-ARIA Grid Pattern: https://www.w3.org/WAI/ARIA/apg/patterns/grid/

---

Lily™ and Lily Design System™ are trademarks.
