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

查看生态总览
Skip to content

MatrixCode ​

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="matrix-code": root · logo

API reference ​

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

Artifacts ​

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

Props ​

PropTypeRequired
columnsnumber
eyeShapeMatrixCodeEyeShape
formatMatrixCodeFormat
gs1boolean
labelstring
levelMatrixCodeLevel
logoboolean
marginnumber
moduleShapeMatrixCodeModuleShape
pixelSizenumber
rectangularboolean
valuestring

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
XhMatrixCodechildrenReactNode

State ​

Public state is written to data-state.

PartValues
root'empty'

connect API ​

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

MemberType
formatMatrixCodeFormat
modulesreadonly (readonly boolean[])[]
versionnumber
columnsnumber
rowsnumber
marginnumber
viewBoxstring
pathstring
eyePathstring
logoAreaMatrixCodeLogoArea | undefined
logoDamageMatrixCodeLogoDamage | undefined
stateMatrixCodeState
errorstring | undefined
labelstring | undefined
getRootProps() => T['element']
getLogoProps() => 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/matrix-code.css is written against [data-scope="matrix-code"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-matrix-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-columnsundefined | String(columns)
rootdata-formatprops.format
rootdata-level'M' | String(pdfLevel) | undefined
rootdata-logo'' (present only while the condition holds)
rootdata-rowsundefined | String(rows)
rootdata-state'empty'
rootdata-versionundefined | String(version)

CSS variables ​

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

VariablePartCSS propertyStateDefault from
--xh-matrix-code-bgrootbackground
fill
default
xh-geom=logo-clear
--xh-color-neutral-0
--xh-matrix-code-eye-fgrootfillxh-geom=eyescurrentColor
--xh-matrix-code-fgrootcolordefault--xh-color-neutral-950
--xh-matrix-code-placeholder-bgrootbackgroundstate=empty
state=error
--xh-bg-subtle
--xh-matrix-code-placeholder-borderrootbox-shadowstate=empty
state=error
--xh-border-default
--xh-matrix-code-radiusrootborder-radiusdefault--xh-shape-control

Released under The MIT License