Component

Timeline

安装 Installation

npx timkit add timeline --yes --framework react

用法 Usage

import { Timeline } from "@/components/ui/timeline"

className 与 variant、size 可以一起用。字段以 timkit agent inspect timeline --json 的 props 为准。

示例

Examples

一次看一个示例。左侧按名称筛选,预览里可切换源码和框架。

12 / 12

Timeline · Project Kickoff · 01

Loading preview...

结构化 API

Structured API

与 UCS schema 对齐的 props、逻辑机与多框架运行时。

Component

timeline

Logic

none

Runtime Frameworks

ReactVueWeappHTML

Supported Platforms

WebWeChat Mini Program

Configuration

PropTypeDefaultDescription
logic.provider*
enum (zag | native | none)
noneState and interaction provider used by this component.
logic.machine
string
-Underlying state machine identifier when provider is zag.
platforms*
array
Web, WeChat Mini ProgramPlatforms officially supported by this schema.
frameworks*
array
React, Vue, Weapp, HTMLFramework demos/code currently available in registry files.
dependencies
array
@timui/coreRuntime package dependencies required by this registry item.
optionalPeerDependencies
array
-Optional peer dependencies used by this registry item.
registryDependencies
array
-Dependent Timkit registry components/hook entries.

Props

PropTypeDefaultDescription
defaultValue
number
1The initial active step.
value
number
-The active step in the timeline.
orientation
enum (horizontal | vertical)
verticalThe orientation of the timeline.
disabled
boolean
falseWhen true, step changes are ignored.

Events

PropTypeDefaultDescription
onValueChange
event
-Event handler called when active step changes.

Slots

PropTypeDefaultDescription
default
slot
-The timeline items

Parts

PropTypeDefaultDescription
root*
root
-The timeline container
item
part
-A single event item
indicator
part
-The dot indicator
separator
part
-The line between items
content
part
-The event details
title
part
-The event title
date
part
-The event date
This API reference is generated from `/packages/core` component schemas to keep React/Vue/Weapp docs consistent.

该组件尚无扩展说明文档。

键盘与焦点

Keyboard

跨 React、Vue 与小程序共享的交互与可读名称约定。

  • ArrowDown and ArrowUp select the next and previous step when the timeline is vertical.
  • ArrowRight and ArrowLeft do that when it is horizontal.
  • Home selects the first enabled step.
  • End selects the last.
  • A disabled step is skipped.
  • These keys do not wrap.
  • Enter or Space selects the focused step.
  • A disabled step ignores those keys and is not in the tab order.
  • The current step is visible as Step N of the step count.
  • An empty value has no step status.
  • The step title is a level 3 heading.
  • An omitted name is Timeline.
  • A passed aria-label names the timeline. aria-labelledby suppresses that name.
  • Each step is a button.
  • The timeline is not a list.
  • On the mini program and in static HTML, the marker beside a step is hidden from the name.
  • In static HTML, the current step is visible as Step 1 of 2.
  • On the mini program, aria-labelledby leaves aria-label off.
  • On the mini program, a disabled timeline sets aria-disabled.

行为契约

Contract

props、默认值和运行时状态。

  • The timeline is vertical unless orientation is horizontal.
  • A disabled timeline ignores step changes.
  • Enter or Space selects a step.