Bootstrap Mini Project: A Responsive Admin Dashboard
In this project you'll build a small admin dashboard for an online shop, step by step, using only Bootstrap 5.3 classes and a few lines of JavaScript. By the end it has a top navbar, a sidebar that turns into a slide-in drawer on small screens, statistic cards, an orders table, a quick-add form with validation and a toast notification.
What you'll use
| Feature | Lessons |
|---|---|
| Navbar with dark theme | Navbar, Dark Mode |
| Sidebar → offcanvas drawer | Offcanvas, Navs, List Groups |
| Stat cards in a responsive grid | Grid, Cards, Badges, Progress Bars |
| Orders table | Tables, Badges, Pagination |
| Quick-add form | Forms, Input Groups, Validation |
| Feedback | Toast |
| Layout glue | Utilities, Flex |
Note: The preview frame is as wide as the lesson column — usually below the
lgbreakpoint (992px). That means you'll see the mobile/tablet version of the dashboard, with a ☰ button that opens the sidebar. Maximise your browser window on a wide screen to see the sidebar permanently on the left. Drag the frame's bottom-right corner down to make it taller; the final dashboard is long.
Step 1 — The top navbar
Start with a dark navbar. The ☰ button opens the sidebar (built in step 2), so it's only shown below lg (d-lg-none).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-body-tertiary">
<nav class="navbar bg-dark sticky-top" data-bs-theme="dark">
<div class="container-fluid">
<button class="btn btn-outline-light btn-sm d-lg-none me-2" type="button">☰</button>
<a class="navbar-brand me-auto" href="#">🛍 ShopAdmin</a>
<span class="navbar-text small d-none d-sm-inline me-3">admin@shop.test</span>
<span class="rounded-circle bg-primary text-white d-inline-flex align-items-center justify-content-center"
style="width: 32px; height: 32px;">A</span>
</div>
</nav>
<main class="p-3">Dashboard content goes here.</main>
</body>
</html>Notice the layout tools: me-auto on the brand pushes the e-mail and avatar to the right, and d-none d-sm-inline hides the e-mail on very small screens.
Step 2 — The sidebar (offcanvas on small screens)
The sidebar uses a responsive offcanvas: .offcanvas-lg makes it a normal column from lg up and a slide-in drawer below. The ☰ button now targets it with data-bs-toggle="offcanvas".
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-body-tertiary">
<nav class="navbar bg-dark sticky-top" data-bs-theme="dark">
<div class="container-fluid">
<button class="btn btn-outline-light btn-sm d-lg-none me-2" type="button"
data-bs-toggle="offcanvas" data-bs-target="#sidebar" aria-controls="sidebar">☰</button>
<a class="navbar-brand me-auto" href="#">🛍 ShopAdmin</a>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-lg-2 p-0 border-end bg-body">
<div class="offcanvas-lg offcanvas-start" tabindex="-1" id="sidebar" aria-labelledby="sidebarLabel" style="--bs-offcanvas-width: 220px;">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="sidebarLabel">Menu</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#sidebar" aria-label="Close"></button>
</div>
<div class="offcanvas-body p-2">
<nav class="nav nav-pills flex-column w-100">
<a class="nav-link active" aria-current="page" href="#">📊 Dashboard</a>
<a class="nav-link" href="#">🧾 Orders</a>
<a class="nav-link" href="#">📦 Products</a>
<a class="nav-link" href="#">👥 Customers</a>
<a class="nav-link" href="#">⚙️ Settings</a>
</nav>
</div>
</div>
</div>
<main class="col-lg-10 p-3">Click ☰ to open the sidebar (below lg).</main>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>Below lg the sidebar column is empty (its content lives in the hidden drawer), so the main column takes the full width.
Step 3 — Stat cards
Four key numbers, shown 1 per row on tiny screens, 2 per row from sm and 4 per row from xl. Each card uses flex utilities to put the icon on the right, and one card includes a slim progress bar.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-body-tertiary p-3">
<div class="row row-cols-1 row-cols-sm-2 row-cols-xl-4 g-3">
<div class="col">
<div class="card border-0 shadow-sm h-100"><div class="card-body d-flex align-items-center">
<div class="me-auto"><div class="small text-body-secondary">Revenue</div><div class="fs-4 fw-bold">$12,480</div></div>
<span class="fs-2">💰</span>
</div></div>
</div>
<div class="col">
<div class="card border-0 shadow-sm h-100"><div class="card-body d-flex align-items-center">
<div class="me-auto"><div class="small text-body-secondary">Orders</div><div class="fs-4 fw-bold">318 <span class="badge text-bg-success fs-6">+12%</span></div></div>
<span class="fs-2">🧾</span>
</div></div>
</div>
<div class="col">
<div class="card border-0 shadow-sm h-100"><div class="card-body d-flex align-items-center">
<div class="me-auto"><div class="small text-body-secondary">Customers</div><div class="fs-4 fw-bold">1,024</div></div>
<span class="fs-2">👥</span>
</div></div>
</div>
<div class="col">
<div class="card border-0 shadow-sm h-100"><div class="card-body">
<div class="small text-body-secondary">Monthly goal</div>
<div class="fs-4 fw-bold">72%</div>
<div class="progress mt-1" role="progressbar" aria-label="Monthly goal" aria-valuenow="72" aria-valuemin="0" aria-valuemax="100" style="height: 6px;">
<div class="progress-bar bg-warning" style="width: 72%"></div>
</div>
</div></div>
</div>
</div>
</body>
</html>Step 4 — The orders table
A responsive table inside a card. Status badges use .text-bg-*; the header row of the card holds the title and a small pagination.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-body-tertiary p-3">
<div class="card border-0 shadow-sm">
<div class="card-header bg-body d-flex align-items-center">
<h6 class="mb-0 me-auto">Recent orders</h6>
<nav aria-label="Orders pages">
<ul class="pagination pagination-sm mb-0">
<li class="page-item active" aria-current="page"><span class="page-link">1</span></li>
<li class="page-item"><a class="page-link" href="#">2</a></li>
</ul>
</nav>
</div>
<div class="table-responsive">
<table class="table table-hover align-middle mb-0 text-nowrap">
<thead class="table-light"><tr><th>#</th><th>Customer</th><th>Total</th><th>Status</th></tr></thead>
<tbody>
<tr><td>1042</td><td>Linh Tran</td><td>$84.00</td><td><span class="badge text-bg-success">Delivered</span></td></tr>
<tr><td>1041</td><td>Omar Haddad</td><td>$19.50</td><td><span class="badge text-bg-warning">Processing</span></td></tr>
<tr><td>1040</td><td>Sara Kim</td><td>$210.00</td><td><span class="badge text-bg-info">Shipped</span></td></tr>
<tr><td>1039</td><td>Ana Silva</td><td>$12.00</td><td><span class="badge text-bg-danger">Cancelled</span></td></tr>
</tbody>
</table>
</div>
</div>
</body>
</html>Step 5 — Quick-add form with validation
A compact form to add an order. It uses an input group for the price, a select, Bootstrap validation (novalidate + .was-validated) and logs the new order.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-body-tertiary p-3">
<div class="card border-0 shadow-sm">
<div class="card-body">
<h6 class="card-title">Quick add order</h6>
<form id="addForm" class="row g-2" novalidate>
<div class="col-sm-5">
<input class="form-control" id="customer" placeholder="Customer" aria-label="Customer" required>
<div class="invalid-feedback">Name required.</div>
</div>
<div class="col-sm-3">
<div class="input-group has-validation">
<span class="input-group-text">lt;/span>
<input type="number" class="form-control" id="total" min="1" step="0.01" placeholder="0.00" aria-label="Total" required>
<div class="invalid-feedback">≥ $1</div>
</div>
</div>
<div class="col-sm-2">
<select class="form-select" id="status" aria-label="Status">
<option>Processing</option><option>Shipped</option><option>Delivered</option>
</select>
</div>
<div class="col-sm-2 d-grid"><button class="btn btn-primary" type="submit">Add</button></div>
</form>
</div>
</div>
<script>
const form = document.getElementById('addForm');
form.addEventListener('submit', (e) => {
e.preventDefault();
form.classList.add('was-validated');
if (!form.checkValidity()) return;
const total = Number(document.getElementById('total').value).toFixed(2);
console.log('new order:', document.getElementById('customer').value, '