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

Portal

Learn how to use the Portal component in React and React Native to render content outside the DOM hierarchy. Explore installation, API reference, and props. This is an illustration of Portal component.

Important Note
Note: The portal component renders its children outside the parent component's DOM hierarchy. However, it is important to note that the portal component is created using React context. This means that the portal component will not work if the parent component is not wrapped in a
GluestackUIProvider
or
OverlayProvider
.

Installation

Run the following command:

npx gluestack-ui add portal

API Reference

To use this component in your project, include the following import statement in your file.
import { Portal } from '@/components/ui/portal';
export default () => <Portal />;

Component Props

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

Portal

PropTypeDefaultDescription
isOpen
boolean-If true, the portal will open.
isKeyboardDismissable
boolean-If true, the keyboard can dismiss the portal.
useRNModal
booleanfalseIf true, renders react-native native modal.
useRNModalOnAndroid
booleanfalseIf true, renders react-native native modal only in android.
onRequestClose
((event: NativeSyntheticEvent<any>) => void) | undefined-Callback is called when the user taps the hardware back button on Android or the menu button on Apple TV. This is required on Apple TV and Android. Only applicable when
useRNModal
is true.
animationPreset
"fade" | "slide" | "none""fade"The animation preset for the portal.
Important Note
Note: The portal component can be used to create a modal, popover, menu, tooltip, or any other component that needs to be rendered outside the parent component's DOM hierarchy. However, We recommend using our components like
Modal
,
Popover
,
Menu
,
Tooltip
for these use cases since they handle all the accessibility.
Edit this page on GitHub
Go backPopover
Up nextTooltip
Go backPopover
Up nextTooltip