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

查看生态总览
Skip to content

Masonry ​

Layout 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="masonry": root · column · item

API reference ​

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

Artifacts ​

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

Props ​

PropTypeRequired
columnsMasonryColumns
gapMasonryGap
sequentialboolean

connect API ​

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

MemberType
getRootProps() => T['element']
getColumnProps(props: MasonryColumnProps) => T['element']
getItemProps(props: MasonryItemProps) => 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/masonry.css is written against [data-scope="masonry"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-masonry 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-gapprops.gap
rootdata-sequential'' (present only while the condition holds)
columndata-indexString(column.index)
itemdata-columnString(item.column)
itemdata-indexString(item.index)

CSS variables ​

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

VariablePartCSS propertyStateDefault from
--xh-masonry-gapcolumn
root
gapdefault
gap=lg
gap=md
gap=sm
gap=xl
gap=xs
--xh-layout-gap-lg
--xh-layout-gap-md
--xh-layout-gap-sm
--xh-layout-gap-xl
--xh-layout-gap-xs
--xh-space-0

Released under The MIT License