Component

Stepper

安装 Installation

npx timkit add stepper --yes --framework react

用法 Usage

import { Stepper } from "@/components/ui/stepper"

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

示例

Examples

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

17 / 17

Stepper · Numeric indicators · 01

Loading preview...

结构化 API

Structured API

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

Component

stepper

Logic

zag / number-input

Runtime Frameworks

ReactVueWeappHTML

Supported Platforms

WebWeChat Mini Program

Configuration

PropTypeDefaultDescription
logic.provider*
enum (zag | native | none)
zagState and interaction provider used by this component.
logic.machine
string
number-inputUnderlying 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/core, @zag-js/core, @zag-js/number-input, @zag-js/reactRuntime package dependencies required by this registry item.
optionalPeerDependencies
array
lucide-reactOptional peer dependencies used by this registry item.
registryDependencies
array
-Dependent Timkit registry components/hook entries.

Props

PropTypeDefaultDescription
orientation
enum (horizontal | vertical)
horizontalThe orientation of the stepper.
value
number
-The active step index.
defaultValue
number
0The initial active step index.
disabled
boolean
falseWhen true, step changes are ignored.
readOnly
boolean
falseWhen true, step changes are ignored.
min
number
-The minimum value.
max
number
-The maximum value.
step
number
1The amount added or removed on each step.

Events

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

Slots

PropTypeDefaultDescription
default
slot
-The stepper items

Parts

PropTypeDefaultDescription
root*
root
-The stepper container
item
part
-A single step
trigger
part
-The step selector
indicator
part
-The step number/icon
separator
part
-The line between steps
title
part
-The step title
description
part
-The step description
This API reference is generated from `/packages/core` component schemas to keep React/Vue/Weapp docs consistent.

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

键盘与焦点

Keyboard

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

  • ArrowRight and ArrowLeft select the next and previous step when the stepper is horizontal.
  • ArrowDown and ArrowUp do that when it is vertical.
  • Home selects the first enabled step.
  • End selects the last.
  • A disabled step is skipped.
  • These keys do not wrap.
  • Enter or Space selects a step.
  • On the mini program, Enter or Space also decreases or increases the value.
  • A disabled, read-only, or out-of-range control 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.
  • An omitted name is Stepper.
  • A passed aria-label names the stepper. aria-labelledby suppresses that name.
  • On the mini program, the value field is named Number.
  • In static HTML, each step is a button.
  • The line between steps is hidden from the name.
  • In static HTML, the current step is visible as Step 1 of 2.
  • The current step uses aria-current step.
  • On the mini program, aria-labelledby leaves aria-label off.
  • On the mini program, a read-only stepper sets aria-readonly.
  • On the mini program, the value field exposes its minimum, maximum, and current value.
  • An empty value does not set aria-valuenow.

行为契约

Contract

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

  • When read-only, the stepper buttons do not change the value.
  • The stepper is horizontal unless orientation is vertical. min and max keep the active step inside that range.
  • A disabled, read-only, or out-of-range control is not in the tab order.