OverlayTrigger

React
Note
This component uses Portals internally, which requires React 16
Note
This component uses ZLevel context internally, which requires React 16

Usage

Props

NameTypeRequiredDefaultDescription
aria-describedby
string
false
aria-details
string
false
aria-label
string
false
aria-labelledby
string
false
arrow
boolean
false
autoFocus
boolean
false

Whether to auto focus the first focusable element in the overlay on mount. True by default for role "dialog"

since

11.5.0

beforeHide
BeforeCallback
false

The callback to run before the overlay is hidden. Returning false will prevent hiding.

(e: event) => boolean | Promise | undefined
since

10.19.0

beforeShow
BeforeCallback
false

The callback to run before the overlay is shown. Returning false will prevent showing.

(e: event) => boolean | Promise | undefined
since

10.19.0

canFlip
boolean
false
children
ReactNode | ((props: TriggerApi) => ReactNode)
true
clickOutsideIgnoreRefs
RefObject<HTMLElement>[]
false

Additional refs to check for clickOutside behavior

since

10.19.0

containFocus
boolean
false

Whether to contain focus inside the overlay, so users cannot move focus outside, for example in a modal dialog. True by default for role "dialog"

since

11.5.0

container
HTMLElement
false
since

10.19.0

hideDelay
number
false

The delay when hiding the overlay

since

10.19.0

hideKeys
{ overlay: string[]; target: string[] }
false

Keys to hide the overlay when the overlay is focused

a11y

OverlayTrigger by default closes on tab. To remove tab from closing and have only Esc keys, set "containFocus" to true, or opt-in to a full dialog role.

since

10.19.0

Accessibility notes:
OverlayTrigger by default closes on tab. To remove tab from closing and have only Esc keys, set "containFocus" to true, or opt-in to a full dialog role.
initialIsVisible
boolean
false
overlay
ReactNode
true
overlayReffalse

Toggles overlay visibility

since

11.2.0

padding
number
false
passA11yPropsToOverlay
boolean
false

By default, role and id are applied to wrapper. But has knowledge of Set to true, if you want OverlayTrigger to place them on your overlay component.

default

false

since

11.5.0

placement
Placement
false
restoreFocusOnHide
boolean
false

Restore focus to the target after the overlay is hidden

default

true

since

10.19.0

rolefalse

Accessibility props.

a11y

May opionate "autoFocus" and "containFocus"

since

11.2.0

Accessibility notes:
May opionate "autoFocus" and "containFocus"
showDelay
number
false

The delay when showing the overlay

since

10.19.0

showKeys
string[]
false

Keys to show the overlay when the target is focused

since

10.19.0

shrinkOverlay
boolean
false
since

10.19.0

trigger
TriggerVariant | TriggerVariant[]
false
afterHide
Function
false
afterShow
Function
false