Flyout


目录

This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.

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.

Usage

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>
    );
}

Props

state: PopoverStateReturn

label: string

animated: boolean

Determines if Flyout has animations.

animationDuration: boolean

The duration of Flyout animations.

baseId: string

ID that will serve as a base for all the items IDs. See https://reakit.io/docs/popover/#usepopoverstate

elevation: number

Size of the elevation shadow. For more information, check out Card.

maxWidth: CSSProperties[ 'maxWidth' ]

Max-width for the Flyout element.

onVisibleChange: ( ...args: any ) => void

Callback 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: boolean

Whether Flyout is visible. See the Reakit docs for more information.

placement: PopperPlacement

Position of the popover element. See the popper docs for more information.


版本号 #2
由 壳壳虫 创建于 2026-10-31 18:16:14 UTC
由 壳壳虫 更新于 2026-10-31 18:16:15 UTC