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

查看生态总览
Skip to content

Flex ​

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="flex": root · split

API reference ​

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

Artifacts ​

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

Props ​

PropTypeRequired
alignFlexResponsive<FlexAlign>
gapFlexResponsive<FlexGap>
inlineboolean
justifyFlexResponsive<FlexJustify>
orientationFlexResponsive<Orientation>
wrapboolean

Slots ​

Only slots with a payload are listed.

Vue componentSlotPayload
XhFlexdefault—
XhFlexsplit—

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
XhFlexsplitReactNode

connect API ​

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

MemberType
getRootProps() => T['element']
getSplitProps() => 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
splitaria-hidden'true'

Style reference ​

Skin ​

@xihan-ui/styles/flex.css is written against [data-scope="flex"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-flex 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-alignalign.base
rootdata-align-lgalign.lg
rootdata-align-mdalign.md
rootdata-align-smalign.sm
rootdata-align-xlalign.xl
rootdata-gapgap.base
rootdata-gap-lggap.lg
rootdata-gap-mdgap.md
rootdata-gap-smgap.sm
rootdata-gap-xlgap.xl
rootdata-inline'' (present only while the condition holds)
rootdata-justifyjustify.base
rootdata-justify-lgjustify.lg
rootdata-justify-mdjustify.md
rootdata-justify-smjustify.sm
rootdata-justify-xljustify.xl
rootdata-orientationorientation.base
rootdata-orientation-lgorientation.lg
rootdata-orientation-mdorientation.md
rootdata-orientation-smorientation.sm
rootdata-orientation-xlorientation.xl
rootdata-wrap'' (present only while the condition holds)

CSS variables ​

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

VariablePartCSS propertyStateDefault from
--xh-flex-gaprootgap@media (min-width: 1024px)
@media (min-width: 1280px)
@media (min-width: 640px)
@media (min-width: 768px)
default
gap-lg=lg
gap-lg=md
gap-lg=sm
gap-lg=xl
gap-lg=xs
gap-md=lg
gap-md=md
gap-md=sm
gap-md=xl
gap-md=xs
gap-sm=lg
gap-sm=md
gap-sm=sm
gap-sm=xl
gap-sm=xs
gap-xl=lg
gap-xl=md
gap-xl=sm
gap-xl=xl
gap-xl=xs
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