gluestack-ui logo
Get Updates
Prompt to React Native UI
Home
Components
Hooks
Apps
MCP Server
Guides
Home
Overview
IntroductionQuick Start
Getting Started
InstallationTooling SetupVS Code ExtensionsFigma UI KitCLIgluestack-ui-nativewind-utils
Core Concepts
AccessibilityUniversal
Performance
Benchmarks
Theme Configuration
Default TokensCustomizing ThemeDark Mode
Components
All Components
Typography
HeadingrscTextrsc
Layout
BoxrscCenterrscDividerHStackrscVStackrscGridalpha, rsc
Feedback
AlertProgressSpinnerToast
Data Display
BadgeCardrscTablealpha
Forms
ButtonCheckboxFormControlInputLinkPressableRadioSelectSliderSwitchTextarea
Overlay
AlertDialogDrawerMenuModalPopoverPortalTooltip
Disclosure
ActionsheetAccordionBottomSheetalpha
Media And Icons
AvatarImageIconrsc
Others
FabSkeletonalpha, rsc
Hooks
useBreakPointValue
useMediaQuery
Apps
Dashboard App
Kitchensink App
Todo App
Starter Kit
MCP Server
MCP Server
Guides
Recipes
LinearGradient
Tutorials
Building Ecommerce App
More
Upgrade to v2Upgrade to v3FAQsReleasesRoadmapTroubleshootingDiscord FAQs

Popover

Improve user experience with a React Popover component—perfect for contextual modals, tooltips & interactive UI elements. Works seamlessly in React & React Native! This is an illustration of Popover component.
size
placement

Installation

Run the following command:

npx gluestack-ui add popover

API Reference

To use this component in your project, include the following import statement in your file.
import {
  Popover,
  PopoverBackdrop,
  PopoverContent,
  PopoverArrow,
  PopoverHeader,
  PopoverCloseButton,
  PopoverBody,
  PopoverFooter,
} from '@/components/ui/popover';
export default () => (
  <Popover>
    <PopoverBackdrop />
    <PopoverContent>
      <PopoverArrow />
      <PopoverHeader>
        <PopoverCloseButton />
      </PopoverHeader>
      <PopoverBody />
      <PopoverFooter />
    </PopoverContent>
  </Popover>
);

Component Props

This section provides a comprehensive reference list for the component props, detailing descriptions, properties, types, and default behavior for easy project integration.

Popover

It inherits all the properties of React Native's View component.
PropTypeDefaultDescription
defaultIsOpen
boolean-Specifies the default open state of the popover.
isOpen
boolean-If true, the popover will open. Useful for controllable state behavior.
trapFocus
booleantrueWhether popover should trap focus.
focusScope
booleantrueWhether focus should be outside of popover or not
shouldFlip
booleantrueWhether the element should flip its orientation when there is insufficient room.
initialFocusRef
React.RefObject<any>-The ref of element to receive focus when the popover opens.
finalFocusRef
React.RefObject<any>-The ref of element to receive focus when the popover closes
trigger
() => any-Function that returns a React Element. This element will be used as a Trigger for the popover.
crossOffset
number-The additional offset applied along the cross axis between the element and its trigger element.
offset
number-The additional offset applied along the main axis between the element and its trigger element.
shouldOverlapWithTrigger
booleanfalseDetermines whether popover content should overlap with the trigger.
isKeyboardDismissable
boolean-If true, the keyboard can dismiss the popover.
placement
'top' | 'top left' | 'top right' | 'bottom' | 'bottom left' | 'bottom right' | 'right' | 'right top' | 'right bottom' | 'left' | 'left top' | 'left bottom''bottom'Popover placement
useRNModal
booleanfalseIf true, renders react-native native modal.
avoidKeyboard
boolean-If true, the popover will avoid the keyboard.
onOpen
() => any-This function will be invoked when popover is opened.
onClose
() => any-This function will be invoked when popover is closed.
children
any-The content to display inside the popover.

PopoverBackdrop

It is React Native's Pressable component, created using [@legendapp/motion's] (https://legendapp.com/open-source/motion/)
createMotionAnimatedComponent
function to add animation to the component. You can use any declarative animation library you prefer.

PopoverContent

Contains all backdrop related layout style props and actions. It is @legendapp/motion's [Motion.View](https://legendapp.com/open-source/ motion/overview/) component. You can use any declarative animation library you prefer.

PopoverHeader

It inherits all the properties of React Native's View component.

PopoverFooter

It inherits all the properties of React Native's View component.

PopoverBody

It inherits all the properties of React Native's View component.

PopoverCloseButton

It inherits all the properties of React Native's Pressable component.

Features

  • Keyboard support for actions.

Accessibility

We have outlined the various features that ensure the Popover component is accessible to all users, including those with disabilities. These features help ensure that your application is inclusive and meets accessibility standards. It adheres to the Dialog WAI-ARIA design pattern..

Keyboard

  • Space
    : Opens/closes the popover.
  • Enter
    : Opens/closes the popover.
  • Tab
    : Moves focus to the next focusable element.
  • Shift + Tab
    : Moves focus to the previous focusable element.
  • Esc
    : Closes the popover and moves focus to PopoverTrigger.

Screen Reader

  • VoiceOver: When we click on button, the screen reader will announce Popover, menu expanded, button and when we close it then it says Popover, menu collapsed, button. Popover component i

Props

Popover component is created using View component from react-native. It extends all the props supported by React Native View, utility props and the props mentioned below.

Popover

NameValueDefault
size
xs | sm | md | lg | fullmd

Examples

The Examples section provides visual representations of the different variants of the component, allowing you to quickly and easily determine which one best fits your needs. Simply copy the code and integrate it into your project.

Popover used along with multiple Avatars

Popover with CTA

Popover with Image

Popover with InputField

Edit this page on GitHub
Go backModal
Up nextPortal
Go backModal
Up nextPortal