VOOZH about

URL: https://www.geeksforgeeks.org/reactjs/react-bootstrap-transition-utilities/

⇱ React Bootstrap Transition Utilities - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

React Bootstrap Transition Utilities

Last Updated : 23 Jul, 2025

React Bootstrap Transition Utilities provide a streamlined way to incorporate transitions into your user interface. Whether you want to add a fade-in effect or smoothly animate elements, these utilities offer a convenient solution. Import the utility components, such as Fade or Collapse, and apply them to your elements, allowing for a visually appealing and responsive UI that engages users with smooth and polished transitions.

React transition utilitiesDescription
CollapseA transition component in React Bootstrap that enables the creation of a collapsible element with a smooth animation.
FadeA transition component in React Bootstrap that facilitates the creation of a fading effect for elements.
SlideA transition component in React Bootstrap that allows the creation of a sliding effect for elements.

Syntax:

import { Collapse } from "react-bootstrap";
<Collapse ...>
{/* ... */}
</Collapse>

Transition API Properties

PropertiesDescription
inControls whether the transition is currently active or not.
mountOnEnterIf set to true, unmounts the component when the in prop is false.
unmountOnExitIf set to true, unmounts the component when the transition is complete.
timeoutSets the duration of the transition. It defines the time the transition takes to complete, specified in milliseconds.

Steps to create React Application:

Step 1: Create a React app using the following command

npx create-react-app projectname
cd projectname

Step 2 : After creating the React app move to our project directory using the following command

cd myapp

Step 3: Install the dependencies

npm install react-bootstrap bootstrap

Step 4: Import Bootstrap CSS in App.js file

import "bootstrap/dist/css/bootstrap.css ";

Step 5: The updated dependencies in package.json file will look like

"dependencies": {
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"bootstrap": "^5.3.2",
"react": "^18.2.0",
"react-bootstrap": "^2.10.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
}

Example: This example shows implementation to collapse toggle animation to an element or component.

Output:

👁 kio

Example 2: This example shows implementation to add a fade animation to a child element or component

Output:

👁 kio

Comment