React Suite Tooltip Container and prevent overflow Last Updated : 17 Aug, 2022 Comments Improve Suggest changes Like Article Like Report React Suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, we'll learn about React Suite Tooltip Container and prevent overflow. The tooltip component allows the user to display informative text when users hover over, focus on, or tap an element. The preventOverflow prop helps in preventing floating element overflow. Syntax: function App() { <PreventOverflowContainer> {(getContainer) => ( <Whisper preventOverflow container={...} speaker={ <Tooltip>...</Tooltip> } > ... </Whisper> )} </PreventOverflowContainer> } Creating React Application And Installing Module: Step 1: Create a React application using the given command: npm create-react-app projectname Step 2: After creating your project, move to it using the given command: cd projectname Step 3: Now Install the rsuite node package using the given command: npm install rsuite Project Structure: Now your project structure should look like the following:  Example 1: Below example demonstrates the tooltip in a container with a preventOverflow prop. JavaScript import "rsuite/dist/rsuite.min.css"; import { Whisper, Button, Tooltip } from "rsuite"; import { useEffect, useRef } from "react"; function PreventOverflowContainer({ children, height = 500 }) { const dataContainer = useRef(); const dataContent = useRef(); const conStyles = { overflow: "auto", position: "relative", }; const disStyles = { height: "400%", width: "230%", justifyContent: "center", alignItems: "center", display: "flex", flexWrap: "wrap", }; useEffect(() => { dataContainer.current.scrollTop = dataContent.current.clientHeight / 2 - 60; dataContainer.current.scrollLeft = dataContent.current.clientWidth / 2 - dataContainer.current.clientWidth / 2; }, [dataContainer, dataContent]); return ( <div style={{ ...conStyles, height }} ref={dataContainer}> <div style={disStyles} ref={dataContent}> {children(() => dataContainer.current)} </div> </div> ); } const speaker = ( <Tooltip style={{ width: 120 }}> This is GFG Tooltip </Tooltip> ); export default function App() { return ( <div> <div style={{ textAlign: "center" }}> <h2>GeeksforGeeks</h2> <h4 style={{ color: "green" }}> React Suite Tooltip Container and prevent overflow </h4> </div> <div style={{ padding: 20, textAlign: "center" }}> <div> <PreventOverflowContainer height={300}> {(getContainer) => ( <Whisper preventOverflow trigger="click" controlId="control-id-container" container={getContainer} speaker={speaker} > <Button appearance="primary" color="green"> Click </Button> </Whisper> )} </PreventOverflowContainer> </div> </div> </div> ); } Output:  Example 2: Below example demonstrates the tooltip in a container with a preventOverflow and followCursor prop. JavaScript import "rsuite/dist/rsuite.min.css"; import { Whisper, Button, Tooltip } from "rsuite"; import { useEffect, useRef } from "react"; function PreventOverflowContainer({ children, height = 500 }) { const dataContainer = useRef(); const dataContent = useRef(); const conStyles = { overflow: "auto", position: "relative", }; const disStyles = { height: "400%", width: "230%", justifyContent: "center", alignItems: "center", display: "flex", flexWrap: "wrap", }; useEffect(() => { dataContainer.current.scrollTop = dataContent.current.clientHeight / 2 - 60; dataContainer.current.scrollLeft = dataContent.current.clientWidth / 2 - dataContainer.current.clientWidth / 2; }, [dataContainer, dataContent]); return ( <div style={{ ...conStyles, height }} ref={dataContainer}> <div style={disStyles} ref={dataContent}> {children(() => dataContainer.current)} </div> </div> ); } const speaker = ( <Tooltip style={{ width: 120 }}> This is GFG Tooltip </Tooltip> ); export default function App() { return ( <div> <div style={{ textAlign: "center" }}> <h2>GeeksforGeeks</h2> <h4 style={{ color: "green" }}> React Suite Tooltip Container and prevent overflow </h4> </div> <div style={{ padding: 20, textAlign: "center" }}> <div> <PreventOverflowContainer height={300}> {(getContainer) => ( <Whisper preventOverflow trigger="click" controlId="control-id-container" container={getContainer} speaker={speaker} followCursor > <Button appearance="primary" color="green"> Click </Button> </Whisper> )} </PreventOverflowContainer> </div> </div> </div> ); } Output:  Reference: https://rsuitejs.com/components/tooltip/#container-and-prevent-overflow Comment More infoAdvertise with us Next Article React Suite Tooltip Disabled elements T tarunsinghwap7 Follow Improve Article Tags : Web Technologies ReactJS React-Suite Components React-Suite General React-Suite +1 More Similar Reads DrawerReact Suite Drawer ComponentReact Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. The Drawer component is a panel that slides in from the edge of the screen.  We can use the following approach in ReactJS to use the React Suite Drawer Component 3 min read React Suite Backdrop DrawerReact suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, we'll learn about React Suite Backdrop Drawer. U 5 min read React Suite Drawer PropsReact Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. The Drawer component is a panel that slides in from the edge of the screen. <Drawer> Props: autoFocus: The Drawer is opened and is automatically focused on 4 min read React Suite Placement DrawerReact suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, we'll learn about React Suite Placement Drawer. 5 min read React Suite Drawer FullpageReact Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products.  The Drawer component is a panel that slides in from the edge of the screen. These drawers can be placed in around 4 different positions and those are top, bott 3 min read React Suite Drawer ts:Placement PropsReact Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products.  The Drawer component is a panel that slides in from the edge of the screen. Now, these drawers can be placed in around 4 different positions and those are top, 4 min read DropdownReact Suite Dropdown Dropdown with IconReact Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. The dropdown component allows the user to provide navigation that uses a select picker if you want to select a value. Dropdown with Icon will help us to add an 3 min read React Suite Dropdown SubmenuReact Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. The dropdown component allows the user to provide navigation that uses a select picker if you want to select a value. The dropdown submenu is used to create a ne 2 min read React Suite Dropdown Used with next/linkReact Suite is a front-end library designed for the middle platform and back-end products. The React Suite Dropdown component allows navigating with a number of options to select from a dropdown. React Suite Dropdown Used with next/link helps to wrap the items in the dropdown into hyperlinks. Syntax 3 min read ModalReact Suite Modal Alert dialogsReact suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, we'll learn about React suite Modal alert dialog 5 min read React Suite Modal BackdropReact Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. Modal component allows the user to provide a solid foundation for creating dialogs, lightboxes, popovers, etc. The modal can be designed differently through back 4 min read React Suite Modal SizeA React suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, we'll learn about React suite Modal Sizes. The 6 min read PopoverReact Suite Dropdown Used with PopoverReact Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. The dropdown component allows the user to provide navigation that uses a select picker if you want to select a value. The dropdown component with popover basica 3 min read React Suite Popover Follow CursorReact suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, weâll learn about React suite Popover Follow Cur 3 min read React Suite Popover Hide Arrow IndicatorReact suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, weâll learn about React Suite Popover Hide Arrow 3 min read TooltipReact Suite Tooltip Follow CursorReact suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, weâll learn about React suite Tooltip Follow Cur 3 min read React Suite Tooltip Hide Arrow IndicatorReact suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, weâll learn about React suite Tooltip Hide Arrow 3 min read React Suite Tooltip Triggering eventsReact Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. The tooltip component allows the user to display informative text when users hover over, focus on, or tap an element. The tooltip props are used to add property 3 min read React Suite Tooltip Container and prevent overflowReact Suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, we'll learn about React Suite Tooltip Container 3 min read React Suite Tooltip Disabled elementsReact Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. The tooltip component allows the user to display informative text when users hover over, focus on, or tap an element. The tooltip disabled attribute is used to 2 min read React Suite Tooltip ComponentReact Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. Tooltip component allows the user to display informative text when users hover over, focus on, or tap an element. We can use the following approach in ReactJS to 3 min read React Suite Tooltip <Whisper> PropsReact Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. The tooltip component allows the user to display informative text when users hover over, focus on, or tap an element. Whisper Binds an event to an element and d 3 min read React Suite Tooltip ts:Placement PropsReact Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. The tooltip component allows the user to display informative text when users hover over, focus on, or tap an element. The placement props are used along with Wh 3 min read React Suite Tooltip PlacementReact Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. The tooltip component allows the user to display informative text when users hover over, focus on, or tap an element. Tooltip placement can be used to alter the 3 min read FormReact Suite Form ComponentReact Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. Form Component provides a way to make a form and take user input and then forward it to the server for further data processing. We can use the following approach 4 min read React Suite Components Form validation InputReact Suite is a collection of beautiful and customizable components for ReactJS that makes building user interfaces easier. One essential component is the Input. It handles form validation and user input smoothly, showing helpful error messages. This makes it perfect for creating strong and user-fr 3 min read React Suite Form Validation Default CheckReact Suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, weâll learn about React Suite Form Validation De 3 min read IconsReact Suite Button IconReact Suite Button Icon allows to use of an Icon as a Button. The Button component is used to fire an action when the user clicks the button. React Suite Button IconButton Icon component is used when we want to use an icon as a button, It has an icon property that is used to specify the icon of the 3 min read React Suite Dropdown Dropdown with IconReact Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. The dropdown component allows the user to provide navigation that uses a select picker if you want to select a value. Dropdown with Icon will help us to add an 3 min read React Suite Nav With IconPre-requisite: React Suite Introduction A React suite is a library of React components, sensible UI design, and a friendly development experience. It is supported in all major browsers. It provides pre-built components of React which can be used easily in any web application. In this article, we'll 3 min read React Suite Avatar Component React Suite is a popular front-end library with a set of React components that are designed for the middle platform and back-end products. Avatar component allows the user to display an avatar or brand. We can use the following approach in ReactJS to use the React Suite Avatar Component. Avatar Prop 2 min read Like