Timeline
Timeline shows ordered events, milestones, or audit history.
@duskmoon-dev/components/timeline Usage
When to use
- Use it when users need to scan structured content and act on individual records.
- Prefer it over ad hoc markup when the content has repeatable fields, hierarchy, or navigation state.
Implementation notes
Features
Designed for repeated or hierarchical content where users scan, compare, and inspect details.
Documents the props that control sorting, selection, expansion, pagination, or value changes where available.
Timeline is most often configured through `items`, `mode`, `pending`, `reverse`.
Renders item children with default timeline classes
Feature Demos
Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.
Colors
Timeline supports the full semantic color palette: primary, secondary, tertiary, accent, neutral, base, info, success, warning, error.
import "@duskmoon-dev/components/styles.css";
import { Timeline } from "@duskmoon-dev/components/timeline";
const colors = [
"primary",
"secondary",
"tertiary",
"accent",
"neutral",
"base",
"info",
"success",
"warning",
"error"
] as const;
export function TimelineColorsDemo() {
return (<Timeline
items={colors.map((color, index) => ({
label: `${index + 1}`,
children: `${color} milestone`,
color
}))}
/>);
} Basic usage
Import the component stylesheet and Timeline from its package subpath, then render it with the core props.
import "@duskmoon-dev/components/styles.css";
import { Timeline } from "@duskmoon-dev/components/timeline";
export function Example() {
return (<Timeline
items={[
{ label: "09:00", children: "Kickoff and scope review", color: "primary" },
{ label: "11:30", children: "Design QA completed", color: "success" },
{ label: "14:00", children: "Release notes prepared", color: "secondary" }
]}
/>);
} Renders item children with default timeline classes
test-backedTimeline scenario from the component test coverage: renders item children with default timeline classes.
import "@duskmoon-dev/components/styles.css";
import { Timeline } from "@duskmoon-dev/components/timeline";
export function TimelineRendersItemChildrenWithDemo() {
return (<Timeline
items={[
{ label: "09:00", children: "Kickoff and scope review", color: "primary" },
{ label: "11:30", children: "Design QA completed", color: "success" },
{ label: "14:00", children: "Release notes prepared", color: "secondary" }
]}
/>);
} Supports className and alternate mode
test-backedTimeline scenario from the component test coverage: supports classname and alternate mode.
import "@duskmoon-dev/components/styles.css";
import { Timeline } from "@duskmoon-dev/components/timeline";
export function TimelineSupportsClassNameAndAlternateDemo() {
return (<Timeline
items={[
{ label: "09:00", children: "Kickoff and scope review", color: "primary" },
{ label: "11:30", children: "Design QA completed", color: "success" },
{ label: "14:00", children: "Release notes prepared", color: "secondary" }
]}
/>);
} Supports label, color, dot, pending, and reverse
test-backedTimeline scenario from the component test coverage: supports label, color, dot, pending, and reverse.
import "@duskmoon-dev/components/styles.css";
import { Timeline } from "@duskmoon-dev/components/timeline";
export function TimelineSupportsLabelColorDotDemo() {
return (<Timeline
items={[
{ label: "09:00", children: "Kickoff and scope review", color: "primary" },
{ label: "11:30", children: "Design QA completed", color: "success" },
{ label: "14:00", children: "Release notes prepared", color: "secondary" }
]}
/>);
} Forwards root ref
test-backedTimeline scenario from the component test coverage: forwards root ref.
import "@duskmoon-dev/components/styles.css";
import { Timeline } from "@duskmoon-dev/components/timeline";
export function TimelineForwardsRootRefDemo() {
return (<Timeline
items={[
{ label: "09:00", children: "Kickoff and scope review", color: "primary" },
{ label: "11:30", children: "Design QA completed", color: "success" },
{ label: "14:00", children: "Release notes prepared", color: "secondary" }
]}
/>);
} Theme aware
Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.
<div data-theme="sunshine">
<Timeline
items={[
{ label: "09:00", children: "Kickoff and scope review", color: "primary" },
{ label: "11:30", children: "Design QA completed", color: "success" },
{ label: "14:00", children: "Release notes prepared", color: "secondary" }
]}
/>
</div>
<div data-theme="moonlight">
<Timeline
items={[
{ label: "09:00", children: "Kickoff and scope review", color: "primary" },
{ label: "11:30", children: "Design QA completed", color: "success" },
{ label: "14:00", children: "Release notes prepared", color: "secondary" }
]}
/>
</div> API
The API reference below lists every parsed exported type or interface for Timeline. Start with `items`, `mode`, `pending`, `reverse` for common usage.
packages/components/src/components/timeline/Timeline.types.ts
Scenarios: packages/components/src/components/timeline/Timeline.test.tsx | Prop | Type | Required | Description |
|---|---|---|---|
items | TimelineItem[] | No | items configures Timeline. |
children | ReactNode | No | children configures Timeline. |
mode | TimelineMode | No | mode configures Timeline. |
pending | ReactNode | boolean | No | pending configures Timeline. |
reverse | boolean | No | reverse configures Timeline. |
size | TimelineSize | No | size configures Timeline. |
| Prop | Type | Required | Description |
|---|---|---|---|
children | ReactNode | No | children configures Timeline. |
label | ReactNode | No | label configures Timeline. |
color | TimelineColor | No | color configures Timeline. |
dot | ReactNode | No | dot configures Timeline. |
pending | boolean | No | pending configures Timeline. |
className | string | No | className configures Timeline. |
"left" | "right" | "alternate" | "primary" | "secondary" | "tertiary" | "accent" | "neutral" | "base" | "info" | "success" | "warning" | "error" "sm" | "md" | "lg"