生态产品多个设计器现已发布候选版本

查看生态总览
Skip to content

Steps ​

Navigation component. This page is the API reference, generated from the source code. Usage guidance and live examples are on the Chinese page.

Anatomy ​

Parts in bold are required.

data-scope="steps": root · list · item · trigger · indicator · title · description · separator · content

API reference ​

Descriptions of individual props, events and slots are written in Chinese and appear on the Chinese page.

Artifacts ​

LayerValue
Custom element<xh-steps>
Vue componentsXhStepsContent XhStepsDescription XhStepsIndicator XhStepsItem XhStepsList XhStepsRoot XhStepsSeparator XhStepsTitle XhStepsTrigger
ComposableuseSteps
State machinestepsMachine
Skin@xihan-ui/styles/steps.css

Props ​

PropTypeRequired
valuenumber
defaultValuenumber
collectionStepNode[]
statusesRecord<number, StepStatus>
tonesRecord<number, Tone>
countnumber
orientationOrientation
linearboolean
disabledboolean
readOnlyboolean
loopboolean
dirDirection
translationsPartial<StepsTranslations>
toneTone
sizeSize
variantStepsVariant
percentnumber
onValueChange(details: StepsValueChangeDetails) => void

StepNode ​

Elements of collection.

FieldTypeRequired
titlestring
descriptionstring
statusStepStatus
toneTone
disabledboolean

Events ​

Custom elements put the payload in detail; Vue emits an event of the same name.

EventPayload
value-changeStepsValueChangeDetails

Slots ​

Only slots with a payload are listed.

Vue componentSlotPayload
XhStepsRootdefaultStepsRootSlotProps

React adapter props ​

Only the props each component declares itself: DOM attributes inherited from ComponentPropsWithRef are left out, and root props already listed in the Props table are not repeated. The Vue counterpart is the slot table above.

React componentPropTypeRequired
XhStepsContentvaluenumber | stringYes
XhStepsItemvaluenumber | stringYes
XhStepsItemdisabledboolean
XhStepsRootchildrenSlotChildren<StepsRootSlotProps>

State ​

Public state is written to data-state.

PartValues
items.status
triggers.status
indicators.status
titlegetItemState(item).status
descriptiongetItemState(item).status
separatorgetItemState(item).status
contentgetItemState(item).status

The following names are internal to the state machine.

States: idle

Events: VALUE.SET · STEP.PREV · STEP.NEXT · TRIGGER.FOCUS · LIST.BLUR · PRESS.START · PRESS.END

Guards: canPress

connect API ​

getXxxProps() returns the host attributes of the matching part.

MemberType
valuenumber
countnumber
collectionreadonly StepNodeMeta[]
completeboolean
focusedStepnumber | null
readOnlyboolean
getItemState(props: StepsItemProps) => StepsItemState
setValue(next: number) => void
goToNextStep() => void
goToPrevStep() => void
getRootProps() => T['element']
getListProps() => T['element']
getItemProps(props: StepsItemProps) => T['element']
getTriggerProps(props: StepsItemProps) => T['button']
getIndicatorProps(props: StepsItemProps) => T['element']
getTitleProps(props: StepsItemProps) => T['element']
getDescriptionProps(props: StepsItemProps) => T['element']
getSeparatorProps(props: StepsItemProps) => T['element']
getContentProps(props: StepsItemProps) => T['element']

Accessibility ​

Keyboard ​

Specification: W3C APG. Each row is a stable behavior id that the conformance tests cover; the conditions and effects are described on the Chinese page.

KeysBehavior
ArrowRight / ArrowDownsteps.kbd.next
ArrowLeft / ArrowUpsteps.kbd.prev
Homesteps.kbd.first
Endsteps.kbd.last
Enter / Spacesteps.kbd.activate
Enter / Spacesteps.kbd.press
Tab / Shift+Tabsteps.kbd.tab

ARIA ​

These attributes are produced by connect.

