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

查看生态总览
Skip to content

Statistic ​

Data display 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="statistic": root · label · value · prefix · suffix · trend

API reference ​

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

Artifacts ​

LayerValue
Custom element<xh-statistic>
Vue componentsXhStatisticLabel XhStatisticPrefix XhStatisticRoot XhStatisticSuffix XhStatisticTrend XhStatisticValue
State machineNone: connect computes attributes from props directly
Skin@xihan-ui/styles/statistic.css

Props ​

PropTypeRequired
sizeSize
toneTone
trendStatisticTrend

connect API ​

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

MemberType
trendStatisticTrend
getRootProps() => T['element']
getLabelProps() => T['element']
getValueProps() => T['element']
getPrefixProps() => T['element']
getSuffixProps() => T['element']
getTrendProps() => 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.

Style reference ​

Skin ​

@xihan-ui/styles/statistic.css is written against [data-scope="statistic"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-statistic 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-sizeprops.size
rootdata-toneprops.tone
trenddata-directionprops.trend

CSS variables ​

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

VariablePartCSS propertyStateDefault from
--xh-statistic-affix-fgprefix
suffix
colordefault--xh-_tone-fg
--xh-statistic-affix-font-sizeprefix
suffix
font-sizedefault--xh-_statistic-affix-size
--xh-statistic-fgrootcolordefault--xh-fg-default
--xh-statistic-gaprootcolumn-gapdefault--xh-space-0
--xh-statistic-icon-sizeroot--xh-icon-sizedefault--xh-_statistic-icon-size
--xh-statistic-label-fglabelcolordefault--xh-fg-muted
--xh-statistic-label-font-sizelabelfont-sizedefault--xh-_statistic-label-size
--xh-statistic-row-gaprootrow-gapdefault--xh-_statistic-row-gap
--xh-statistic-trend-fgtrendcolordefault--xh-_tone-fg
--xh-statistic-trend-font-sizetrendfont-sizedefault--xh-_statistic-affix-size
--xh-statistic-trend-gaptrendgapdefault--xh-space-0_5
--xh-statistic-trend-offsettrendmargin-inline-startdefault--xh-space-2
--xh-statistic-value-fgvaluecolordefault--xh-_tone-fg
--xh-statistic-value-font-sizevaluefont-sizedefault--xh-_statistic-value-size

Released under The MIT License