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

查看生态总览
Skip to content

BarCode ​

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="bar-code": root

API reference ​

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

Artifacts ​

LayerValue
Custom element<xh-bar-code>
Vue componentsXhBarCode
State machineNone: connect computes attributes from props directly
Skin@xihan-ui/styles/bar-code.css

Props ​

PropTypeRequired
barWidthnumber
bearerBarsboolean
checksumboolean
formatBarCodeFormat
gs1boolean
heightnumber
labelstring
marginnumber
textboolean
valuestring

State ​

Public state is written to data-state.

PartValues
root'empty'

connect API ​

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

MemberType
formatBarCodeFormat
runsreadonly number[]
modulesnumber
encodedstring
marginnumber
pixelWidthnumber
pixelHeightnumber
viewBoxstring
pathstring
textreadonly BarCodeTextRun[]
fontSizenumber
stateBarCodeState
errorstring | undefined
labelstring | undefined
getRootProps() => 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-hidden'true' | undefined
rootaria-labelundefined | props.label
rootroleundefined | 'img'

Style reference ​

Skin ​

@xihan-ui/styles/bar-code.css is written against [data-scope="bar-code"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-bar-code 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-formatprops.format
rootdata-modulesundefined | String(modules)
rootdata-state'empty'

CSS variables ​

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

VariablePartCSS propertyStateDefault from
--xh-bar-code-bgrootbackgrounddefault--xh-color-neutral-0
--xh-bar-code-fgrootcolordefault--xh-color-neutral-950
--xh-bar-code-font-familyrootfont-familyxh-geom=text--xh-font-family-mono
--xh-bar-code-placeholder-bgrootbackgroundstate=empty
state=error
--xh-bg-subtle
--xh-bar-code-placeholder-borderrootbox-shadowstate=empty
state=error
--xh-border-default
--xh-bar-code-radiusrootborder-radiusdefault--xh-shape-control
--xh-bar-code-text-fgrootfillxh-geom=textcurrentColor

Released under The MIT License