React Native · Components
Popover
An info or form panel that opens next to the trigger.
3 exports
Live example
The preview runs in the browser with the web component; the native component takes the same props and looks the same on iOS and Android.
Preview
Dimensions
Code
Events
- Events appear here when you interact with the preview.
Import
Popover
componentAn info or form panel that opens next to the trigger. Same API as Popover on web. On a phone it becomes a bottom sheet (mobileSheet); tapping outside and the Android back button close it. Looks the same on iOS and Android.
Examples
PopoverRenderContext
interfaceValues received when children is given as a function.
| Name | Type | Description |
|---|---|---|
close | () => void | Closes the panel. |
PopoverProps
interfaceProps of the Popover component (same names as on web).
| Name | Type | Default | Description |
|---|---|---|---|
trigger | ReactElement | Element that opens and closes the panel, usually a Button. | |
children? | ReactNode | ((context: PopoverRenderContext) => ReactNode) | Content of the panel. When a function, it receives { close }. | |
title? | ReactNode | Title on top of the panel; screen readers announce the panel by this name. | |
description? | ReactNode | Description below the title. | |
label? | string | Screen reader name; give it when there is no visible title. | |
side? | Placement | "auto" | Position relative to the trigger (e.g. "top-right"); flips to the opposite side if it does not fit. See Placement. |
open? | boolean | Whether it is open in controlled use. | |
defaultOpen? | boolean | false | Open initially in uncontrolled use? |
onOpenChange? | (open: boolean) => void | Called with the new state when it opens or closes. | |
mobileSheet? | boolean | true | Turn into a bottom sheet on narrow screens (phones)? |
closeOnBackButton? | boolean | true | Should the Android back button close the open panel? |
style? | ViewStyle | Panel style (e.g. { width: 320 }). | |
testID? | string | Test id (panel). |