Flyout 是一个用于渲染浮动内容模态框的组件,类似于工具提示但支持任意类型内容。目前处于实验阶段,可能发生重大变更。
import { Button, __experimentalFlyout as Flyout, __experimentalText as Text } from '@wordpress/components';
function Example() {
return (
<Flyout trigger={ <Button>Show/Hide content</Button> }>
<Text>Code is Poetry</Text>
</Flyout>
);
}Flyout is a component to render a floating content modal. It is similar in purpose to a tooltip, but renders content of any sort, not only simple text.
import { Button, __experimentalFlyout as Flyout, __experimentalText as Text } from '@wordpress/components';
function Example() {
return (
<Flyout trigger={ <Button>Show/Hide content</Button> }>
<Text>Code is Poetry</Text>
</Flyout>
);
}
state: PopoverStateReturnlabel: stringanimated: booleanDetermines if Flyout has animations.
trueanimationDuration: booleanThe duration of Flyout animations.
160baseId: stringID that will serve as a base for all the items IDs. See https://reakit.io/docs/popover/#usepopoverstate
160elevation: numberSize of the elevation shadow. For more information, check out Card.
5maxWidth: CSSProperties[ 'maxWidth' ]Max-width for the Flyout element.
360onVisibleChange: ( ...args: any ) => voidCallback for when the visible state changes.
trigger: FunctionComponentElement< any >Element that triggers the visible state of Flyout when clicked.
<Flyout trigger={<Button>Greet</Button>}>
<Text>Hi! I'm Olaf!</Text>
</Flyout>
visible: booleanWhether Flyout is visible. See the Reakit docs for more information.
falseplacement: PopperPlacementPosition of the popover element. See the popper docs for more information.
auto