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

查看生态总览
Skip to content

LoadingBar ​

Feedback 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="loading-bar": root · track · range · peg

API reference ​

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

Artifacts ​

LayerValue
Custom element<xh-loading-bar>
Vue componentsXhLoadingBarPeg XhLoadingBarRange XhLoadingBarRoot XhLoadingBarTrack
ComposableuseLoadingBar
State machineloadingBarMachine
Skin@xihan-ui/styles/loading-bar.css

Props ​

PropTypeRequired
valuenumber
defaultValuenumber
loadingboolean
heightstring | number
toneTone
trickleboolean
trickleSpeednumber
minimumnumber
fadeDurationnumber
translationsPartial<LoadingBarTranslations>
onValueChange(details: LoadingBarValueChangeDetails) => void

Events ​

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

EventPayload
value-changeLoadingBarValueChangeDetails

Slots ​

Only slots with a payload are listed.

Vue componentSlotPayload
XhLoadingBarRootdefaultLoadingBarRootSlotProps

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
XhLoadingBarRootchildrenSlotChildren<LoadingBarRootSlotProps>

State ​

Public state is written to data-state.

PartValues
root'idle' | 'loading' | 'complete' | 'finishing'
track'idle' | 'loading' | 'complete' | 'finishing'
range'idle' | 'loading' | 'complete' | 'finishing'
peg'idle' | 'loading' | 'complete' | 'finishing'

The following names are internal to the state machine.

States: idle · loading · complete · finishing

Events: LOADING.START · LOADING.END · TRICKLE.SYNC · after.trickleSpeed · FILL.DONE · FADE.DONE

connect API ​

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

MemberType
phaseLoadingBarPhase
valuenumber
visibleboolean
indeterminateboolean
getRootProps() => T['element']
getTrackProps() => T['element']
getRangeProps() => T['element']
getPegProps() => 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.

No keyboard interaction: the component takes no focus, or focus behavior comes entirely from native elements.

ARIA ​

These attributes are produced by connect.

PartAttributeValue
rootaria-labeltranslations.root
rootaria-valuemaxString(LOADING_BAR_MAX)
rootaria-valuemin'0'
rootaria-valuenowString(value) | undefined
rootrole'progressbar'
pegaria-hidden'true'

Style reference ​

Skin ​

@xihan-ui/styles/loading-bar.css is written against [data-scope="loading-bar"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-loading-bar 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-indeterminate'' (present only while the condition holds)
rootdata-state'idle' | 'loading' | 'complete' | 'finishing'
rootdata-toneprops.tone
trackdata-state'idle' | 'loading' | 'complete' | 'finishing'
rangedata-state'idle' | 'loading' | 'complete' | 'finishing'
pegdata-state'idle' | 'loading' | 'complete' | 'finishing'

CSS variables ​

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

VariablePartCSS propertyStateDefault from
--xh-loading-bar-faderoottransitiondefault--xh-motion-duration-exit
--xh-loading-bar-layerrootz-indexdefault--xh-layer-sticky
--xh-loading-bar-peg-fgpegbackgrounddefault--xh-loading-bar-range
--xh-loading-bar-peg-wpeginline-sizedefault--xh-space-8
--xh-loading-bar-rangepeg
range
backgrounddefault--xh-_tone-soft
--xh-loading-bar-range-radiusrangeborder-end-end-radius
border-start-end-radius
default--xh-shape-pill
--xh-loading-bar-speedrangetransitiondefault--xh-motion-duration-move
--xh-loading-bar-tracktrackbackgrounddefaulttransparent

Released under The MIT License