Previews appear after a warmup delay when hovering with a pointer or receiving keyboard focus. Once a preview is displayed, other previews display immediately. If the user waits for the cooldown period before hovering another element, the warmup timer restarts. On touch devices, previews open on long press.
When a preview is open, pressing Tab moves focus into the preview so users can interact with its contents. Press Escape to close the preview and return focus to the trigger.
PreviewTrigger works with any focusable React Aria component (e.g. Link, Button, etc.). Use the <Focusable> component to wrap a custom trigger element such as a third party component or DOM element.
Custom trigger
import {PreviewTrigger} from'react-aria-components/PreviewTrigger';
import {Focusable} from'react-aria-components/Tooltip';
import {Popover} from'./Popover';
<PreviewTrigger>
<Focusable>
<spanrole="link">Custom trigger</span>
</Focusable>
<Popoverstyle={{padding: 16}}>
This preview was triggered by a custom element.
</Popover>
</PreviewTrigger>
Accessibility
Any <Focusable> child must have an ARIA role or use an appropriate semantic HTML element so that screen readers can announce the preview. Trigger components must forward their ref and spread all props to a DOM element.