JGuang

Timeline

Timeline · Ant Design

Preview
npm install antd@6.6.5 @ant-design/icons@6.3.4 dayjs@1.11.23

Timeline

Vertical display timeline.

When To Use

  • When a series of information needs to be ordered by time (ascending or descending).
  • When you need a timeline to make a visual connection.

Examples

  • Basic · basic

  • Variant · variant

  • Loading and Reversing · pending

  • Alternate · alternate

  • Horizontal · horizontal

  • Custom · custom

  • End alternate · end

  • Title · title

  • Title Offset · title-span

  • Semantic Sample · semantic

  • Custom semantic dom styling · style-class

API

Common props ref:Common props

Timeline

PropertyDescriptionTypeDefaultVersionGlobal Config
classNamesCustomize class for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, string> | (info: { props })=> Record<SemanticDOM, string>-6.0.0
itemsEach node of timelineItems[]-×
modeBy sending alternate the timeline will distribute the nodes to the left and rightstart | alternate | endstart×
orientationSet the direction of the timelinevertical | horizontalvertical×
pendingSet the last ghost node's existence or its content. Use item.loading insteadReactNodefalse×
pendingDotSet the dot of the last ghost node when pending is true. Use item.icon insteadReactNode<LoadingOutlined />×
reverseWhether reverse nodes or notbooleanfalse×
stylesCustomize inline style for each semantic structure inside the component. Supports object or function.Record<SemanticDOM, CSSProperties> | (info: { props })=> Record<SemanticDOM, CSSProperties>-6.0.0
titleSpanSet the title span space. It is the distance to the center of the dot Native explanatory imagenumber | string12×
variantConfig style variantfilled | outlinedoutlined×

Items

Node of timeline.

PropertyDescriptionTypeDefault
colorSet the circle's color to blue, red, green, gray or other custom colorsstringblue
contentSet the contentReactNode-
childrenSet the content. Please use content insteadReactNode-
dotCustomize timeline dot. Please use icon insteadReactNode-
iconCustomize node iconReactNode-
labelSet the label. Please use title insteadReactNode-
loadingSet loading statebooleanfalse
placementCustomize node placementstart | end-
positionCustomize node position. Please use placement insteadstart | end-
titleSet the titleReactNode-

Semantic DOM

Timeline

Semantic nodeNative descriptionVersion
rootRoot element with timeline container list style reset, vertical layout, dot icon, outlined style, alternate layout and other basic container styles—
itemItem element with single timeline node relative positioning, margin, padding, font size, finish state, color theme, layout direction and other node basic styles—
itemWrapperItem wrapper element with timeline node content wrapping container styles—
itemIconItem icon element with node head icon absolute positioning, width/height size, background color, border, border radius, wave animation and other icon styles—
itemSectionItem section element with section container containing header and content flex layout, wrap, gap and other layout styles—
itemHeaderItem header element with header area layout containing title and rail, alignment, text direction and other styles—
itemTitleItem title element with node title text font size, line height, color and other text styles—
itemContentItem content element with node detail content relative positioning, top offset, left margin, text color, word break and other content styles—
itemRailItem rail element with timeline node connection track line absolute positioning, top offset, left offset, height, border color, width, style and other connection line styles—

Semantic description source: vendor/components/timeline/demo/_semantic.tsx

Timeline Items

Semantic nodeNative descriptionVersion
rootRoot element—
wrapperItem wrapper element—
iconItem icon element—
sectionItem section element—
headerItem header element—
titleItem title element—
contentItem content element—
railItem rail element—

Semantic description source: vendor/components/timeline/demo/_semantic_items.tsx

Design Token

Types, inheritance and declarations retain the pinned native source. Defaults are computed by the native theme and may be overridden by ConfigProvider; this table does not invent static defaults.

TokenTypeNative description
tailColor?stringLine color
tailWidth?number | stringLine width
dotBorderWidth?number | stringBorder width of node
dotSize?number | stringNode size
dotBg?stringBackground color of node
itemPaddingBottom?numberBottom padding of item

Declaration source: vendor/components/timeline/style/index.ts

import type { CSSObject } from '@ant-design/cssinjs';

import { resetComponent } from '../../style';

import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal';

import { genStyleHooks, mergeToken } from '../../theme/internal';

import { genCssVar } from '../../theme/util/genStyleUtils';

import genHorizontalStyle from './horizontal';

export interface ComponentToken {
  /**
   * @desc 轨迹颜色
   * @descEN Line color
   */
  tailColor?: string;
  /**
   * @desc 轨迹宽度
   * @descEN Line width
   */
  tailWidth?: number | string;
  /**
   * @desc 节点边框宽度
   * @descEN Border width of node
   */
  dotBorderWidth?: number | string;
  /**
   * @desc 节点大小
   * @descEN Node size
   */
  dotSize?: number | string;
  /**
   * @desc 节点背景色
   * @descEN Background color of node
   */
  dotBg?: string;
  /**
   * @desc 时间项下间距
   * @descEN Bottom padding of item
   */
  itemPaddingBottom?: number;
}

export interface TimelineToken extends FullToken<'Timeline'> {
  itemHeadSize: number;
  customHeadPaddingVertical: number;
  paddingInlineEnd: number;
}

Shared native props

Tips: The following generic properties apply to most antd components; those not supported are described separately.

PropertyDescriptionTypeDefault
styleThe additional styleCSSProperties-
classNameThe additional css classstring-
rootClassNameClassName on the root elementstring-
autoFocusAuto focus when component mounted, only effective for focusable elements like forms, links, etc.booleanfalse

Install and reproduce an example

npm install antd@6.6.5 @ant-design/icons@6.3.4 dayjs@1.11.23

Use ConfigProvider and native App; configure dayjs locale separately. Each example lists its complete source files and additional pinned dependencies in View code. Example names select demos, not universal component props. See the resource setup guide for theme, locale and SSR.

Native type references

The source viewer includes unchanged native implementations and the following source declarations. Inherited types remain in their native packages. English source comments are preserved as code reference.

  • vendor/components/timeline/Timeline.tsx
  • vendor/components/timeline/style/index.ts

Source and license

https://github.com/ant-design/ant-design/tree/4a39f54842eade4e565ab336ef6097cd7e723cdd

Original bilingual prose and executable examples are retained. Website-only embeds and token tables are expanded locally. Ant Design is MIT; separately listed dependency notices also apply. Upload previews block outbound requests and do not provide a backend.