The Bootstrap 5 Utility API is a powerhouse feature for frontend architects. Instead of manually writing dozens of utility classes and responsive media queries by hand, Bootstrap uses a declarative Sass map called $utilities. The Sass compiler loops through this map and automatically generates hundreds of utility classes with responsive breakpoint variants.
cursor ClassesTo generate custom utility classes for mouse cursor types (e.g. .cursor-pointer, .cursor-grab), merge your definition into $utilities before importing bootstrap/utilities/api:
// In your custom.scss
@import "bootstrap/scss/functions";
@import "bootstrap/scss/variables";
@import "bootstrap/scss/maps";
@import "bootstrap/scss/mixins";
@import "bootstrap/scss/utilities";
// Define custom cursor utility
$utilities: map-merge(
$utilities,
(
"cursor": (
property: cursor,
class: cursor,
responsive: true,
values: (
pointer: pointer,
grab: grab,
grabbing: grabbing,
default: default,
not-allowed: not-allowed
)
)
)
);
// Compile all utilities
@import "bootstrap/scss/utilities/api";
This automatically outputs the following CSS classes across all breakpoints:
.cursor-pointer { cursor: pointer !important; }
.cursor-grab { cursor: grab !important; }
.cursor-not-allowed { cursor: not-allowed !important; }
@media (min-width: 768px) {
.cursor-md-pointer { cursor: pointer !important; }
}
Strengthen your responsive web design mastery by studying these connected classes:
The foundational Sass architecture that powers Bootstrap's utility API.
See how m-* and p-* are generated automatically by the Utility API.
Examine the Sass definitions behind justify-content and align-items.
Prevent CSS bloat by generating only the responsive breakpoints you need.
!important guarantees that applying a utility class like .m-0 or .d-none will always take precedence over component styles.
$utilities: map-merge($utilities, ('opacity': null));.
css-var: true inside the utility configuration, and Bootstrap will output --bs-[property]: value.
Advance your practical frontend engineering skills with the next topic in our synchronized curriculum.
Continue to Class 42: JavaScript APIs & Events → Previous: ← Class 40: CSS Custom Properties | Full Syllabus