ZStack 是一个实验性的 WordPress 组件,用于沿 Z 轴堆叠子元素,支持层叠和偏移控制。目前处于早期阶段,可能发生重大变更。
import { __experimentalZStack as ZStack } from '@wordpress/components';
function Example() {
return (
<ZStack offset={ 20 } isLayered>
<ExampleImage />
<ExampleImage />
<ExampleImage />
</ZStack>
);
}ZStack allows you to stack things along the Z-axis.
import { __experimentalZStack as ZStack } from '@wordpress/components';
function Example() {
return (
<ZStack offset={ 20 } isLayered>
<ExampleImage />
<ExampleImage />
<ExampleImage />
</ZStack>
);
}
isLayered: booleanLayers children elements on top of each other (first: highest z-index, last: lowest z-index).
trueisReversed: booleanReverse the layer ordering (first: lowest z-index, last: highest z-index).
falseoffset: numberThe amount of space between each child element. Its value is automatically inverted (i.e. from positive to negative, and viceversa) when switching from LTR to RTL.
0children: ReactNodeThe children to stack.