@shivamjadhav28/timeline-track
v0.1.9
Published
Enterprise-ready React timeline component with project ranges and milestones.
Downloads
736
Maintainers
Readme
Timeline Track
Enterprise-ready React timeline component for projects and milestones, with status-aware colors and range navigation.

Install
npm i @shivamjadhav28/timeline-trackUsage
import { TimelineTrack, type Project } from '@shivamjadhav28/timeline-track';
const relativeDate = (offset: number) => {
const d = new Date();
d.setDate(d.getDate() + offset);
return d;
};
const projects: Project[] = [
{
id: 'active-01',
projectName: 'Active Sprint', // Currently happening
projectStart: relativeDate(-2),
projectEnd: relativeDate(5),
status: 'in-progress',
milestones: [
{ id: 'm1', name: 'Design Fix', endDate: relativeDate(0), status: 'completed' },
{ id: 'm2', name: 'API Integration', endDate: relativeDate(2), status: 'pending' },
],
},
{
id: 'done-02',
projectName: 'Completed Task', // Entirely in the past
projectStart: relativeDate(-10),
projectEnd: relativeDate(-5),
status: 'completed',
milestones: [
{ id: 'm3', name: 'Handover', endDate: relativeDate(-6), status: 'success' },
],
},
{
id: 'late-03',
projectName: 'Overdue Project', // End date passed but not marked completed
projectStart: relativeDate(-8),
projectEnd: relativeDate(-1),
status: 'pending',
milestones: [
{ id: 'm4', name: 'Missed Deadline', endDate: relativeDate(-2), status: 'pending' },
],
},
{
id: 'future-04',
projectName: 'Upcoming Launch', // Entirely in the future
projectStart: relativeDate(2),
projectEnd: relativeDate(7),
status: 'pending',
milestones: [
{ id: 'm5', name: 'Kickoff', endDate: relativeDate(3), status: 'pending' },
],
},
];
export default function Example() {
return <TimelineTrack projects={projects} />;
}Props
projects(required):Project[]viewDate:Date(controlled view date)onViewDateChange:(date: Date) => voidwindowDays: number (default7)showTodayLine: boolean (defaulttrue)showHeader: boolean (defaulttrue)title: string (defaultTeam Roadmap)prevLabel: string (defaultDay)nextLabel: string (defaultDay)todayLabel: string (defaultToday)className: stringstyle:CSSProperties(root container)theme: design token overrides (colors, sizes, spacing)
Theme
type TimelineTheme = {
colors?: Partial<TimelineColors>;
spacing?: {
padding?: number;
headerPadding?: number;
};
sizes?: {
sidebarWidth?: number;
rowHeight?: number;
rangeIconSize?: number;
};
};Types
export type MilestoneStatus =
| 'completed'
| 'success'
| 'cancelled'
| 'pending'
| 'in-progress';
export interface Milestone {
id: string;
name: string;
endDate: Date;
status: MilestoneStatus;
}
export interface Project {
id: string;
projectName: string;
projectStart: Date;
projectEnd: Date;
milestones: Milestone[];
}Status Rules
- Project is green if all milestones are
completedorsuccess. - Project is red if end date is past today and not all milestones are complete.
- Milestone is red if status is
in-progressand end date is past today.
Build
npm run buildPublish
If you use npm 2FA, publish with a Granular Access Token (recommended):
- Create a token on npmjs.com:
- Scope:
@shivamjadhav28 - Permissions: Read and Publish
- 2FA: bypass publish
- Scope:
- Login with the token:
npm logout npm login --auth-type=legacy- Username:
shivamjadhav28 - Password: paste the token
- Email: your npm email
- Username:
- Bump version and publish:
npm version patch npm publish --access public
Check who you’re logged in as:
npm whoamiLicense
MIT
