This project is not covered by Drupal’s security advisory policy.
Per-node toggle to override the Bootstrap5 container layout. When checked, it uses the opposite of the theme default: full-width if the theme is fixed, or fixed-width if the theme is fluid. Currently the theme settings for Body containers is global - fluid or fixed. This module makes it super easy to change this on a node by node basis.
Introduction
Bootstrap5 Container Toggle lets content editors change the main content width on individual pages when using the Bootstrap5 theme or a Bootstrap5 sub-theme.
Your theme’s container setting controls whether content is full-width (fluid) or centered (fixed). This module adds a checkbox on each node so editors can override that per page. If the theme is fixed, the checkbox switches to full-width; if the theme is fluid, it switches to fixed-width.
If you change the global Bootstrap 5 container setting in your theme, any pages whose container is controlled by this module will also change layout.
For example, a page set by this module as fixed will appear fluid if the theme’s global container is set to fixed. Likewise, a page set as fluid will appear fixed if the theme’s global container is set to fluid.
Features
Basic functionality: Adds a “Container Toggle” field to all content types. When checked, the page uses the opposite layout of the theme default.
What it adds:
Per-node control over content width
Dynamic label that changes with the theme (e.g. “Use full-width layout” or “Use fixed-width layout”)
Layout that updates when the theme’s container setting changes
When to use it:
- When you want some pages full-width and others fixed width
- When you need a mix of fixed and fluid layouts without changing the theme
- When you want editors to choose layout per page without editing theme settings
Use cases:
- Landing pages with full-width hero sections
- Content pages that should be centered
- Sites with mixed layouts across different page types
Post-Installation
1. Enable the module
Extend → Bootstrap5 Container Toggle → Enable.
2. Add the field to the form display
The field is created but hidden by default. For each content type:
- Go to Structure → Content types → [Your content type] → Manage form display
- In the Disabled section, find Container Toggle (field_force_container)
- Drag it into the form (e.g. Content or Advanced)
Save
3. Clear cache
Configuration → Development → Performance → Clear all caches.
4. Use it on content
Edit any node and look for the Container Layout tab. Check or uncheck the toggle and save.
No extra config pages. The module reads the theme’s container setting automatically.
Additional Requirements
Drupal 11
- Bootstrap5 theme or a Bootstrap5 sub-theme
- No extra modules or libraries. Uses the theme’s b5_top_container setting.
Recommended modules/libraries
Bootstrap5 – base theme
Project information
- Project categories: Content display
- Ecosystem: Bootstrap5
- Created by tonyhrx on , updated
This project is not covered by the security advisory policy.
Use at your own risk! It may have publicly disclosed vulnerabilities.
