twbs/bootstrap
Bootstrap is a sleek, intuitive, powerful front-end framework for faster web development. Includes responsive grid, components, and JavaScript plugins with extensive docs and tooling. Install via npm, yarn, Bun, Composer, or download releases.
Start by installing Bootstrap via Composer (composer require twbs/bootstrap@^5.3.8). Unlike earlier versions, this package includes compiled CSS/JS and source SCSS/CSS. In Laravel, publish the config and assets using php artisan vendor:publish --tag=bootstrap (if a service provider is provided) or manually link assets in your resources/css/app.css (e.g., @import 'bootstrap/scss/bootstrap';). Compile with Vite or Mix. First use case: enable responsive layouts by adding the Bootstrap container and grid classes to a Blade template (e.g., <div class="container">...</div>).
Note: For development, ensure your local Sass compiler watches for changes (fixed in v5.3.8 with improved SCSS autorecompile).
<div x-data="{ open: false }" @click.away="open = false">
<button @click="open = true">Toggle Modal</button>
<div x-show="open" style="display: none;" @click.stop>
<div class="modal" style="display: block;">
<!-- Modal content -->
</div>
</div>
</div>
resources/sass/_variables.scss before importing Bootstrap SCSS (e.g., @import 'bootstrap/scss/bootstrap';). Leverage the updated color-contrast() function for WCAG 2.1 compliance:
$primary: #0d6efd;
$primary-rgb: rgb_var($primary);
$primary-contrast: color-contrast($primary-rgb);
resources/js/app.js to optimize builds:
import { Modal, Tooltip } from 'bootstrap';
// Livewire
$wire.on('modal.show', (id) => new bootstrap.Modal(`#${id}`).show());
color-contrast() function to ensure WCAG compliance in custom themes.@import 'bootstrap/scss/bootstrap'; to override defaults. The color-contrast() function now requires RGB values (e.g., rgb_var($primary)).@popperjs/core installations unless using custom builds.dist/css/bootstrap.min.css for production, but use scss/ for customization. The dist/ files are now unminified in downloadable examples (v5.3.8).eval() in fallbacks. For strict CSP, use non-eval builds or whitelist 'unsafe-eval'.cursor: pointer by default (v5.3.8, PR #41639).How can I help you explore Laravel packages today?