DismissButton
A visually hidden button that can be used to allow screen reader users to dismiss a modal or popup when there is no visual affordance to do so.
install | yarn add @react-aria/overlays |
---|---|
version | 3.7.3 |
usage | import {DismissButton} from '@react-aria/overlays' |
Introduction#
DismissButton
is a visually hidden button that can be used by screen reader users to close an overlay
in the absence of a visual dismiss button. This may typically be used with a menu or a popover since they often
forgo a visual dismiss button, instead allowing users to use the Escape key to dismiss the menu or popover.
Props#
Events
Name | Type | Default | Description |
onDismiss | () => void | — | Called when the dismiss button is activated. |
Example#
See useMenuTrigger and useOverlayTrigger
for examples of how to use DismissButton
with a menu or popover.