Skip to content

Utility API

Utilities are single-purpose classes that you combine directly in markup. Stack several on one element, add a breakpoint infix such as d-md-flex to change behaviour from a screen size up, and tune colour states through CSS variables like --bs-bg-opacity, --bs-border-opacity and --bs-link-opacity. The recipes below build complete interface pieces without writing any custom CSS.

1A card made only of utilities

Background, border, radius, padding and shadow utilities stacked on a plain div give you a card without the card component.

Mains

Fresh flavours, made every day

Friendly people answer your questions quickly, by phone, chat or email.

2Responsive display: d-none d-md-flex

Breakpoint infixes switch a utility on from a screen size up. Resize the window: the toolbar row appears from md, the compact button below it.

d-none d-md-flex and d-flex d-md-none

3State via --bs-bg-opacity

Every bg-{colour} reads the --bs-bg-opacity variable, so one inline variable fades the fill (the labels sit under it, so they stay readable on every step).

1
.6
.35
.15
.05

4State via --bs-border-opacity

Border colour utilities read --bs-border-opacity; set it inline for values between the border-opacity-* steps.

1
.6
.3
.1

5State via --bs-link-opacity

Coloured links read --bs-link-opacity: fade a link that is not available yet, or fade on hover - a link people must read stays at full strength.

6Media object

d-flex with gap, flex-shrink-0 on the image and flex-grow-1 on the text is the classic comment or list row.

Lucas Okafor
Lucas Okafor1 days ago

We measure success by how many guests come back and tell their friends.

7Status badges without the badge component

Subtle backgrounds, emphasis text, small padding and rounded-pill compose a soft status label.

Active Pending Blocked

8Stat tile

Font size, weight, line height and colour utilities turn three lines of text into a dashboard metric.

Revenue
$45,592.39
+76% this month
Customers
4.8k
-5% this month

9Avatar with a status dot

position-relative on the wrapper, then position-absolute, bottom-0 / end-0 and a white border for the online dot.

Hana Fischer Online
Elena Silva Away

10Responsive alignment

text-center on phones and text-md-start from md: a hero block that centres only where it should.

Taste the city's favourite kitchen

Book a table online in seconds, or call us for groups of eight or more.

Get started

11Stack on phones, row on tablets

flex-column flex-md-row with gap-3: three blocks stack on small screens and line up from md.

Chef's specials
Fast delivery
Kid friendly

12Callout from border-start

A single side border with a thick width and a theme colour makes a note or warning callout.

Heads up

Children are always welcome, with a menu made just for them.

13Settings row

justify-content-between and align-items-center place a label on the left and a control on the right.

Email alerts
Daily summary at 18:15
On
Push notifications
Only mentions
Off

14Announcement bar

text-bg-dark sets a contrasting text colour with the background; small and gap utilities do the rest.

New Cooked with care, served with a smile Read more

15Filter chips that wrap

flex-wrap with gap-2 lets a row of chips flow onto new lines without margin hacks.

All case study Starters smart release

16Product line item

A thumbnail, a truncated title and a right-aligned price: overflow-hidden on the middle column lets text-truncate work in flex.

Lemon tiramisu
Lemon tiramisu - modern edition
Desserts
$9.00

17Responsive spacing

p-2 p-md-4 and mb-2 mb-md-3: tighter padding on phones, roomier from md, no media query needed.

How we make our sourdough every morning

Our sommelier has paired each dish with wines from small family vineyards. Thousands of guests already trust us, and we work hard to keep it that way.

18Underline that appears on hover

link-underline-opacity-0 hides the underline, the -hover variants bring it back with a little offset.

19Image with a text overlay

position-relative wrapper, an absolutely placed caption at bottom-0 and bg-dark with --bs-bg-opacity for the scrim.

Good food brings people together
Cape Town
Wood-fired, slow-cooked, unforgettable

20Empty state panel

A centred flex column with a large icon, muted text and one action, built from spacing and text utilities.

No files yet

Clear prices, honest advice and no surprises along the way.