Skip to content

Timeline

A flexible and composable component for displaying chronological events in a vertical timeline. Supports icons, avatars, badges, user info, time display, grouping, hoverable/clickable items, collapsible sections, and manual composition.


Import

tsx
import { Timeline } from '@odyssee/components';
// Helpers: Timeline.Item, Timeline.Heading

Examples

Basic Timeline

Code Éditable
Résultat

Icon Variants

Code Éditable
Résultat

With User Information

Code Éditable
Résultat

Time Display

Code Éditable
Résultat

Grouped by Date

Code Éditable
Résultat

Hoverable and Clickable Items

Code Éditable
Résultat

Collapsible Timeline

Code Éditable
Résultat

Manual Composition

Code Éditable
Résultat

Props Table

Timeline Props

PropTypeDefaultDescription
itemsTimeline.ItemData[]Array of timeline items (data-driven).
groupedbooleanfalseEnable grouping by headings (e.g., date).
groupsTimeline.Group[]Array of groups (each with heading and items).
showTimebooleanfalseShow time for each item.
timePosition"left" | "right""left"Position of time display.
hoverablebooleanfalseMake items hoverable/clickable.
collapsiblebooleanfalseEnable collapsible timeline (show only recent items).
collapsedItemsCountnumber3Number of items to show before collapsing.
collapseLabelstring"Show older"Label for collapse button.
lineColorstring— (deprecated)Line color (fixed in Preline).
dotColorstringDot color for timeline items.
childrenJSX.Element | JSX.Element[]Manual composition of timeline (Timeline.Item, Timeline.Heading).
classNamestringAdditional CSS classes.
idstringauto-genHTML id attribute.
stylestringInline styles.

Timeline.Item Props

PropTypeDefaultDescription
titlestring | JSX.Element— (required)Title of the event.
descriptionstring | JSX.ElementDescription/details of the event.
icon"dot" | "avatar" | "icon" | "badge""dot"Icon type for the item.
iconContentJSX.ElementCustom icon content (for "icon" type).
avatarstringAvatar image URL (for "avatar" type).
initialsstringInitials for badge/avatar.
user{ name: string; avatar?: string; initials?: string; onClick?: () => void }User info to display below the item.
timestringTime string to display.
showTimebooleanShow time for this item.
timePosition"left" | "right""left"Position of time display for this item.
hrefstringLink URL for clickable item.
onClick() => voidClick handler for the item.
hoverablebooleanfalseMake this item hoverable/clickable.
isLastbooleanfalseMarks the last item (deprecated, use CSS selector).
lineColorstring— (deprecated)Line color (fixed in Preline).
dotColorstringDot color for this item.
classNamestringAdditional CSS classes.
idstringauto-genHTML id attribute.
stylestringInline styles.

Timeline.Heading Props

PropTypeDefaultDescription
childrenstring | JSX.Element— (required)Heading text or element.
classNamestringAdditional CSS classes.
idstringauto-genHTML id attribute.
stylestringInline styles.

Implementation Notes

  • Variants:
    • "dot": Default small dot.
    • "avatar": User avatar image.
    • "badge": Initials in a badge.
    • "icon": Custom icon element.
  • Grouping: Use grouped and groups for date or category grouping.
  • Hoverable/Clickable: Use hoverable, href, and onClick for interactive items.
  • Collapsible: Show only recent items, with a button to expand older events.
  • Manual Composition: Use <Timeline>, <Timeline.Heading>, and <Timeline.Item> for full control.
  • User Info: Display user name, avatar, or initials below the event.
  • Time Display: Show time on left or right of each item.

Accessibility

  • Timeline uses semantic <div>, <h3>, and <button>/<a> elements.
  • Interactive items are keyboard-accessible and use ARIA roles as appropriate.
  • Labels and descriptions should be clear for screen readers.
  • Ensure color contrast for icons, dots, and text.

Best Practices

  • Use Timeline for activity feeds, changelogs, project history, or event logs.
  • Group items by date or category for clarity.
  • Use avatars and badges for user attribution.
  • Make items clickable for navigation or details.
  • Use collapsible timelines for long histories.
  • Prefer manual composition for complex layouts.


Released under the MIT License.