Components / Data display
Timeline
Events in order: a customer's visits, an order's status history (MUI Lab's Timeline).
import { Timeline } from "@stylhero/ui";
Example
Code
import { Timeline, CheckCircleIcon } from "@stylhero/ui";
function TimelineExample() {
return (
<Timeline events={[
{ title: "Order placed", time: "9:02", tone: "primary" },
{ title: "Parts shipped", description: "Two boxes", time: "Tue" },
{ title: "Delivered", time: "Thu", tone: "success", icon: <CheckCircleIcon /> },
]} />
);
}
Props
| Prop | Type | Default | Description |
|---|---|---|---|
events required |
TimelineEvent[] |
- | |
layout |
"left" | "alternate" |
"left" |
"alternate" puts events on both sides of the line on wide screens. |
Also takes every <ol> attribute (id, style, data-*, aria-*, event handlers…), passed to that element.
Types
type TimelineEvent = {
title: ReactNode;
description?: ReactNode;
/** Shown on the side: a time or date. */
time?: ReactNode;
/** Icon inside the dot. */
icon?: ReactNode;
tone?: "neutral" | "primary" | "success" | "accent" | "danger";
};
Generated from src/components/Timeline.tsx. Something wrong or missing? Open an issue.