Overview
Bootstrap is a popular front-end framework that simplifies the process of creating responsive and visually appealing web applications. When combined with Angular, a powerful JavaScript framework, you can build dynamic web applications with ease. In this guide, we will explore how to use Bootstrap in Angular, covering integration process, components, and best practices.
What is Bootstrap
Bootstrap is a free, open-source framework that simplifies and speeds up the process of designing and developing websites and web applications. It provides a comprehensive set of pre-designed HTML, CSS, and JavaScript components and tools for creating responsive, visually appealing, and user-friendly web interfaces. Whether you are building a personal blog, a corporate website, or a complex web application, Bootstrap offers a solid foundation to get started.
Step 1: Install Bootstrap
Next, install Bootstrap in your Angular project. you can use npm
to do this:
npm install bootstrap
without specifying a version, npm installs the latest version of the Bootstrap package available in the npm registry. This means that npm will fetch the most recent stable release of Bootstrap. We can also change the version later by changing it in the package.json
file and running npm install
command.
or, if you want any particular version of bootstrap to be installed you can do so by mentioning that version as follows:
npm install bootstrap@5.5.0
This command will install Bootstrap version 5.5.0 for your project.

This command does the following things:
npm connects to the npm registry and fetches the Bootstrap package along with its specified version. It also downloads dependencies that Bootstrap itself relies on. These dependencies are typically specified in Bootstrap's package.json
file.
The Bootstrap package and its dependencies are installed locally within your projects's node_modules
directory. This local installation keeps your project's dependencies isolated from other projects, ensuring that you have control over the specific versions used in your project.
It also adds entry for the bootstrap as dependency for the project in the package.json
file, and package-lock.json
file too.

Inside the node_modules
directory, you will find a subdirectory for the Bootstrap package. This subdirectory contains the Bootstrap framework's files, including CSS, JavaScript, and other assets that you can use in your project.
Step 2: Configure Angular to Use Bootstrap
Angular uses the angular.json
file to manage project settings. Open this file and locate the "styles"
array within the "build"
section. Add the path to the Bootstrap CSS file in this array. Here's how your angular.json
file might look:
"styles": [
"src/styles.scss",
"node_modules/bootstrap/dist/css/bootstrap.min.css"
],