Install Modus Bootstrap

Add Modus Bootstrap to your project with CDN, package manager, or source files.

Install

Pull in Modus Bootstrap’s source files into nearly any project with some of the most popular package managers. No matter the package manager, Modus Bootstrap will require a Sass compiler and PostCSS for a setup that matches our official compiled versions.

Package managed installs don’t include documentation or our full build scripts. You can also use any demo from our Examples repo to quickly jumpstart Modus Bootstrap projects.

After installing, head to our npm guide for a full setup guide.

npm install modus-bootstrap
pnpm add modus-bootstrap
yarn add modus-bootstrap
bun add modus-bootstrap

The Modus Bootstrap npm package is published to npm‘s registry, which pnpm, Yarn, and Bun use.

Get started with Modus Bootstrap via npm with our starter project! Head to the Sass & JS example template repository to see how to build and customize Modus Bootstrap in your own npm project. Includes Sass compiler, Autoprefixer, Stylelint, PurgeCSS, and Bootstrap Icons.

Using npm

Using import * as bootstrap from 'bootstrap' will load all of Bootstrap’s plugins onto a bootstrap object. You can also import plugins individually for automatic tree shaking:

JavaScript
import { Tooltip, Toast, Popover } from 'bootstrap'

You can also import plugins directly by loading the /js/dist/*.js files under the package’s top-level directory.

Modus Bootstrap’s package.json contains some additional metadata under the following keys:

  • sass - path to Modus Bootstrap’s main Sass source file
  • style - path to Modus Bootstrap’s non-minified CSS that’s been compiled using the default settings (no customization)

Additionally, Modus Bootstrap ships a .browserslistrc file at the package root, which defines browser targets for tools like Browserslist and Autoprefixer.

Using Yarn

Yarn 2+ (aka Yarn Berry) doesn’t support the node_modules directory by default, so our Sass & JS example needs some adjustments:

Shell
yarn config set nodeLinker node-modules # Use the node_modules linker
touch yarn.lock # Create an empty yarn.lock file
yarn install # Install the dependencies
yarn start # Start the project

CDN

Include Modus Bootstrap’s CSS and Bootstrap’s JavaScript files via CDN. CDNs (Content Delivery Networks) are services that provides copies of libraries for your website. Instead of installing Modus Bootstrap via a package manager, you link to CDN-hosted files in your website.

Here are our primary CDN links for CSS and JavaScript:

HTML
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/modus-bootstrap.min.css" rel="stylesheet">
<script type="module" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-+PW0IDVGGwmpaBQvcXY+W0BcpHpITFB3dSfSoGvDdHtLbrLpSbpGcvtQRM/BJpz+" crossorigin="anonymous"></script>

If you prefer to include Floating UI and Vanilla Calendar Pro separately instead of using the bundle, use an import map to resolve the bare module specifiers:

HTML
<script type="importmap">
{
  "imports": {
    "@floating-ui/dom": "https://cdn.jsdelivr.net/npm/@floating-ui/[email protected]/dist/floating-ui.dom.esm.min.js",
    "vanilla-calendar-pro": "https://cdn.jsdelivr.net/npm/[email protected]/index.mjs"
  }
}
</script>
<script type="module" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-3Yo3YCoxUQZoPH8he5dQIEAZ/k/vBTLYf1CFU5hE7GYPzQZu3dYpWvBwWKxN+HJZ" crossorigin="anonymous"></script>

Using CDNs

You can also use the CDN to fetch any of our additional builds.

When using CDN links, be sure to use the integrity attribute to verify the correct files and versions. These hashes are unique to each file and version of Modus Bootstrap, so when you update to a new version, be sure the integrity attribute is also updated.

We also include a crossorigin="anonymous" attribute to prevent CORS errors.

Alternative CDNs

We recommend jsDelivr and use it ourselves in our documentation. However, in some cases—like in some specific countries or environments—you may need to use other CDN providers like cdnjs or unpkg.

You’ll find the same files on these CDN providers, albeit with different URLs. With cdnjs, you can use this direct Bootstrap package link to copy and paste ready-to-use HTML snippets for each dist file from any version of Bootstrap.

Security warning — If the SRI hashes differ for a given file, you shouldn’t use the files from that CDN, because it means that the file was modified by someone else.

Note that you should compare same length hashes, e.g. sha384 with sha384, otherwise it’s expected for them to be different. As such, you can use an online tool like SRI Hash Generator to make sure that the hashes are the same for a given file. Alternatively, assuming you have OpenSSL installed, you can achieve the same from the CLI, for example:

Shell
openssl dgst -sha384 -binary bootstrap.min.js | openssl base64 -A

Download

You can also do the old fashioned thing and download Modus Bootstrap manually. Choose between compiled dist (distribution) files or source files. The latter requires some additional tooling to compiled and use Modus Bootstrap in your project.

TypeDescriptionLink
Distribution filesReady-to-use compiled and minified CSS and JavaScript files. Doesn't include documentation, source files, or dependencies like Floating UI and Vanilla Calendar Pro.Download
Source filesSass, JavaScript, and documentation files for compiling with your own asset pipeline. Requires Sass compiler, Autoprefixer, and a JavaScript bundler like Rollup or Webpack.Download

Should you require our full set of build tools, they are included for developing Modus Bootstrap and its docs, but they’re likely unsuitable for your own purposes.