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.

installyarn add @react-aria/overlays
version3.6.3
usageimport {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
NameTypeDefaultDescription
onDismiss() => voidCalled when the dismiss button is activated.

Example#


See useMenuTrigger and useOverlayTrigger for examples of how to use DismissButton with a menu or popover.