PartAttributeValue
listaria-disabled'true' | 'false'
listaria-labeltranslations.list
listaria-orientationprops.orientation
listrole'list'
itemaria-current'step' | undefined
itemrole'listitem' | undefined
triggeraria-controlsid of the content part
triggeraria-current'step' | undefined
triggeraria-describedbyid of the indicator part | undefined
triggeraria-disabled'true' | 'false'
triggeraria-posinsetitem.index + 1 | undefined
triggeraria-selected'true' | 'false'
triggeraria-setsizenormalizeStepCount(prop('count') ?? (collection.lengt… | undefined
triggerrole'tab'
indicatoraria-hidden'true'
indicatoraria-labeltranslations.progressLabel
indicatoraria-valuemax'100'
indicatoraria-valuemin'0'
indicatoraria-valuenowString(percent)
indicatoraria-valuetextprogressValueText(Math.round(percent))
indicatorrole'progressbar'
separatoraria-hidden'true'
contentaria-labelledbyundefined | id of the trigger part
contentroleundefined | 'tabpanel'

Style reference ​

Skin ​

@xihan-ui/styles/steps.css is written against [data-scope="steps"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-steps in place of data-scope (same specificity) and sits in the xihan.components layer. Put overrides in xihan.overrides; the part selectors work as usual.

Data attributes ​

Produced by connect; valueless attributes are omitted while their condition does not hold.

PartAttributeValue
rootdata-complete'' (present only while the condition holds)
rootdata-disabled'' (present only while the condition holds)
rootdata-empty'' (present only while the condition holds)
rootdata-orientationprops.orientation
rootdata-sizeprops.size
rootdata-toneprops.tone
rootdata-variantprops.variant
listdata-orientationprops.orientation
itemdata-disabled'' (present only while the condition holds)
itemdata-orientationprops.orientation
itemdata-states.status
itemdata-tones.tone
triggerdata-disabled'' (present only while the condition holds)
triggerdata-pressed'' (present only while the condition holds)
triggerdata-readonly''
triggerdata-states.status
triggerdata-xh-action-control''
triggerdata-xh-action-display'always'
triggerdata-xh-action-profile'row'
triggerdata-xh-action-sizeprops.size
triggerdata-xh-action-variant'ghost'
indicatordata-instant'' (present only while the condition holds)
indicatordata-progress'' (present only while the condition holds)
indicatordata-states.status
indicatordata-variantprops.variant
titledata-stategetItemState(item).status
descriptiondata-stategetItemState(item).status
separatordata-orientationprops.orientation
separatordata-stategetItemState(item).status
contentdata-stategetItemState(item).status

CSS variables ​

The public override slots, generated from what the standalone skin actually consumes.

VariablePartCSS propertyStateDefault from
--xh-steps-content-fgcontentcolordefault--xh-fg-default
--xh-steps-content-min-inline-sizecontent
root
flexorientation=vertical--xh-measure-prose
--xh-steps-content-pycontentpadding-blockdefault--xh-stack-gap-md
--xh-steps-description-fgdescriptioncolordefault--xh-fg-subtle
--xh-steps-description-font-sizedescriptionfont-sizedefault--xh-text-caption-size
--xh-steps-gaprootgapdefault--xh-stack-gap-md
--xh-steps-icon-sizeroot--xh-icon-sizedefault
size=lg
size=sm
--xh-glyph-size-lg
--xh-glyph-size-md
--xh-glyph-size-sm
--xh-steps-indicator-bgindicatorbackgrounddefault
variant=dot
--xh-bg-subtle
transparent
--xh-steps-indicator-bg-completedindicator
trigger
background
border-color
not([data-state='incomplete'])
state=completed
state=incomplete
variant=dot
--xh-_steps-accent-mark
--xh-_steps-accent-subtle
--xh-steps-indicator-bg-completed-hoverindicator
trigger
backgrounddisabled
hover
not([data-disabled], [data-readonly])
not([data-variant='dot'])
readonly
state=completed
variant=dot
--xh-_steps-accent-subtle-hover
--xh-steps-indicator-bg-completed-pressedindicator
trigger
backgrounddisabled
is(:active, [data-pressed])
not([data-disabled], [data-readonly])
not([data-variant='dot'])
pressed
readonly
state=completed
variant=dot
--xh-_steps-accent-subtle-active
--xh-steps-indicator-bg-currentindicator
trigger
background
border-color
not([data-state='incomplete'])
state=current
state=incomplete
variant=dot
--xh-_steps-accent
--xh-steps-indicator-bg-current-pressedindicator
item
trigger
background
border-color
disabled
is(:active, [data-pressed])
not([data-disabled], [data-readonly])
not([data-state='incomplete'])
not([data-variant='dot'])
pressed
readonly
state=current
state=incomplete
tone
variant=dot
--xh-_tone-active
--xh-steps-indicator-bg-disabledindicator
item
trigger
background
border-color
disabled
not([data-state='incomplete'])
state=incomplete
variant=dot
--xh-bg-muted
--xh-fg-disabled
--xh-steps-indicator-bg-hoverindicator
trigger
backgrounddisabled
hover
not([data-disabled], [data-readonly])
readonly
state=incomplete
--xh-_steps-host-bg-hover
--xh-steps-indicator-bg-pressedindicator
trigger
backgrounddisabled
is(:active, [data-pressed])
not([data-disabled], [data-readonly])
pressed
readonly
state=incomplete
--xh-_steps-host-bg-pressed
--xh-steps-indicator-bg-tonedindicator
item
trigger
backgroundnot([data-variant='dot'])
state=incomplete
tone
variant=dot
--xh-_steps-accent
--xh-_tone-subtle
--xh-steps-indicator-borderindicatorborder
border-color
default
variant=dot
--xh-fg-muted
transparent
--xh-steps-indicator-border-completedindicatorborder-colorstate=completedtransparent
--xh-steps-indicator-border-currentindicatorborder-colorstate=current--xh-_steps-accent
--xh-steps-indicator-border-disabledindicator
item
border-colordisabled
variant=dot
--xh-border-default
--xh-fg-disabled
--xh-steps-indicator-border-tonedindicator
item
trigger
border-colornot([data-variant='dot'])
state=incomplete
tone
variant=dot
--xh-_steps-accent
--xh-steps-indicator-fgindicatorcolordefault--xh-fg-muted
--xh-steps-indicator-fg-completedindicatorcolorstate=completed--xh-_steps-accent-mark
--xh-steps-indicator-fg-currentindicatorcolorstate=current--xh-_steps-on-accent
--xh-steps-indicator-fg-disabledindicator
item
colordisabled--xh-fg-disabled
--xh-steps-indicator-fg-hoverindicator
trigger
colordisabled
hover
not([data-disabled], [data-readonly])
readonly
state=incomplete
--xh-fg-default
--xh-steps-indicator-fg-tonedindicator
item
trigger
colornot([data-variant='dot'])
state=incomplete
tone
variant=dot
--xh-_steps-on-accent
--xh-steps-indicator-font-sizeindicatorfont-sizedefault--xh-_steps-indicator-font-size
--xh-steps-indicator-mark-sizeindicator--xh-icon-sizedefault--xh-control-indicator-size
--xh-steps-indicator-radiusindicatorborder-radiusdefault--xh-shape-circle
--xh-steps-indicator-ring-bgindicatorbackgrounddefault--xh-_steps-accent
--xh-steps-indicator-ring-bg-disabledindicator
item
backgrounddisabled--xh-fg-disabled
--xh-steps-indicator-ring-trackindicatorbackgroundprogress--xh-border-default
--xh-steps-indicator-shadowindicatorbox-shadowstate=currentnone
--xh-steps-indicator-sizeindicator
separator
block-size
inline-size
margin-inline-start
default
orientation=vertical
--xh-_steps-indicator-size
--xh-steps-item-gapitemgapdefault--xh-space-2
--xh-steps-item-min-inline-sizeitemmin-inline-sizenot(:last-child)
orientation=horizontal
--xh-space-0
--xh-steps-list-gaplistgapdefault--xh-space-0
--xh-steps-separator-bgseparatorbackgrounddefault--xh-border-default
--xh-steps-separator-bg-completedseparatorbackgrounddefault--xh-_steps-accent
--xh-steps-separator-min-lengthseparatorblock-size
min-inline-size
default
orientation=vertical
--xh-space-4
--xh-space-7
--xh-steps-separator-radiusseparatorborder-radiusdefault--xh-shape-pill
--xh-steps-separator-thicknessseparatorblock-size
inline-size
margin-inline-start
min-inline-size
default
orientation=vertical
--xh-stroke-thin
--xh-steps-title-fgtitlecolordefault--xh-fg-muted
--xh-steps-title-fg-activetitlecoloris([data-state='current'], [data-state='completed'])
state=completed
state=current
--xh-fg-default
--xh-steps-title-fg-toneditem
title
colortone--xh-fg-default
--xh-steps-title-font-sizetitlefont-sizedefault--xh-_steps-title-font-size
--xh-steps-title-font-weighttitlefont-weightdefault--xh-text-label-weight
--xh-steps-title-font-weight-currenttitlefont-weightstate=current--xh-text-heading-3-weight
--xh-steps-trigger-bg-hovertriggerbackground-colordisabled
hover
loading
not([data-disabled])
not([data-loading])
--xh-bg-subtle
--xh-steps-trigger-bg-pressedtriggerbackground-colordisabled
is(:active, [data-pressed])
loading
not([data-disabled])
not([data-loading])
pressed
--xh-bg-subtle-hover
--xh-steps-trigger-gaptriggercolumn-gapdefault--xh-control-gap-md
--xh-steps-trigger-pseparator
trigger
margin-inline-start
padding-block
padding-inline
default
orientation=vertical
readonly
xh-action-profile=row
--xh-control-px-sm
--xh-space-1
--xh-steps-trigger-radiustriggerborder-radiusdefault--xh-shape-control

Released under The MIT License