Components · Data Display
Resource Timeline
One row per person, days across: rosters, team leave and allocation, with totals in the footer.
import { ResourceTimeline } from '@nexub/react';Usage
Who is where, day by day: rosters, leave, shifts, allocation.
A few weeks across and up to a few dozen people.
Events at times of day: use EventCalendar.
Rows with many fields that sort and filter: use DataTable.
Playground
Props
| Name | Monday, November 2 | Tuesday, November 3 | Wednesday, November 4 | Thursday, November 5 | Friday, November 6 | Saturday, November 7 | Sunday, November 8 | Monday, November 9 | Tuesday, November 10 | Wednesday, November 11 | Thursday, November 12 | Friday, November 13 | Saturday, November 14 | Sunday, November 15 | Total |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Ana LimaDesign | AL | AL | 2 | ||||||||||||
| Ben OdeEngineering | Sick | 1 | |||||||||||||
| Cho ParkSupport | 0 | ||||||||||||||
| Total | 1 | 1 | 1 | 3 |
<ResourceTimeline resources={people} range={range} now={new Date(2026, 10, 9)} getCell={…} onCellActivate={…} footer={…} rowTotal={…} grandTotal={Object.keys(cells).length} label="Team leave, November 2026" />Examples
Team leave
Enter or a click on a cell toggles leave; your app opens its own editor there.
Read-only roster
Without `onCellActivate` it is a plain table, and the scroller takes focus so the days can be scrolled.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| labelrequired | string | — | Names the table, e.g. "Team leave, November". |
| resourcesrequired | TimelineResource[] | — | { id, label, description?, avatar? }, one row each. The first column stays put while the days scroll. |
| rangerequired | { from: Date; to: Date; } | — | The days shown, both ends included. |
| getCell | ((resourceId: string, date: Date) => ResourceCell) | — | A cell’s content. tone (neutral, primary, success, warning, error, info) colours it; value must say what it means too. |
| onCellActivate | ((resourceId: string, date: Date, cell: HTMLElement) => void) | — | Makes the cells a grid: arrow keys move between them, Enter, Space or a click calls this, e.g. to open your editor anchored to cell. |
| footer | ((date: Date) => React.ReactNode) | — | A totals row: one cell per day. |
| rowTotal | ((resourceId: string) => React.ReactNode) | — | A total column at the end, and its footer cell. |
| grandTotal | React.ReactNode | — | A total column at the end, and its footer cell. |
| resourceHeader | React.ReactNode | — | The first column’s header. |
| weekend | number[] | [0, 6] | Days of the week shaded as weekend (0 = Sunday). |
| now | Date | new Date() | Marks today. Pin it in tests and screenshots. |
| className | string | — |
Accessibility
Keyboard
- Tab
Enters the grid at the last focused cell (one Tab stop).
- Arrow keys
Move between people and days (left and right follow the reading direction).
- Home / End
First or last day in the row; with Ctrl, the first or last cell.
- Enter / Space / F2
Calls `onCellActivate` for the cell.
Notes
A real table: column headers read the full date, row headers the person, so each cell is announced with both.
With `onCellActivate` the table has `role="grid"` and roving focus; without it, a plain table in a focusable scroll region.
Today’s header has `aria-current="date"` and a filled day number; weekends are shaded and still read their weekday.