Skip to Content
文档

时间轴

用于按时间顺序显示事件列表

SourceStorybookRecipe
Product Shipped
13th May 2021

We shipped your product via FedEx and it should arrive within 3-5 business days.

Order Confirmed
18th May 2021
Order Delivered
20th May 2021, 10:30am

用法

¥Usage

import { Timeline } from "@chakra-ui/react"
<Timeline.Root>
  <Timeline.Item>
    <Timeline.Connector>
      <Timeline.Separator />
      <Timeline.Indicator />
    </Timeline.Connector>
    <Timeline.Content>
      <Timeline.Title />
      <Timeline.Description />
    </Timeline.Content>
  </Timeline.Item>
</Timeline.Root>

示例

¥Examples

尺寸

¥Sizes

使用 size 属性更改时间轴的大小。

¥Use the size prop to change the size of the timeline.

S
sagecreated a new project
sagechanged status from In progress to Completed
S
sagecreated a new project
sagechanged status from In progress to Completed
S
sagecreated a new project
sagechanged status from In progress to Completed
S
sagecreated a new project
sagechanged status from In progress to Completed

变量

¥Variants

使用 variant 属性更改时间轴的变体。

¥Use the variant prop to change the variant of the timeline.

S
sagecreated a new project
sagechanged status from In progress to Completed
S
sagecreated a new project
sagechanged status from In progress to Completed
S
sagecreated a new project
sagechanged status from In progress to Completed
S
sagecreated a new project
sagechanged status from In progress to Completed

内容之前

¥Content Before

这是一个内容位于时间轴指示器之前的时间轴示例。

¥Here's an example of a timeline with content before the timeline indicator.

Nov 1994
1
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nov 2010
2
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nov 1994
1
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nov 2010
2
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nov 1994
1
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Nov 2010
2
Lorem ipsum dolor sit amet, consectetur adipiscing elit.

交替内容

¥Alternating Content

这是一个内容交替的时间轴示例。

¥Here's an example of a timeline with alternating content.

Placed Order
Prepared Order
Order Delivered

合成

¥Composition

以下示例展示了如何将时间轴与其他组件组合,以创建外观一致的时间轴。

¥Here's an example of how to compose the timeline with other components to create a consistent-looking timeline.

Lucas Moras has changed3 labels onJan 1, 2024
Jenna Smith removedEnason Jan 12, 2024
Erica commentedon Jan 12, 2024

Lorem ipsum. Quisque faucibus. In id. Tempus leo. Pulvinar vivamus. Iaculis massa. Ut hendrerit. Ad litora.

属性

¥Props

根元素

¥Root

PropDefaultType
colorPalette 'gray'
'gray' | 'red' | 'orange' | 'yellow' | 'green' | 'teal' | 'blue' | 'cyan' | 'purple' | 'pink'

The color palette of the component

variant 'solid'
'subtle' | 'solid' | 'outline' | 'plain'

The variant of the component

size 'md'
'sm' | 'md' | 'lg' | 'xl'

The size of the component

as
React.ElementType

The underlying element to render.

asChild
boolean

Use the provided child element as the default rendered element, combining their props and behavior.

For more details, read our Composition guide.
unstyled
boolean

Whether to remove the component's style.

Previous

标签

Next

折叠面板