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

查看生态总览
Skip to content

Spinner ​

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="spinner": root · label

API reference ​

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

Artifacts ​

LayerValue
Custom element<xh-spinner>
Vue componentsXhSpinner XhSpinnerLabel
State machinespinnerMachine
Skin@xihan-ui/styles/spinner.css

Props ​

PropTypeRequired
delaynumber
labelstring
orientationOrientation
sizeSize
toneTone
translationsPartial<SpinnerTranslations>
variantSpinnerVariant

State ​

Public state is written to data-state.

PartValues
root'visible' | 'hidden'

The following names are internal to the state machine.

States: waiting · visible

connect API ​

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

MemberType
labelstring
visibleboolean
getRootProps() => T['element']
getLabelProps() => 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-labelresolveLabel(props)
rootaria-live'polite'
rootrole'status'

Style reference ​

Skin ​

@xihan-ui/styles/spinner.css is written against [data-scope="spinner"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-spinner in place of data-scope (same specificity) and sits in the xihan.components and xihan.motion layers. 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-orientationprops.orientation
rootdata-sizeprops.size
rootdata-state'visible' | 'hidden'
rootdata-toneprops.tone
rootdata-variantprops.variant

CSS variables ​

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

VariablePartCSS propertyStateDefault from
--xh-spinner-durationrootanimationdefault
variant=dots
--xh-motion-loop-spin
--xh-spinner-fgrootbackground
border
border-color
@media (prefers-reduced-motion: reduce)
@media print
default
motion=reduce
tone
variant=arc
variant=dots
where([data-motion='reduce'])
--xh-_tone
--xh-fg-brand
--xh-spinner-gaprootgapdefault
orientation=vertical
--xh-control-gap-md
--xh-space-1_5
--xh-spinner-label-fglabelcolordefault--xh-fg-brand
--xh-spinner-label-sizelabelfont-sizedefault--xh-text-body-size
--xh-spinner-label-weightlabelfont-weightdefault--xh-font-weight-medium
--xh-spinner-radiusrootborder-radius@media (forced-colors: active)
default
tone
variant=arc
variant=dots
--xh-shape-circle
--xh-spinner-sizerootblock-size
inline-size
default--xh-glyph-size-md
--xh-spinner-thicknessroot-webkit-mask
border
mask
@media (forced-colors: active)
default
tone
variant=arc
variant=dots
--xh-stroke-thick
--xh-spinner-trackrootborder-block-start-colordefault
tone
transparent

Released under The MIT License