]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
v6: More docs updates (#42450)
authorMark Otto <markd.otto@gmail.com>
Tue, 2 Jun 2026 06:12:17 +0000 (23:12 -0700)
committerGitHub <noreply@github.com>
Tue, 2 Jun 2026 06:12:17 +0000 (23:12 -0700)
* Add "new" badge to Stepper

It's new.

* Remove commented out

* Rearrange docs sidebar again to remove components groups, tweak a few things

* New default components page

* Fix swatch, update some content

* Revamp how we're doing themes in docs to be more instant

---------

Co-authored-by: nextgenthemes <nextgenthemes@users.noreply.github.com>
16 files changed:
site/data/sidebar.yml
site/src/assets/application.js
site/src/assets/partials/theme.js [new file with mode: 0644]
site/src/components/DocsSidebar.astro
site/src/components/shortcodes/Swatch.astro
site/src/content/docs/components/accordion.mdx
site/src/content/docs/components/button.mdx [moved from site/src/content/docs/components/buttons.mdx with 99% similarity]
site/src/content/docs/customize/color-modes.mdx
site/src/content/docs/customize/theme.mdx
site/src/content/docs/guides/quickstart.mdx
site/src/libs/highlight.ts
site/src/scss/_ads.scss
site/src/scss/_navbar.scss
site/src/scss/_sidebar.scss
site/src/scss/_syntax.scss
site/static/docs/[version]/assets/js/color-modes.js

index e3dd2e1edafe7d61db9014dfd696dbc153f0f510..3be5874321d8ebaa9416d5edc5688e827efe3542 100644 (file)
@@ -7,12 +7,10 @@
   icon_color: indigo
   pages:
     - title: Install
-    # - title: Introduction
     - title: Approach
     - title: CSS variables
     - title: JavaScript
     - title: Accessibility
-    # - title: Community
 
 - title: Guides
   section: Guides
   icon: menu-button-wide-fill
   icon_color: cyan
   pages:
-    - group: Buttons
-      pages:
-        - title: Buttons
-        - title: Button group
-        - title: Close button
-    - group: Feedback
-      pages:
-        - title: Alert
-        - title: Badge
-        - title: Placeholder
-        - title: Progress
-        - title: Spinner
-    - group: Overlays
-      pages:
-        - title: Menu
-          meta:
-            - added: 6.0.0
-        - title: Dialog
-          meta:
-            - added: 6.0.0
-        - title: Drawer
-          meta:
-            - added: 6.0.0
-        - title: Popover
-        - title: Toasts
-        - title: Tooltip
-    - group: Navigation
-      pages:
-        - title: Breadcrumb
-        - title: Nav
-        - title: Tab
-        - title: Nav overflow
-          meta:
-            - added: 6.0.0
-        - title: Navbar
-          meta:
-            - added: 6.0.0
-        - title: Pagination
-        - title: Stepper
-    - group: Layout
-      pages:
-        - title: Card
-        - title: List group
-    - group: Interactions
-      pages:
-        - title: Accordion
-        - title: Carousel
-        - title: Collapse
-        - title: Scrollspy
-        - title: Toggler
-          meta:
-            - added: 6.0.0
+    - title: Accordion
+      meta:
+        - added: 6.0.0
+    - title: Alert
+    - title: Avatar
+      meta:
+        - added: 6.0.0
+    - title: Badge
+    - title: Breadcrumb
+    - title: Button
+    - title: Button group
+    - title: Card
+    - title: Carousel
+    - title: Close button
+    - title: Collapse
+    - title: Dialog
+      meta:
+        - added: 6.0.0
+    - title: Drawer
+      meta:
+        - added: 6.0.0
+    - title: List group
+    - title: Menu
+      meta:
+        - added: 6.0.0
+    - title: Nav
+    - title: Nav overflow
+      meta:
+        - added: 6.0.0
+    - title: Navbar
+      meta:
+        - added: 6.0.0
 
-    - group: Miscellaneous
-      pages:
-        - title: Avatar
-          meta:
-            - added: 6.0.0
+    - title: Pagination
+    - title: Placeholder
+    - title: Popover
+    - title: Progress
+    - title: Scrollspy
+    - title: Spinner
+    - title: Stepper
+      meta:
+        - added: 6.0.0
+    - title: Tab
+    - title: Toasts
+    - title: Toggler
+      meta:
+        - added: 6.0.0
+    - title: Tooltip
 
 - title: Helpers
   section: Helpers
index 2a758ca314afebfafa745ace56dfc6fdc550d165..6ec0266da4fa0c3f4b72607ca9e7d4e8f97b2d4a 100644 (file)
 import sidebarScroll from './partials/sidebar.js'
 import snippets from './partials/snippets.js'
 import stickyNav from './partials/sticky.js'
+import theme from './partials/theme.js'
 import tocDrawer from './partials/toc.js'
 
 export default () => {
   sidebarScroll()
   snippets()
   stickyNav()
+  theme()
   tocDrawer()
 }
diff --git a/site/src/assets/partials/theme.js b/site/src/assets/partials/theme.js
new file mode 100644 (file)
index 0000000..836d46f
--- /dev/null
@@ -0,0 +1,28 @@
+// NOTICE: Internal docs helpers — not shipped in Bootstrap; not for reuse.
+
+/*
+ * JavaScript for Bootstrap's docs (https://getbootstrap.com/)
+ * Copyright 2011-2026 The Bootstrap Authors
+ * Licensed under the Creative Commons Attribution 3.0 Unported License.
+ * For details, see https://creativecommons.org/licenses/by/3.0/.
+ */
+
+import { Menu } from '@bootstrap'
+
+export default () => {
+  const themeSwitcher = document.getElementById('bd-theme')
+
+  if (!themeSwitcher) {
+    return
+  }
+
+  document.addEventListener('click', event => {
+    const toggle = event.target.closest('[data-bs-theme-value]')
+
+    if (!toggle) {
+      return
+    }
+
+    Menu.getOrCreateInstance(themeSwitcher).hide()
+  }, true)
+}
index 4da2d840b4c597053c0ac372802395c3082e77c1..9c2c7581b715f9fa314ff5400fff86e82ad70902 100644 (file)
@@ -19,7 +19,7 @@ const sidebar = getData('sidebar')
             <strong class="bd-links-heading d-flex w-100 align-items-center fw-semibold">
               {group.icon && (
                 <svg
-                  class="bi me-2"
+                  class="bi me-1"
                   style={
                     group.icon_color &&
                     `color: light-dark(var(--bs-${group.icon_color}-500), var(--bs-${group.icon_color}-400));`
index cb836eec2bd986faf9ab8f4fb0c720182aea52a2..eb5a9669e4c3d2e9f521a317497f7b9686e6aa15 100644 (file)
@@ -23,18 +23,18 @@ const sizeStyles = {
     verticalAlign: 'text-bottom',
     width: '1rem',
     height: '1rem',
-    borderRadius: 'var(--bs-border-radius-sm)'
+    borderRadius: 'var(--bs-radius-3)'
   },
   medium: {
     width: '100%',
     paddingBlock: '1.5rem',
-    borderRadius: 'var(--bs-border-radius)'
+    borderRadius: 'var(--bs-radius-5)'
   },
   large: {
     width: '100%',
     paddingBlock: '.5rem',
     paddingInline: '1rem',
-    borderRadius: 'var(--bs-border-radius-lg)'
+    borderRadius: 'var(--bs-radius-7)'
   }
 }
 
index 3f7037ca378258c6a0f6b1445a427fad56bbecec..66fe7451da26562b4bd46368c15325840808734f 100644 (file)
@@ -2,6 +2,10 @@
 title: Accordion
 description: Build vertically collapsing accordions with native HTML `<details>` and `<summary>` elements.
 toc: true
+aliases:
+ - "/docs/[[config:docs_version]]/components/"
+ - "/docs/components/"
+ - "/components/"
 css_layer: components
 ---
 
similarity index 99%
rename from site/src/content/docs/components/buttons.mdx
rename to site/src/content/docs/components/button.mdx
index 8b482e74ac9f5c9f5c43e03b8847e4a1610501cc..c32e0c020ce085dd05b7088011c3510fc2aefa25 100644 (file)
@@ -1,10 +1,8 @@
 ---
-title: Buttons
+title: Button
 description: Use Bootstrap’s custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.
 aliases:
- - "/docs/[[config:docs_version]]/components/"
- - "/docs/components/"
- - "/components/"
+ - "/docs/[[config:docs_version]]/components/buttons/"
 toc: true
 css_layer: components
 ---
index 58aa8c838c6678595d98a232fc8bcfcde1f83def..875e1cce5aeed018b742fffa1b78415eec48a8c4 100644 (file)
@@ -1,6 +1,6 @@
 ---
 title: Color modes
-description: Bootstrap now supports color modes, or themes, as of v5.3.0. Explore our default light color mode and the new dark mode, or create your own using our styles as your template.
+description: Bootstrap supports light and dark color modes. Dark mode is available globally by default, but can also be applied to specific components and elements via `data-bs-theme` attribute.
 toc: true
 ---
 
index b77652b6608e62fd6a693de506db9f017732c57b..32c9de2664020728d837840a97366bf7419c50ad 100644 (file)
@@ -1,6 +1,6 @@
 ---
 title: Theme
-description: The Bootstrap theme is a set of semantically named colors that are used to style our components, utilities, and more. The theme is configurable, responds to color modes, and can be consumed via Sass or CSS.
+description: The Bootstrap theme is a set of semantically named tokens that are used to style our components, utilities, and more. The theme is configurable, responds to color modes, and can be consumed via Sass or CSS.
 toc: true
 ---
 
index 50f56aedf5ef85b6099382499eb9960601dced59..0ba6085846423b187b33a77fdbd84423ab4c1a7a 100644 (file)
@@ -1,6 +1,7 @@
 ---
 title: CDN Quickstart
 description: The official guide for how to include Bootstrap’s CSS and JavaScript in your project using a CDN.
+toc: true
 aliases:
  - "/docs/[[config:docs_version]]/guides/"
  - "/docs/guides/"
@@ -9,9 +10,11 @@ aliases:
 
 Get started using Bootstrap in seconds by including our production-ready CSS and JavaScript by [using a CDN]([[docsref:/getting-started/install#cdn]]) without the need for any build steps. CDNs provide copies of Bootstrap’s codebase that’s ready to be used in any environment with minimal code changes required on your part.
 
-<Callout type="info">
-**Got the gist already?** See the end result in this [Bootstrap CodePen demo](https://codepen.io/team/bootstrap/pen/qBamdLj).
-</Callout>
+## Live demo
+
+**Already familiar with setting up HTML pages?** See the end result in this [Bootstrap CodePen demo](https://codepen.io/team/bootstrap/pen/qBamdLj).
+
+## Steps
 
 1. **Create a new `index.html` file in your project root.** Include the `<meta name="viewport">` tag as well for [proper responsive behavior](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/meta/name/viewport) in mobile devices.
 
@@ -62,3 +65,43 @@ Get started using Bootstrap in seconds by including our production-ready CSS and
    ```
 
 3. **Hello, world!** Open the page in your browser of choice to see your Bootstrapped page. Now you can start building with Bootstrap by creating your own [layout]([[docsref:/layout/grid]]), adding dozens of [components]([[docsref:/components/buttons]]), and utilizing [our official examples]([[docsref:/examples]]).
+
+## Optional font
+
+Bootstrap's source code defaults to a [native font stack]([[docsref:/content/reboot#native-font-stack]]), but we use a custom font for our hosted documentation to for more consistent styling across platforms. We use [Geist](https://fonts.google.com/specimen/Geist) and Geist Mono, and recommend using the same or similar in your project.
+
+1. **Add the Geist web font from Google Fonts.** Add the following to your `<head>`, before Bootstrap’s CSS:
+
+   ```html
+   <!doctype html>
+   <html lang="en">
+     <head>
+       <meta charset="utf-8">
+       <meta name="viewport" content="width=device-width, initial-scale=1">
+       <title>Bootstrap demo</title>
+       <link rel="preconnect" href="https://fonts.googleapis.com"><!--[!code highlight]-->
+       <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><!--[!code highlight]-->
+       <link href="https://fonts.googleapis.com/css2?family=Geist+Mono:wght@100..900&family=Geist:wght@100..900&display=swap" rel="stylesheet"><!--[!code highlight]-->
+       <link href="[[config:cdn.css]]" rel="stylesheet" integrity="[[config:cdn.css_hash]]" crossorigin="anonymous">
+     </head>
+     <body>
+       <h1>Hello, world!</h1>
+       <script type="module" src="[[config:cdn.js_bundle]]" integrity="[[config:cdn.js_bundle_hash]]" crossorigin="anonymous"></script>
+     </body>
+   </html>
+   ```
+
+2. **Apply the fonts by overriding Bootstrap’s CSS variables.** You can do this in a `<style>` tag in your `<head>` or in a custom CSS file.
+
+   ```html
+   <style>
+     :root {
+       --bs-body-font-family: "Geist", system-ui, sans-serif;
+       --bs-font-mono: "Geist Mono", ui-monospace, monospace;
+     }
+   </style>
+   ```
+
+   You can also do the same in your custom Sass file should you graduate from a CDN setup to one that includes Bootstrap via a package manager.
+
+Learn more about Bootstrap’s typography defaults in [Typography]([[docsref:/content/typography]]) and [Reboot]([[docsref:/content/reboot#native-font-stack]]).
index c643c73ce19dad72569a4baac33841015ab3daac..0629bf26a6368224638d2e010b43f39cdf5717a7 100644 (file)
@@ -58,6 +58,7 @@ export async function highlightCode(
       light: { ...(bootstrapLight as any), name: '' },
       dark: { ...(bootstrapDark as any), name: '' }
     },
+    defaultColor: 'light-dark()',
     transformers
   })
 
index 009dd25d671f536c904a8ec2f62c073fc58ebdf0..e6df8dbb23c9d68deb62218d4cecc4e8c0ea6173 100644 (file)
@@ -2,21 +2,13 @@
 
 // stylelint-disable selector-max-id, declaration-no-important
 
-//
-// Carbon ads
-//
-
 @layer custom {
   #carbon-responsive .carbon-responsive-wrap {
     padding: 1rem !important;
     background-color: var(--bs-bg-1) !important;
     border: 0 !important;
-    @include border-radius(var(--radius-7) !important);
+    @include border-radius(var(--radius-8) !important);
   }
-  // #carbon-responsive a,
-  // .carbon-description {
-  //   color: var(--bs-fg-1) !important;
-  // }
   .carbon-img {
     position: relative;
     overflow: hidden;
index 6dd8627475bad2fc9cadb23140a19534b10fef75..a38dafd71fe8f4f66dee6ae603fb636e96cc5d92 100644 (file)
@@ -3,7 +3,7 @@
 
 @layer custom {
   :root {
-    --bd-navbar-offset: 6rem;
+    --bd-navbar-offset: 5.75rem;
   }
 
   body {
index ed9c61fafecf9ff825c3fe40f08999bf726457e1..4652f81e1e0bf1a643b5beba2948bc1e1c5171d8 100644 (file)
@@ -38,7 +38,7 @@
     }
 
     .nav-link {
-      margin-inline-start: 1rem;
+      margin-inline-start: .75rem;
     }
 
     @include media-breakpoint-between(xs, lg) {
@@ -65,7 +65,7 @@
   }
 
   .bd-links-subgroup {
-    margin-inline-start: 1.75rem;
+    margin-inline-start: 1.5rem;
     color: var(--bs-fg-body);
   }
 
index 4900b5449e342fb2b9c2a7ecb23ff637b3fdb5f7..f4091550b571ec4c0f77666b25be5906774b9343 100644 (file)
   background-color: color-mix(in oklch, var(--primary-bg) 10%, transparent);
 }
 
-// Dark mode theming for Shiki
-// When using dual themes, Shiki generates inline styles with CSS variables
-// We need to switch from the light theme vars to dark theme vars
 [data-bs-theme="dark"] {
   --shell-prompt-color: #868e96;
-
-  .astro-code span,
-  .astro-code-themes span {
-    // Override Shiki's inline color with the dark theme color
-    color: var(--shiki-dark) !important; // stylelint-disable-line declaration-no-important
-  }
 }
 
 // Shell prompts - these work with Shiki's transformer that adds .line class
index cbedd7d8e3711fa4503a340fbe84b05c20549bbe..ed862c4dedb2f3028e54d8c50f15a9e6e23befe1 100644 (file)
     return 'auto'
   }
 
-  const setTheme = theme => {
+  const resolveTheme = theme => {
     if (theme === 'auto') {
-      document.documentElement.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'))
-    } else {
-      document.documentElement.setAttribute('data-bs-theme', theme)
+      return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
+    }
+
+    return theme
+  }
+
+  const setTheme = theme => {
+    const resolved = resolveTheme(theme)
+
+    if (document.documentElement.getAttribute('data-bs-theme') !== resolved) {
+      document.documentElement.setAttribute('data-bs-theme', resolved)
     }
   }
 
         toggle.addEventListener('click', () => {
           const theme = toggle.getAttribute('data-bs-theme-value')
           setStoredTheme(theme)
-          setTheme(theme)
-          showActiveTheme(theme, true)
+
+          requestAnimationFrame(() => {
+            setTheme(theme)
+            showActiveTheme(theme)
+          })
         })
       })
   })