Chakra UI Overlay Popover
Last Updated :
24 Apr, 2025
Chakra UI Overaly Popover component creates an interactive and visually appealing pop-up overlay in the React application. We can embed the components in realtime usage like basic conformations, customized content, lazy-loaded components, controlled popovers, etc. In this article, we will create the practical implementation of the Chakra UI Overlay Popover component with proper examples and output.
Prerequisites:
Approach:
We have created the demonstration of the Chakra UI Overlay Popover component. This demonstration consists of various variants of Popover elements and also includes the customized Popover element with custom styling and color applied to it. We can customize the Chakra UI Overlay Popover component by using its various props and styling.
Steps to Create React Application and Installing Module:
Step 1: Create a React application using the following command:
npx create-react-app chakra
Step 2: After creating your project folder(i.e. chakra), move to it by using the following command:
cd chakra
Step 3: After creating the React application, Install the required package using the following command:
npm i @chakra-ui/react @emotion/react@^11 @emotion/styled@^11 framer-motion@^6
Project Structure:

The updated dependencies are in the package.json file.
"dependencies": {
"@chakra-ui/react": "^2.8.2",
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"framer-motion": "^6.5.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
}
Example: Below is the practical implementation of the Chakra UI Overlay Popover:
JavaScript
import React from "react";
import {
ChakraProvider,
Box,
Button,
VStack,
HStack,
Input,
RadioGroup,
Radio,
Popover,
PopoverTrigger,
PopoverContent,
PopoverHeader,
PopoverArrow,
PopoverCloseButton,
PopoverBody,
PopoverAnchor,
Heading,
} from "@chakra-ui/react";
function App() {
const basicPopover = (
<Popover>
<PopoverTrigger>
<Button colorScheme="teal">Click me</Button>
</PopoverTrigger>
<PopoverContent>
<PopoverArrow />
<PopoverCloseButton />
<PopoverHeader>Confirmation!</PopoverHeader>
<PopoverBody>Do you want to Buy React Course?</PopoverBody>
</PopoverContent>
</Popover>
);
const customizedPopover = (
<Popover>
<PopoverTrigger>
<Box
tabIndex="0"
role="button"
aria-label="Some box"
p={5}
w="120px"
bg="gray.300"
>
Click
</Box>
</PopoverTrigger>
<PopoverContent bg="tomato" color="white">
<PopoverHeader fontWeight="semibold">
Customization
</PopoverHeader>
<PopoverArrow bg="pink.500" />
<PopoverCloseButton bg="purple.500" />
<PopoverBody>Custom Popover</PopoverBody>
</PopoverContent>
</Popover>
);
const lazyPopover = (
<Popover isLazy>
<PopoverTrigger>
<Button colorScheme="blue">Click me</Button>
</PopoverTrigger>
<PopoverContent>
<PopoverHeader fontWeight="semibold">
Lazy Popover
</PopoverHeader>
<PopoverArrow />
<PopoverCloseButton />
<PopoverBody>Hello GeeksforGeeks</PopoverBody>
</PopoverContent>
</Popover>
);
const controlledPopover = (
<Popover>
<PopoverTrigger>
<Button colorScheme="purple">Controlled Popover</Button>
</PopoverTrigger>
<PopoverContent>
<PopoverHeader fontWeight="semibold">
Controlled Content
</PopoverHeader>
<PopoverArrow />
<PopoverCloseButton />
<PopoverBody>Hello GFG.</PopoverBody>
</PopoverContent>
</Popover>
);
const popoverWithAnchor = (
<Popover>
<HStack>
<PopoverAnchor>
<Input
w="auto"
display="inline-flex"
defaultValue="Popover Anchor"
/>
</PopoverAnchor>
<PopoverTrigger>
<Button h="40px" colorScheme="pink">
Edit
</Button>
</PopoverTrigger>
</HStack>
<PopoverContent>
<PopoverHeader>Colors</PopoverHeader>
<PopoverArrow />
<PopoverCloseButton />
<PopoverBody>
<RadioGroup defaultValue="red">
<Radio value="red">Red</Radio>
<Radio value="blue">Blue</Radio>
<Radio value="green">Green</Radio>
</RadioGroup>
</PopoverBody>
</PopoverContent>
</Popover>
);
return (
<ChakraProvider>
<VStack spacing={8} align="center">
<Box>
<Heading as="h1" color="green">
GeeksforGeeks
</Heading>
<Heading as="h3" color="black">
Chakra UI Overlay Popover
</Heading>
</Box>
<HStack>
{basicPopover}
{customizedPopover}
{lazyPopover}
{controlledPopover}
{popoverWithAnchor}
</HStack>
</VStack>
</ChakraProvider>
);
}
export default App;
Start your application using the following command:
npm start
Output: Now go to http://localhost:3000 in your browser:

Similar Reads
Chakra UI Overlay Tooltip
Chakra UI's Tooltip component provides concise information when users hover over elements, enhancing user interaction and comprehension. It seamlessly integrates into both development and production stages, streamlining the user experience on websites or apps. Prerequisites:NPM and NodeReactHTML, CS
2 min read
React Chakra UI Overlay
Chakra UI, a comprehensive React component library, introduces the concept of Overlays serving as dynamic visual elements that are superimposed on the main content, providing additional context, functionality, or notifications. Although Chakra UI doesn't have a standalone "Overlay" component, it off
4 min read
Chakra UI Overlay Menu
An overlay menu is a type of navigation or menu system in web design that is displayed as an overlay on top of the main content of a webpage. It contrasts with traditional menus that are embedded within the page layout. The overlay menu is considered a modern design trend offering a dynamic size of
2 min read
Chakra UI Overlay Modal
Chakra UI Overlay Modal is a component used to create modal dialogs in React applications. It is part of the Chakra UI library, offering a set of components for building consistent and accessible user interfaces. This component is used for creating interactive and visually appealing modal dialogs. I
2 min read
React Chakra UI Overlay Drawer
React Chakra UI Overlay Drawer enhances web app navigation, integrating smoothly with Chakra UI. It offers intuitive access to extra content, without disrupting the main interface. Simple and customizable, it elevates user engagement and satisfaction. Prerequisites:NPM and NodeReactHTML, CSS, and Ja
2 min read
React-Bootstrap Popover Overlay
The React bootstrap provides us with the bootstrap components out of the box compared to normal React. It comes with the pre-applied CSS and the themes and properties of the bootstrap component can be modified by changing the properties. The Dropdown component is used for showing dropdowns in React
3 min read
React Chakra UI Other Portal
Chakra UI Other Portal component by Chakra UI allows and enables users to render the components outside their parent hierarchy, this is useful for rendering efficiently React Applications. We can use this component where we need to be visually positioned in the DOM outside its parent. In this articl
3 min read
Chakra UI Overlay Alert Dialog
Chakra UI Overlay Alert Dialog component helps you bring user attention to critical actions or information. It creates a modal overlay, preventing interaction with the main interface until a decision is made. In the following situations we generally uses the Chakra UI Overlay Alert Dialog: Confirmat
3 min read
Chakra UI Display
Chakra UI simplifies React UI development with customizable components. Its <Box> component offers easy visibility control across screen sizes. With Chakra UI, creating modern, accessible designs is effortless. Syntax:Hiding the Element on All Viewports: <Box display='none' />Hiding by D
2 min read
Chakra UI Navigation Link Overlay
Chakra UI Navigation Link Overlay component is a semantic component used to wrap elements (cards, blog posts, articles, etc.) in a link. It offers a user-friendly solution for improving navigation experience in web applications. By leveraging Chakra UI's features, developers can easily implement int
2 min read