--- localeCode: en-US order: 58 category: Show title: Timeline subTitle: Timeline icon: doc-timeline brief: Timeline component is used to display a series of information vertically. --- ## Demos ### How to import ```jsx import import { Timeline } from '@douyinfe/semi-ui'; ``` ### Basic Usage ```jsx live=true import React from 'react'; import { Timeline } from '@douyinfe/semi-ui'; () => ( First Node Content Second Node Content Third Node Content ) ``` ### Type You can use `type` to set the type of a time node, using one of: `default`,`ongoing`, `success`, `warning`, `Error`. The corresponding dot will have a corresponding color. ```jsx live=true import React from 'react'; import { Timeline } from '@douyinfe/semi-ui'; () => ( Processing Succeed Failed ) ``` ### Custom node You can use `dot` to customize icon, `color` to customize color or pass in `children` with style. ```jsx live=true import React from 'react'; import { Timeline } from '@douyinfe/semi-ui'; import { IconAlertTriangle } from '@douyinfe/semi-icons'; () => ( Default Style )} type='warning'>Customized Icon Customized Color Customized Node Style ) ``` ### Timeline Position Use `mode` to set the position of the timeline, using one of: `left`, `center`, `alternate`, `right`. #### Left (default) ```jsx live=true import React from 'react'; import { Timeline } from '@douyinfe/semi-ui'; () => ( First Node Content Second Node Content Third Node Content Forth Node Content ) ``` #### Center ```jsx live=true import React from 'react'; import { Timeline } from '@douyinfe/semi-ui'; () => ( First Node Content Second Node Content Third Node Content Forth Node Content ) ``` #### Alternate ```jsx live=true import React from 'react'; import { Timeline } from '@douyinfe/semi-ui'; () => ( First Node Content Second Node Content Third Node Content Forth Node Content ) ``` #### Right ```jsx live=true import React from 'react'; import { Timeline } from '@douyinfe/semi-ui'; () => ( First Node Content Second Node Content Third Node Content Forth Node Content ) ``` ### DataSource ```jsx live=true import React from 'react'; import { Timeline } from '@douyinfe/semi-ui'; import { IconAlertTriangle } from '@douyinfe/semi-icons'; () => ( Second Node Content, color:'pink', }, { time:'2019-05-14 18:34', extra:'Extra Information', dot:, content:'Third Node Content', type:'warning', }, { time:'2019-05-09 09:12', extra:'Extra Information', content:'Forth Node Content', type:'success', } ]} /> ) ``` ## API reference ### TimeLine | Properties | Instruction | type | Default | | ---------- | ------------------------------------------------------------------------------------------------------------- | -------------------------------------- | ------- | | className | Class name | string | - | | mode | The relative Position of the timeline and content | `left`\|`right`\|`center`\|`alternate` | `left` | | style | Inline style | CSSProperties | - | | dataSource | DataSource array for Timeline **v>=1.16.0**, Support content attribute and all attributes of TimeLine.Item | array | - | ### TimeLine.Item | Properties | Instruction | type | Default | | ---------- | -------------------------------------------------------- | --------------------------------------------------- | --------- | | className | Class name | string | - | | color | Color of dot | string | - | | dot | Custom dot | React Node | - | | extra | Custom extra content | React Node | - | | position | Custom node location to override TimeLine's mode setting | `left`\|`right` | - | | style | Inline style | CSSProperties | - | | time | Time value | string | - | | type | Pattern of dot | `default`\|`ongoing`\|`success`\|`warning`\|`error` | `default` | ## Design Tokens