diff --git a/404.html b/404.html index 08dc9888cd..193517cc4c 100644 --- a/404.html +++ b/404.html @@ -1,373 +1,21 @@ - - - - - - - - - - - - - - - - -404 - File not found · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- Skip to main content - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
-

404

-

File not found

-
- -
- - - - - - - - - - - - - + 404 - File not found · Bootstrap v5.3
Skip to main content

404

File not found

\ No newline at end of file diff --git a/about/index.html b/about/index.html index a7ad387b21..20b605dea1 100644 --- a/about/index.html +++ b/about/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/about/overview/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/components/index.html b/components/index.html index c965ddaba7..6b199d7367 100644 --- a/components/index.html +++ b/components/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/components/accordion/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/about/brand/index.html b/docs/5.3/about/brand/index.html index 9f80b07512..2fb08759cc 100644 --- a/docs/5.3/about/brand/index.html +++ b/docs/5.3/about/brand/index.html @@ -1,661 +1,36 @@ - - - - - - - - - - - - - - - - -Brand guidelines · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- Skip to main content - Skip to docs navigation -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-
-
- -

Brand guidelines

-
-

Documentation and examples for Bootstrap’s logo and brand usage guidelines.

- - -
- - -
- - On this page -
-
- -
-
- - -
- - -

Have a need for Bootstrap’s brand resources? Great! We have only a few guidelines we follow, and in turn ask you to follow as well.

- -

When referencing Bootstrap, use our logo mark. Do not modify our logos in any way. Do not use Bootstrap’s branding for your own open or closed source projects.

-
- Bootstrap -
+ Brand guidelines · Bootstrap v5.3

Brand guidelines

Documentation and examples for Bootstrap’s logo and brand usage guidelines.

+
On this page

Have a need for Bootstrap’s brand resources? Great! We have only a few guidelines we follow, and in turn ask you to follow as well.

+ +

When referencing Bootstrap, use our logo mark. Do not modify our logos in any way. Do not use Bootstrap’s branding for your own open or closed source projects.

+
Bootstrap

Our logo mark is also available in black and white. All rules for our primary logo apply to these as well.

-
-
- Bootstrap -
-
- Bootstrap -
-
-

Name

+
Bootstrap
Bootstrap
+

Name

Bootstrap should always be referred to as just Bootstrap. No capital s.

-
-
-
Bootstrap
- Correct -
-
-
BootStrap
- Incorrect -
-
- -
-
-
- - - - - - - - - - - - - - - +
Bootstrap
Correct
BootStrap
Incorrect
\ No newline at end of file diff --git a/docs/5.3/about/index.html b/docs/5.3/about/index.html index a7ad387b21..20b605dea1 100644 --- a/docs/5.3/about/index.html +++ b/docs/5.3/about/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/about/overview/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/about/license/index.html b/docs/5.3/about/license/index.html index f9e526bcae..3fcb4d29ed 100644 --- a/docs/5.3/about/license/index.html +++ b/docs/5.3/about/license/index.html @@ -1,556 +1,37 @@ - - - - - - - - - - - - - - - - -License FAQs · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- Skip to main content - Skip to docs navigation -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-
-
- -

License FAQs

-
-

Commonly asked questions about Bootstrap’s open source license.

- - -
- - - -
- - -

Bootstrap is released under the MIT license and is copyright 2025. Boiled down to smaller chunks, it can be described with the following conditions.

-

It requires you to:

+ License FAQs · Bootstrap v5.3

License FAQs

Commonly asked questions about Bootstrap’s open source license.

+

Bootstrap is released under the MIT license and is copyright 2025. Boiled down to smaller chunks, it can be described with the following conditions.

+

It requires you to:

    -
  • Keep the license and copyright notice included in Bootstrap’s CSS and JavaScript files when you use them in your works
  • +
  • Keep the license and copyright notice included in Bootstrap’s CSS and JavaScript files when you use them in your works
-

It permits you to:

+

It permits you to:

  • Freely download and use Bootstrap, in whole or in part, for personal, private, company internal, or commercial purposes
  • Use Bootstrap in packages or distributions that you create
  • Modify the source code
  • Grant a sublicense to modify and distribute Bootstrap to third parties not included in the license
-

It forbids you to:

+

It forbids you to:

  • Hold the authors and license owners liable for damages as Bootstrap is provided without warranty
  • Hold the creators or copyright holders of Bootstrap liable
  • @@ -558,86 +39,13 @@
  • Use any marks owned by Bootstrap in any way that might state or imply that Bootstrap endorses your distribution
  • Use any marks owned by Bootstrap in any way that might state or imply that you created the Bootstrap software in question
-

It does not require you to:

+

It does not require you to:

  • Include the source of Bootstrap itself, or of any modifications you may have made to it, in any redistribution you may assemble that includes it
  • Submit changes that you make to Bootstrap back to the Bootstrap project (though such feedback is encouraged)
-

The full Bootstrap license is located in the project repository for more information.

- -
-
-
- - - - - - - - - - - - - - - +

The full Bootstrap license is located in the project repository for more information.

\ No newline at end of file diff --git a/docs/5.3/about/overview/index.html b/docs/5.3/about/overview/index.html index 71d919afb7..d7c548a758 100644 --- a/docs/5.3/about/overview/index.html +++ b/docs/5.3/about/overview/index.html @@ -1,627 +1,35 @@ - - - - - - - - - - - - - - - - -About Bootstrap · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- Skip to main content - Skip to docs navigation -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-
-
- -

About Bootstrap

-
-

Learn more about the team maintaining Bootstrap, how and why the project started, and how to get involved.

- - -
- - - -
- - -

Team

-

Bootstrap is maintained by a small team of developers on GitHub. We’re actively looking to grow this team and would love to hear from you if you’re excited about CSS at scale, writing and maintaining vanilla JavaScript plugins, and improving build tooling processes for frontend code.

-

History

+ About Bootstrap · Bootstrap v5.3

About Bootstrap

Learn more about the team maintaining Bootstrap, how and why the project started, and how to get involved.

+

Team

+

Bootstrap is maintained by a small team of developers on GitHub. We’re actively looking to grow this team and would love to hear from you if you’re excited about CSS at scale, writing and maintaining vanilla JavaScript plugins, and improving build tooling processes for frontend code.

+

History

Originally created by a designer and a developer at Twitter, Bootstrap has become one of the most popular front-end frameworks and open source projects in the world.

Bootstrap was created at Twitter in mid-2010 by @mdo and @fat. Prior to being an open-sourced framework, Bootstrap was known as Twitter Blueprint. A few months into development, Twitter held its first Hack Week and the project exploded as developers of all skill levels jumped in without any external guidance. It served as the style guide for internal tools development at the company for over a year before its public release, and continues to do so today.

-

Originally released on , we’ve since had over twenty releases, including two major rewrites with v2 and v3. With Bootstrap 2, we added responsive functionality to the entire framework as an optional stylesheet. Building on that with Bootstrap 3, we rewrote the library once more to make it responsive by default with a mobile first approach.

-

With Bootstrap 4, we once again rewrote the project to account for two key architectural changes: a migration to Sass and the move to CSS’s flexbox. Our intention is to help in a small way to move the web development community forward by pushing for newer CSS properties, fewer dependencies, and new technologies across more modern browsers.

-

Our latest release, Bootstrap 5, focuses on improving v4’s codebase with as few major breaking changes as possible. We improved existing features and components, removed support for older browsers, dropped jQuery for regular JavaScript, and embraced more future-friendly technologies like CSS custom properties as part of our tooling.

-

Get involved

-

Get involved with Bootstrap development by opening an issue or submitting a pull request. Read our contributing guidelines for information on how we develop.

- -
-
-
- - - - - - - - - - - - - - - +

Originally released on , we’ve since had over twenty releases, including two major rewrites with v2 and v3. With Bootstrap 2, we added responsive functionality to the entire framework as an optional stylesheet. Building on that with Bootstrap 3, we rewrote the library once more to make it responsive by default with a mobile first approach.

+

With Bootstrap 4, we once again rewrote the project to account for two key architectural changes: a migration to Sass and the move to CSS’s flexbox. Our intention is to help in a small way to move the web development community forward by pushing for newer CSS properties, fewer dependencies, and new technologies across more modern browsers.

+

Our latest release, Bootstrap 5, focuses on improving v4’s codebase with as few major breaking changes as possible. We improved existing features and components, removed support for older browsers, dropped jQuery for regular JavaScript, and embraced more future-friendly technologies like CSS custom properties as part of our tooling.

+

Get involved

+

Get involved with Bootstrap development by opening an issue or submitting a pull request. Read our contributing guidelines for information on how we develop.

\ No newline at end of file diff --git a/docs/5.3/about/team/index.html b/docs/5.3/about/team/index.html index c2f71d90f2..7d1b33918b 100644 --- a/docs/5.3/about/team/index.html +++ b/docs/5.3/about/team/index.html @@ -1,706 +1,28 @@ - - - - - - - - - - - - - - - - -Team · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- Skip to main content - Skip to docs navigation -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-
- -

An overview of the founding team and core contributors to Bootstrap.

- - -
- - - -
- - -

Bootstrap is maintained by the founding team and a small group of invaluable core contributors, with the massive support and involvement of our community.

- - - -

Get involved with Bootstrap development by opening an issue or submitting a pull request. Read our contributing guidelines for information on how we develop.

- -
-
-
- - - - - - - - - - - - - - - + Team · Bootstrap v5.3
Skip to main content +Skip to docs navigation +

An overview of the founding team and core contributors to Bootstrap.

+

Bootstrap is maintained by the founding team and a small group of invaluable core contributors, with the massive support and involvement of our community.

+ +

Get involved with Bootstrap development by opening an issue or submitting a pull request. Read our contributing guidelines for information on how we develop.

\ No newline at end of file diff --git a/docs/5.3/about/translations/index.html b/docs/5.3/about/translations/index.html index 9f737d477f..30cec443b3 100644 --- a/docs/5.3/about/translations/index.html +++ b/docs/5.3/about/translations/index.html @@ -1,633 +1,29 @@ - - - - - - - - - - - - - - - - -Translations · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- Skip to main content - Skip to docs navigation -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-
-
- -

Translations

-
-

Links to community-translated Bootstrap documentation sites.

- - -
- - - -
- - -

Community members have translated Bootstrap’s documentation into various languages. None are officially supported and they may not always be up-to-date.

- - - -

We don’t help organize or host translations, we just link to them.

-

Finished a new or better translation? Open a pull request to add it to our list.

- -
-
-
- - - - - - - - - - - - - - - + Translations · Bootstrap v5.3
Skip to main content +Skip to docs navigation +

Translations

Links to community-translated Bootstrap documentation sites.

+

Community members have translated Bootstrap’s documentation into various languages. None are officially supported and they may not always be up-to-date.

+ +

We don’t help organize or host translations, we just link to them.

+

Finished a new or better translation? Open a pull request to add it to our list.

\ No newline at end of file diff --git a/docs/5.3/assets/Code.astro_astro_type_script_index_0_lang.5BTJN8ix.js b/docs/5.3/assets/Code.astro_astro_type_script_index_0_lang.5BTJN8ix.js new file mode 100644 index 0000000000..4792a925fb --- /dev/null +++ b/docs/5.3/assets/Code.astro_astro_type_script_index_0_lang.5BTJN8ix.js @@ -0,0 +1,6 @@ +function Q(y){return y&&y.__esModule&&Object.prototype.hasOwnProperty.call(y,"default")?y.default:y}var k={exports:{}};/*! + * clipboard.js v2.0.11 + * https://clipboardjs.com/ + * + * Licensed MIT © Zeno Rocha + */var W=k.exports,I;function Z(){return I||(I=1,function(y,T){(function(E,b){y.exports=b()})(W,function(){return function(){var C={686:function(f,a,t){t.d(a,{default:function(){return G}});var c=t(279),s=t.n(c),l=t(370),g=t.n(l),h=t(817),m=t.n(h);function p(i){try{return document.execCommand(i)}catch{return!1}}var v=function(n){var e=m()(n);return p("cut"),e},d=v;function _(i){var n=document.documentElement.getAttribute("dir")==="rtl",e=document.createElement("textarea");e.style.fontSize="12pt",e.style.border="0",e.style.padding="0",e.style.margin="0",e.style.position="absolute",e.style[n?"right":"left"]="-9999px";var r=window.pageYOffset||document.documentElement.scrollTop;return e.style.top="".concat(r,"px"),e.setAttribute("readonly",""),e.value=i,e}var M=function(n,e){var r=_(n);e.container.appendChild(r);var o=m()(r);return p("copy"),r.remove(),o},q=function(n){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},r="";return typeof n=="string"?r=M(n,e):n instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(n?.type)?r=M(n.value,e):(r=m()(n),p("copy")),r},L=q;function x(i){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?x=function(e){return typeof e}:x=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x(i)}var H=function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=n.action,r=e===void 0?"copy":e,o=n.container,u=n.target,S=n.text;if(r!=="copy"&&r!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(u!==void 0)if(u&&x(u)==="object"&&u.nodeType===1){if(r==="copy"&&u.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(r==="cut"&&(u.hasAttribute("readonly")||u.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(S)return L(S,{container:o});if(u)return r==="cut"?d(u):L(u,{container:o})},z=H;function w(i){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?w=function(e){return typeof e}:w=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w(i)}function B(i,n){if(!(i instanceof n))throw new TypeError("Cannot call a class as a function")}function j(i,n){for(var e=0;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function A(i){return A=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},A(i)}function P(i,n){var e="data-clipboard-".concat(i);if(n.hasAttribute(e))return n.getAttribute(e)}var J=function(i){U(e,i);var n=V(e);function e(r,o){var u;return B(this,e),u=n.call(this),u.resolveOptions(o),u.listenClick(r),u}return $(e,[{key:"resolveOptions",value:function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof o.action=="function"?o.action:this.defaultAction,this.target=typeof o.target=="function"?o.target:this.defaultTarget,this.text=typeof o.text=="function"?o.text:this.defaultText,this.container=w(o.container)==="object"?o.container:document.body}},{key:"listenClick",value:function(o){var u=this;this.listener=g()(o,"click",function(S){return u.onClick(S)})}},{key:"onClick",value:function(o){var u=o.delegateTarget||o.currentTarget,S=this.action(u)||"copy",O=z({action:S,container:this.container,target:this.target(u),text:this.text(u)});this.emit(O?"success":"error",{action:S,text:O,trigger:u,clearSelection:function(){u&&u.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(o){return P("action",o)}},{key:"defaultTarget",value:function(o){var u=P("target",o);if(u)return document.querySelector(u)}},{key:"defaultText",value:function(o){return P("text",o)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(o){var u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return L(o,u)}},{key:"cut",value:function(o){return d(o)}},{key:"isSupported",value:function(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],u=typeof o=="string"?[o]:o,S=!!document.queryCommandSupported;return u.forEach(function(O){S=S&&!!document.queryCommandSupported(O)}),S}}]),e}(s()),G=J},828:function(f){var a=9;if(typeof Element<"u"&&!Element.prototype.matches){var t=Element.prototype;t.matches=t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector}function c(s,l){for(;s&&s.nodeType!==a;){if(typeof s.matches=="function"&&s.matches(l))return s;s=s.parentNode}}f.exports=c},438:function(f,a,t){var c=t(828);function s(h,m,p,v,d){var _=g.apply(this,arguments);return h.addEventListener(p,_,d),{destroy:function(){h.removeEventListener(p,_,d)}}}function l(h,m,p,v,d){return typeof h.addEventListener=="function"?s.apply(null,arguments):typeof p=="function"?s.bind(null,document).apply(null,arguments):(typeof h=="string"&&(h=document.querySelectorAll(h)),Array.prototype.map.call(h,function(_){return s(_,m,p,v,d)}))}function g(h,m,p,v){return function(d){d.delegateTarget=c(d.target,m),d.delegateTarget&&v.call(h,d)}}f.exports=l},879:function(f,a){a.node=function(t){return t!==void 0&&t instanceof HTMLElement&&t.nodeType===1},a.nodeList=function(t){var c=Object.prototype.toString.call(t);return t!==void 0&&(c==="[object NodeList]"||c==="[object HTMLCollection]")&&"length"in t&&(t.length===0||a.node(t[0]))},a.string=function(t){return typeof t=="string"||t instanceof String},a.fn=function(t){var c=Object.prototype.toString.call(t);return c==="[object Function]"}},370:function(f,a,t){var c=t(879),s=t(438);function l(p,v,d){if(!p&&!v&&!d)throw new Error("Missing required arguments");if(!c.string(v))throw new TypeError("Second argument must be a String");if(!c.fn(d))throw new TypeError("Third argument must be a Function");if(c.node(p))return g(p,v,d);if(c.nodeList(p))return h(p,v,d);if(c.string(p))return m(p,v,d);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function g(p,v,d){return p.addEventListener(v,d),{destroy:function(){p.removeEventListener(v,d)}}}function h(p,v,d){return Array.prototype.forEach.call(p,function(_){_.addEventListener(v,d)}),{destroy:function(){Array.prototype.forEach.call(p,function(_){_.removeEventListener(v,d)})}}}function m(p,v,d){return s(document.body,p,v,d)}f.exports=l},817:function(f){function a(t){var c;if(t.nodeName==="SELECT")t.focus(),c=t.value;else if(t.nodeName==="INPUT"||t.nodeName==="TEXTAREA"){var s=t.hasAttribute("readonly");s||t.setAttribute("readonly",""),t.select(),t.setSelectionRange(0,t.value.length),s||t.removeAttribute("readonly"),c=t.value}else{t.hasAttribute("contenteditable")&&t.focus();var l=window.getSelection(),g=document.createRange();g.selectNodeContents(t),l.removeAllRanges(),l.addRange(g),c=l.toString()}return c}f.exports=a},279:function(f){function a(){}a.prototype={on:function(t,c,s){var l=this.e||(this.e={});return(l[t]||(l[t]=[])).push({fn:c,ctx:s}),this},once:function(t,c,s){var l=this;function g(){l.off(t,g),c.apply(s,arguments)}return g._=c,this.on(t,g,s)},emit:function(t){var c=[].slice.call(arguments,1),s=((this.e||(this.e={}))[t]||[]).slice(),l=0,g=s.length;for(l;l{bootstrap.Tooltip.getOrCreateInstance(C,{title:T})})}D(".btn-clipboard",R);D(".btn-edit",nt);const F=new et(".btn-clipboard",{target:y=>y.closest(".bd-code-snippet")?.querySelector(".highlight"),text:y=>y.closest(".bd-code-snippet")?.querySelector(".highlight").textContent?.trim()});F.on("success",y=>{const T=y.trigger.querySelector(".bi")?.firstElementChild,C=bootstrap.Tooltip.getInstance(y.trigger),E="http://www.w3.org/1999/xlink",b=T?.getAttributeNS(E,"href");b!=="#check2"&&(C?.setContent({".tooltip-inner":"Copied!"}),y.trigger.addEventListener("hidden.bs.tooltip",()=>{C?.setContent({".tooltip-inner":R})},{once:!0}),y.clearSelection(),b&&T?.setAttributeNS(E,"href",b.replace("clipboard","check2")),setTimeout(()=>{b&&T?.setAttributeNS(E,"href",b)},2e3))});F.on("error",y=>{const C=`Press ${/mac/i.test(navigator.userAgent)?"⌘":"Ctrl-"}C to copy`,E=bootstrap.Tooltip.getInstance(y.trigger);E?.setContent({".tooltip-inner":C}),y.trigger.addEventListener("hidden.bs.tooltip",()=>{E?.setContent({".tooltip-inner":R})},{once:!0})}); diff --git a/docs/5.3/assets/Scripts.astro_astro_type_script_index_0_lang.BeKqXKw6.js b/docs/5.3/assets/Scripts.astro_astro_type_script_index_0_lang.BeKqXKw6.js new file mode 100644 index 0000000000..391154481c --- /dev/null +++ b/docs/5.3/assets/Scripts.astro_astro_type_script_index_0_lang.BeKqXKw6.js @@ -0,0 +1,196 @@ +const C="https://stackblitz.com",_=["angular-cli","create-react-app","html","javascript","node","polymer","typescript","vue"],x=["project","search","ports","settings"],L=["light","dark"],N=["editor","preview"],S={clickToLoad:e=>d("ctl",e),devToolsHeight:e=>T("devtoolsheight",e),forceEmbedLayout:e=>d("embed",e),hideDevTools:e=>d("hidedevtools",e),hideExplorer:e=>d("hideExplorer",e),hideNavigation:e=>d("hideNavigation",e),openFile:e=>u("file",e),showSidebar:e=>B("showSidebar",e),sidebarView:e=>f("sidebarView",e,x),startScript:e=>u("startScript",e),terminalHeight:e=>T("terminalHeight",e),theme:e=>f("theme",e,L),view:e=>f("view",e,N),zenMode:e=>d("zenMode",e),organization:e=>`${u("orgName",e?.name)}&${u("orgProvider",e?.provider)}`,crossOriginIsolated:e=>d("corp",e)};function I(e={}){const t=Object.entries(e).map(([n,o])=>o!=null&&S.hasOwnProperty(n)?S[n](o):"").filter(Boolean);return t.length?`?${t.join("&")}`:""}function d(e,t){return t===!0?`${e}=1`:""}function B(e,t){return typeof t=="boolean"?`${e}=${t?"1":"0"}`:""}function T(e,t){if(typeof t=="number"&&!Number.isNaN(t)){const n=Math.min(100,Math.max(0,t));return`${e}=${encodeURIComponent(Math.round(n))}`}return""}function f(e,t="",n=[]){return n.includes(t)?`${e}=${encodeURIComponent(t)}`:""}function u(e,t){return(Array.isArray(t)?t:[t]).filter(o=>typeof o=="string"&&o.trim()!=="").map(o=>`${e}=${encodeURIComponent(o)}`).join("&")}function j(){return Math.random().toString(36).slice(2,6)+Math.random().toString(36).slice(2,6)}function y(e,t){return`${P(t)}${e}${I(t)}`}function b(e,t){const n={forceEmbedLayout:!0};return t&&typeof t=="object"&&Object.assign(n,t),`${P(n)}${e}${I(n)}`}function P(e={}){return(typeof e.origin=="string"?e.origin:C).replace(/\/$/,"")}function E(e,t,n){if(!t||!e||!e.parentNode)throw new Error("Invalid Element");e.id&&(t.id=e.id),e.className&&(t.className=e.className),O(t,n),k(e,t,n),e.replaceWith(t)}function v(e){if(typeof e=="string"){const t=document.getElementById(e);if(!t)throw new Error(`Could not find element with id '${e}'`);return t}else if(e instanceof HTMLElement)return e;throw new Error(`Invalid element: ${e}`)}function w(e){return e&&e.newWindow===!1?"_self":"_blank"}function O(e,t={}){const n=Object.hasOwnProperty.call(t,"height")?`${t.height}`:"300",o=Object.hasOwnProperty.call(t,"width")?`${t.width}`:void 0;e.setAttribute("height",n),o?e.setAttribute("width",o):e.setAttribute("style","width:100%;")}function k(e,t,n={}){const o=e.allow?.split(";")?.map(s=>s.trim())??[];n.crossOriginIsolated&&!o.includes("cross-origin-isolated")&&o.push("cross-origin-isolated"),o.length>0&&(t.allow=o.join("; "))}class M{constructor(t){this.pending={},this.port=t,this.port.onmessage=this.messageListener.bind(this)}request({type:t,payload:n}){return new Promise((o,s)=>{const r=j();this.pending[r]={resolve:o,reject:s},this.port.postMessage({type:t,payload:{...n,__reqid:r}})})}messageListener(t){if(typeof t.data.payload?.__reqid!="string")return;const{type:n,payload:o}=t.data,{__reqid:s,__success:r,__error:i}=o;this.pending[s]&&(r?this.pending[s].resolve(this.cleanResult(o)):this.pending[s].reject(i?`${n}: ${i}`:n),delete this.pending[s])}cleanResult(t){const n={...t};return delete n.__reqid,delete n.__success,delete n.__error,Object.keys(n).length?n:null}}class D{constructor(t,n){this.editor={openFile:o=>this._rdc.request({type:"SDK_OPEN_FILE",payload:{path:o}}),setCurrentFile:o=>this._rdc.request({type:"SDK_SET_CURRENT_FILE",payload:{path:o}}),setTheme:o=>this._rdc.request({type:"SDK_SET_UI_THEME",payload:{theme:o}}),setView:o=>this._rdc.request({type:"SDK_SET_UI_VIEW",payload:{view:o}}),showSidebar:(o=!0)=>this._rdc.request({type:"SDK_TOGGLE_SIDEBAR",payload:{visible:o}})},this.preview={origin:"",getUrl:()=>this._rdc.request({type:"SDK_GET_PREVIEW_URL",payload:{}}).then(o=>o?.url??null),setUrl:(o="/")=>{if(typeof o!="string"||!o.startsWith("/"))throw new Error(`Invalid argument: expected a path starting with '/', got '${o}'`);return this._rdc.request({type:"SDK_SET_PREVIEW_URL",payload:{path:o}})}},this._rdc=new M(t),Object.defineProperty(this.preview,"origin",{value:typeof n.previewOrigin=="string"?n.previewOrigin:null,writable:!1})}applyFsDiff(t){const n=o=>o!==null&&typeof o=="object";if(!n(t)||!n(t.create))throw new Error("Invalid diff object: expected diff.create to be an object.");if(!Array.isArray(t.destroy))throw new Error("Invalid diff object: expected diff.destroy to be an array.");return this._rdc.request({type:"SDK_APPLY_FS_DIFF",payload:t})}getDependencies(){return this._rdc.request({type:"SDK_GET_DEPS_SNAPSHOT",payload:{}})}getFsSnapshot(){return this._rdc.request({type:"SDK_GET_FS_SNAPSHOT",payload:{}})}}const m=[];class q{constructor(t){this.id=j(),this.element=t,this.pending=new Promise((n,o)=>{const s=({data:a,ports:c})=>{a?.action==="SDK_INIT_SUCCESS"&&a.id===this.id&&(this.vm=new D(c[0],a.payload),n(this.vm),i())},r=()=>{this.element.contentWindow?.postMessage({action:"SDK_INIT",id:this.id},"*")};function i(){window.clearInterval(p),window.removeEventListener("message",s)}window.addEventListener("message",s),r();let l=0;const p=window.setInterval(()=>{if(this.vm){i();return}if(l>=20){i(),o("Timeout: Unable to establish a connection with the StackBlitz VM"),m.forEach((a,c)=>{a.id===this.id&&m.splice(c,1)});return}l++,r()},500)}),m.push(this)}}const F=e=>{const t=e instanceof Element?"element":"id";return m.find(n=>n[t]===e)??null};function U(e,t){const n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n}function R(e){return e.replace(/\[/g,"%5B").replace(/\]/g,"%5D")}function $({template:e,title:t,description:n,dependencies:o,files:s,settings:r}){if(!_.includes(e)){const a=_.map(c=>`'${c}'`).join(", ");console.warn(`Unsupported project.template: must be one of ${a}`)}const i=[],l=(a,c,A="")=>{i.push(U(a,typeof c=="string"?c:A))};l("project[title]",t),typeof n=="string"&&n.length>0&&l("project[description]",n),l("project[template]",e,"javascript"),o&&(e==="node"?console.warn("Invalid project.dependencies: dependencies must be provided as a 'package.json' file when using the 'node' template."):l("project[dependencies]",JSON.stringify(o))),r&&l("project[settings]",JSON.stringify(r)),Object.entries(s).forEach(([a,c])=>{l(`project[files][${R(a)}]`,c)});const p=document.createElement("form");return p.method="POST",p.setAttribute("style","display:none!important;"),p.append(...i),p}function H(e,t){const n=$(e);return n.action=b("/run",t),n.id="sb_run",` + + + + ${n.outerHTML} + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-
-
- -

Accordion

-
-

Build vertically collapsing accordions in combination with our Collapse JavaScript plugin.

- - -
- - -
- - On this page -
- -
- - -
- - -

How it works

-

The accordion uses collapse internally to make it collapsible.

-
-The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation. -
- -

Example

+ Accordion · Bootstrap v5.3

Build vertically collapsing accordions in combination with our Collapse JavaScript plugin.

+

How it works

+

The accordion uses collapse internally to make it collapsible.

+

The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation.

+

Example

Click the accordions below to expand/collapse the accordion content.

-

To render an accordion that’s expanded by default:

+

To render an accordion that’s expanded by default:

  • add the .show class on the .accordion-collapse element.
  • drop the .collapsed class from the .accordion-button element and set its aria-expanded attribute to true.
-
-
- -
+

- This is the first item's accordion body. It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow. + This is the first item’s accordion body. It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It’s also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.
@@ -604,7 +52,7 @@ The animation effect of this component is dependent on the prefers-reduced
- This is the second item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow. + This is the second item’s accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It’s also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.
@@ -616,68 +64,51 @@ The animation effect of this component is dependent on the prefers-reduced
- This is the third item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow. + This is the third item’s accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It’s also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.
-
- -
- html -
- - -
-
<div class="accordion" id="accordionExample">
-  <div class="accordion-item">
-    <h2 class="accordion-header">
-      <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
-        Accordion Item #1
-      </button>
-    </h2>
-    <div id="collapseOne" class="accordion-collapse collapse show" data-bs-parent="#accordionExample">
-      <div class="accordion-body">
-        <strong>This is the first item's accordion body.</strong> It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
-      </div>
-    </div>
-  </div>
-  <div class="accordion-item">
-    <h2 class="accordion-header">
-      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
-        Accordion Item #2
-      </button>
-    </h2>
-    <div id="collapseTwo" class="accordion-collapse collapse" data-bs-parent="#accordionExample">
-      <div class="accordion-body">
-        <strong>This is the second item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
-      </div>
-    </div>
-  </div>
-  <div class="accordion-item">
-    <h2 class="accordion-header">
-      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
-        Accordion Item #3
-      </button>
-    </h2>
-    <div id="collapseThree" class="accordion-collapse collapse" data-bs-parent="#accordionExample">
-      <div class="accordion-body">
-        <strong>This is the third item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
-      </div>
-    </div>
-  </div>
-</div>
-
- -

Flush

+
html
<div class="accordion" id="accordionExample">
+  <div class="accordion-item">
+    <h2 class="accordion-header">
+      <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
+        Accordion Item #1
+      </button>
+    </h2>
+    <div id="collapseOne" class="accordion-collapse collapse show" data-bs-parent="#accordionExample">
+      <div class="accordion-body">
+        <strong>This is the first item’s accordion body.</strong> It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It’s also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
+      </div>
+    </div>
+  </div>
+  <div class="accordion-item">
+    <h2 class="accordion-header">
+      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
+        Accordion Item #2
+      </button>
+    </h2>
+    <div id="collapseTwo" class="accordion-collapse collapse" data-bs-parent="#accordionExample">
+      <div class="accordion-body">
+        <strong>This is the second item’s accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It’s also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
+      </div>
+    </div>
+  </div>
+  <div class="accordion-item">
+    <h2 class="accordion-header">
+      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
+        Accordion Item #3
+      </button>
+    </h2>
+    <div id="collapseThree" class="accordion-collapse collapse" data-bs-parent="#accordionExample">
+      <div class="accordion-body">
+        <strong>This is the third item’s accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It’s also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
+      </div>
+    </div>
+  </div>
+</div>
+

Flush

Add .accordion-flush to remove some borders and rounded corners to render accordions edge-to-edge with their parent container.

-
-
- -
+

-
Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item's accordion body.
+
Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the first item’s accordion body.
@@ -695,7 +126,7 @@ The animation effect of this component is dependent on the prefers-reduced
-
Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item's accordion body. Let's imagine this being filled with some actual content.
+
Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the second item’s accordion body. Let’s imagine this being filled with some actual content.
@@ -705,61 +136,44 @@ The animation effect of this component is dependent on the prefers-reduced
-
Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.
+
Placeholder content for this accordion, which is intended to demonstrate the .accordion-flush class. This is the third item’s accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.
-
- -
- html -
- - -
-
<div class="accordion accordion-flush" id="accordionFlushExample">
-  <div class="accordion-item">
-    <h2 class="accordion-header">
-      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseOne" aria-expanded="false" aria-controls="flush-collapseOne">
-        Accordion Item #1
-      </button>
-    </h2>
-    <div id="flush-collapseOne" class="accordion-collapse collapse" data-bs-parent="#accordionFlushExample">
-      <div class="accordion-body">Placeholder content for this accordion, which is intended to demonstrate the <code>.accordion-flush</code> class. This is the first item's accordion body.</div>
-    </div>
-  </div>
-  <div class="accordion-item">
-    <h2 class="accordion-header">
-      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseTwo" aria-expanded="false" aria-controls="flush-collapseTwo">
-        Accordion Item #2
-      </button>
-    </h2>
-    <div id="flush-collapseTwo" class="accordion-collapse collapse" data-bs-parent="#accordionFlushExample">
-      <div class="accordion-body">Placeholder content for this accordion, which is intended to demonstrate the <code>.accordion-flush</code> class. This is the second item's accordion body. Let's imagine this being filled with some actual content.</div>
-    </div>
-  </div>
-  <div class="accordion-item">
-    <h2 class="accordion-header">
-      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseThree" aria-expanded="false" aria-controls="flush-collapseThree">
-        Accordion Item #3
-      </button>
-    </h2>
-    <div id="flush-collapseThree" class="accordion-collapse collapse" data-bs-parent="#accordionFlushExample">
-      <div class="accordion-body">Placeholder content for this accordion, which is intended to demonstrate the <code>.accordion-flush</code> class. This is the third item's accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.</div>
-    </div>
-  </div>
-</div>
-
- -

Always open

+
html
<div class="accordion accordion-flush" id="accordionFlushExample">
+  <div class="accordion-item">
+    <h2 class="accordion-header">
+      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseOne" aria-expanded="false" aria-controls="flush-collapseOne">
+        Accordion Item #1
+      </button>
+    </h2>
+    <div id="flush-collapseOne" class="accordion-collapse collapse" data-bs-parent="#accordionFlushExample">
+      <div class="accordion-body">Placeholder content for this accordion, which is intended to demonstrate the <code>.accordion-flush</code> class. This is the first item’s accordion body.</div>
+    </div>
+  </div>
+  <div class="accordion-item">
+    <h2 class="accordion-header">
+      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseTwo" aria-expanded="false" aria-controls="flush-collapseTwo">
+        Accordion Item #2
+      </button>
+    </h2>
+    <div id="flush-collapseTwo" class="accordion-collapse collapse" data-bs-parent="#accordionFlushExample">
+      <div class="accordion-body">Placeholder content for this accordion, which is intended to demonstrate the <code>.accordion-flush</code> class. This is the second item’s accordion body. Let’s imagine this being filled with some actual content.</div>
+    </div>
+  </div>
+  <div class="accordion-item">
+    <h2 class="accordion-header">
+      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#flush-collapseThree" aria-expanded="false" aria-controls="flush-collapseThree">
+        Accordion Item #3
+      </button>
+    </h2>
+    <div id="flush-collapseThree" class="accordion-collapse collapse" data-bs-parent="#accordionFlushExample">
+      <div class="accordion-body">Placeholder content for this accordion, which is intended to demonstrate the <code>.accordion-flush</code> class. This is the third item’s accordion body. Nothing more exciting happening here in terms of content, but just filling up the space to make it look, at least at first glance, a bit more representative of how this would look in a real-world application.</div>
+    </div>
+  </div>
+</div>
+

Always open

Omit the data-bs-parent attribute on each .accordion-collapse to make accordion items stay open when another item is opened.

-
-
- -
+

- This is the first item's accordion body. It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow. + This is the first item’s accordion body. It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It’s also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.
@@ -780,7 +194,7 @@ The animation effect of this component is dependent on the prefers-reduced
- This is the second item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow. + This is the second item’s accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It’s also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.
@@ -792,215 +206,112 @@ The animation effect of this component is dependent on the prefers-reduced
- This is the third item's accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow. + This is the third item’s accordion body. It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It’s also worth noting that just about any HTML can go within the .accordion-body, though the transition does limit overflow.
-
- -
- html -
- - -
-
<div class="accordion" id="accordionPanelsStayOpenExample">
-  <div class="accordion-item">
-    <h2 class="accordion-header">
-      <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#panelsStayOpen-collapseOne" aria-expanded="true" aria-controls="panelsStayOpen-collapseOne">
-        Accordion Item #1
-      </button>
-    </h2>
-    <div id="panelsStayOpen-collapseOne" class="accordion-collapse collapse show">
-      <div class="accordion-body">
-        <strong>This is the first item's accordion body.</strong> It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
-      </div>
-    </div>
-  </div>
-  <div class="accordion-item">
-    <h2 class="accordion-header">
-      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#panelsStayOpen-collapseTwo" aria-expanded="false" aria-controls="panelsStayOpen-collapseTwo">
-        Accordion Item #2
-      </button>
-    </h2>
-    <div id="panelsStayOpen-collapseTwo" class="accordion-collapse collapse">
-      <div class="accordion-body">
-        <strong>This is the second item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
-      </div>
-    </div>
-  </div>
-  <div class="accordion-item">
-    <h2 class="accordion-header">
-      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#panelsStayOpen-collapseThree" aria-expanded="false" aria-controls="panelsStayOpen-collapseThree">
-        Accordion Item #3
-      </button>
-    </h2>
-    <div id="panelsStayOpen-collapseThree" class="accordion-collapse collapse">
-      <div class="accordion-body">
-        <strong>This is the third item's accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
-      </div>
-    </div>
-  </div>
-</div>
-
- -

Accessibility

-

Please read the collapse accessibility section for more information.

-

CSS

-

Variables

+
html
<div class="accordion" id="accordionPanelsStayOpenExample">
+  <div class="accordion-item">
+    <h2 class="accordion-header">
+      <button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#panelsStayOpen-collapseOne" aria-expanded="true" aria-controls="panelsStayOpen-collapseOne">
+        Accordion Item #1
+      </button>
+    </h2>
+    <div id="panelsStayOpen-collapseOne" class="accordion-collapse collapse show">
+      <div class="accordion-body">
+        <strong>This is the first item’s accordion body.</strong> It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It’s also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
+      </div>
+    </div>
+  </div>
+  <div class="accordion-item">
+    <h2 class="accordion-header">
+      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#panelsStayOpen-collapseTwo" aria-expanded="false" aria-controls="panelsStayOpen-collapseTwo">
+        Accordion Item #2
+      </button>
+    </h2>
+    <div id="panelsStayOpen-collapseTwo" class="accordion-collapse collapse">
+      <div class="accordion-body">
+        <strong>This is the second item’s accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It’s also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
+      </div>
+    </div>
+  </div>
+  <div class="accordion-item">
+    <h2 class="accordion-header">
+      <button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#panelsStayOpen-collapseThree" aria-expanded="false" aria-controls="panelsStayOpen-collapseThree">
+        Accordion Item #3
+      </button>
+    </h2>
+    <div id="panelsStayOpen-collapseThree" class="accordion-collapse collapse">
+      <div class="accordion-body">
+        <strong>This is the third item’s accordion body.</strong> It is hidden by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It’s also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
+      </div>
+    </div>
+  </div>
+</div>
+

Accessibility

+

Please read the collapse accessibility section for more information.

+

CSS

+

Variables

Added in v5.2.0 +

As part of Bootstrap’s evolving CSS variables approach, accordions now use local CSS variables on .accordion for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

+
--#{$prefix}accordion-color: #{$accordion-color};
+--#{$prefix}accordion-bg: #{$accordion-bg};
+--#{$prefix}accordion-transition: #{$accordion-transition};
+--#{$prefix}accordion-border-color: #{$accordion-border-color};
+--#{$prefix}accordion-border-width: #{$accordion-border-width};
+--#{$prefix}accordion-border-radius: #{$accordion-border-radius};
+--#{$prefix}accordion-inner-border-radius: #{$accordion-inner-border-radius};
+--#{$prefix}accordion-btn-padding-x: #{$accordion-button-padding-x};
+--#{$prefix}accordion-btn-padding-y: #{$accordion-button-padding-y};
+--#{$prefix}accordion-btn-color: #{$accordion-button-color};
+--#{$prefix}accordion-btn-bg: #{$accordion-button-bg};
+--#{$prefix}accordion-btn-icon: #{escape-svg($accordion-button-icon)};
+--#{$prefix}accordion-btn-icon-width: #{$accordion-icon-width};
+--#{$prefix}accordion-btn-icon-transform: #{$accordion-icon-transform};
+--#{$prefix}accordion-btn-icon-transition: #{$accordion-icon-transition};
+--#{$prefix}accordion-btn-active-icon: #{escape-svg($accordion-button-active-icon)};
+--#{$prefix}accordion-btn-focus-box-shadow: #{$accordion-button-focus-box-shadow};
+--#{$prefix}accordion-body-padding-x: #{$accordion-body-padding-x};
+--#{$prefix}accordion-body-padding-y: #{$accordion-body-padding-y};
+--#{$prefix}accordion-active-color: #{$accordion-button-active-color};
+--#{$prefix}accordion-active-bg: #{$accordion-button-active-bg};
+
+

Sass variables

+
$accordion-padding-y:                     1rem;
+$accordion-padding-x:                     1.25rem;
+$accordion-color:                         var(--#{$prefix}body-color);
+$accordion-bg:                            var(--#{$prefix}body-bg);
+$accordion-border-width:                  var(--#{$prefix}border-width);
+$accordion-border-color:                  var(--#{$prefix}border-color);
+$accordion-border-radius:                 var(--#{$prefix}border-radius);
+$accordion-inner-border-radius:           subtract($accordion-border-radius, $accordion-border-width);
 
-

As part of Bootstrap’s evolving CSS variables approach, accordions now use local CSS variables on .accordion for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

-
-
- scss/_accordion.scss -
- -
-
--#{$prefix}accordion-color: #{$accordion-color};
---#{$prefix}accordion-bg: #{$accordion-bg};
---#{$prefix}accordion-transition: #{$accordion-transition};
---#{$prefix}accordion-border-color: #{$accordion-border-color};
---#{$prefix}accordion-border-width: #{$accordion-border-width};
---#{$prefix}accordion-border-radius: #{$accordion-border-radius};
---#{$prefix}accordion-inner-border-radius: #{$accordion-inner-border-radius};
---#{$prefix}accordion-btn-padding-x: #{$accordion-button-padding-x};
---#{$prefix}accordion-btn-padding-y: #{$accordion-button-padding-y};
---#{$prefix}accordion-btn-color: #{$accordion-button-color};
---#{$prefix}accordion-btn-bg: #{$accordion-button-bg};
---#{$prefix}accordion-btn-icon: #{escape-svg($accordion-button-icon)};
---#{$prefix}accordion-btn-icon-width: #{$accordion-icon-width};
---#{$prefix}accordion-btn-icon-transform: #{$accordion-icon-transform};
---#{$prefix}accordion-btn-icon-transition: #{$accordion-icon-transition};
---#{$prefix}accordion-btn-active-icon: #{escape-svg($accordion-button-active-icon)};
---#{$prefix}accordion-btn-focus-box-shadow: #{$accordion-button-focus-box-shadow};
---#{$prefix}accordion-body-padding-x: #{$accordion-body-padding-x};
---#{$prefix}accordion-body-padding-y: #{$accordion-body-padding-y};
---#{$prefix}accordion-active-color: #{$accordion-button-active-color};
---#{$prefix}accordion-active-bg: #{$accordion-button-active-bg};
-

Sass variables

-
-
- scss/_variables.scss -
- -
-
$accordion-padding-y:                     1rem;
-$accordion-padding-x:                     1.25rem;
-$accordion-color:                         var(--#{$prefix}body-color);
-$accordion-bg:                            var(--#{$prefix}body-bg);
-$accordion-border-width:                  var(--#{$prefix}border-width);
-$accordion-border-color:                  var(--#{$prefix}border-color);
-$accordion-border-radius:                 var(--#{$prefix}border-radius);
-$accordion-inner-border-radius:           subtract($accordion-border-radius, $accordion-border-width);
-
-$accordion-body-padding-y:                $accordion-padding-y;
-$accordion-body-padding-x:                $accordion-padding-x;
-
-$accordion-button-padding-y:              $accordion-padding-y;
-$accordion-button-padding-x:              $accordion-padding-x;
-$accordion-button-color:                  var(--#{$prefix}body-color);
-$accordion-button-bg:                     var(--#{$prefix}accordion-bg);
-$accordion-transition:                    $btn-transition, border-radius .15s ease;
-$accordion-button-active-bg:              var(--#{$prefix}primary-bg-subtle);
-$accordion-button-active-color:           var(--#{$prefix}primary-text-emphasis);
-
-// fusv-disable
-$accordion-button-focus-border-color:     $input-focus-border-color; // Deprecated in v5.3.3
-// fusv-enable
-$accordion-button-focus-box-shadow:       $btn-focus-box-shadow;
-
-$accordion-icon-width:                    1.25rem;
-$accordion-icon-color:                    $body-color;
-$accordion-icon-active-color:             $primary-text-emphasis;
-$accordion-icon-transition:               transform .2s ease-in-out;
-$accordion-icon-transform:                rotate(-180deg);
-
-$accordion-button-icon:         url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='#{$accordion-icon-color}' stroke-linecap='round' stroke-linejoin='round'><path d='m2 5 6 6 6-6'/></svg>");
-$accordion-button-active-icon:  url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='#{$accordion-icon-active-color}' stroke-linecap='round' stroke-linejoin='round'><path d='m2 5 6 6 6-6'/></svg>");
-
+$accordion-body-padding-y: $accordion-padding-y; +$accordion-body-padding-x: $accordion-padding-x; -
- -
+$accordion-button-padding-y: $accordion-padding-y; +$accordion-button-padding-x: $accordion-padding-x; +$accordion-button-color: var(--#{$prefix}body-color); +$accordion-button-bg: var(--#{$prefix}accordion-bg); +$accordion-transition: $btn-transition, border-radius .15s ease; +$accordion-button-active-bg: var(--#{$prefix}primary-bg-subtle); +$accordion-button-active-color: var(--#{$prefix}primary-text-emphasis); +// fusv-disable +$accordion-button-focus-border-color: $input-focus-border-color; // Deprecated in v5.3.3 +// fusv-enable +$accordion-button-focus-box-shadow: $btn-focus-box-shadow; - +$accordion-icon-width: 1.25rem; +$accordion-icon-color: $body-color; +$accordion-icon-active-color: $primary-text-emphasis; +$accordion-icon-transition: transform .2s ease-in-out; +$accordion-icon-transform: rotate(-180deg); - - - - - - - - - - - +$accordion-button-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='#{$accordion-icon-color}' stroke-linecap='round' stroke-linejoin='round'><path d='m2 5 6 6 6-6'/></svg>"); +$accordion-button-active-icon: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='#{$accordion-icon-active-color}' stroke-linecap='round' stroke-linejoin='round'><path d='m2 5 6 6 6-6'/></svg>"); + \ No newline at end of file diff --git a/docs/5.3/components/alerts/index.html b/docs/5.3/components/alerts/index.html index b7a50a6ab7..63791876de 100644 --- a/docs/5.3/components/alerts/index.html +++ b/docs/5.3/components/alerts/index.html @@ -1,594 +1,30 @@ - - - - - - - - - - - - - - - - -Alerts · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-
-
- -

Alerts

-
-

Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages.

- - -
- - -
- - On this page -
- -
- - -
- - -

Examples

+ Alerts · Bootstrap v5.3

Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages.

+

Examples

Alerts are available for any length of text, as well as an optional close button. For proper styling, use one of the eight required contextual classes (e.g., .alert-success). For inline dismissal, use the alerts JavaScript plugin.

-
-Heads up! As of v5.3.0, the alert-variant() Sass mixin is deprecated. Alert variants now have their CSS variables overridden in a Sass loop. -
- -
-
- - -
html
<div class="alert alert-primary" role="alert">
+  A simple primary alert—check it out!
+</div>
+<div class="alert alert-secondary" role="alert">
+  A simple secondary alert—check it out!
+</div>
+<div class="alert alert-success" role="alert">
+  A simple success alert—check it out!
+</div>
+<div class="alert alert-danger" role="alert">
+  A simple danger alert—check it out!
+</div>
+<div class="alert alert-warning" role="alert">
+  A simple warning alert—check it out!
+</div>
+<div class="alert alert-info" role="alert">
+  A simple info alert—check it out!
+</div>
+<div class="alert alert-light" role="alert">
+  A simple light alert—check it out!
+</div>
+<div class="alert alert-dark" role="alert">
+  A simple dark alert—check it out!
+</div>
+

Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class.

+

Live example

Click the button below to show an alert (hidden with inline styles to start), then dismiss (and destroy) it with the built-in close button.

-
-
- -
- - -
- html -
- - -
-
<div id="liveAlertPlaceholder"></div>
-<button type="button" class="btn btn-primary" id="liveAlertBtn">Show live alert</button>
-
- +
+
html
<div id="liveAlertPlaceholder"></div>
+<button type="button" class="btn btn-primary" id="liveAlertBtn">Show live alert</button>

We use the following JavaScript to trigger our live alert demo:

-
-
const alertPlaceholder = document.getElementById('liveAlertPlaceholder')
-const appendAlert = (message, type) => {
-  const wrapper = document.createElement('div')
-  wrapper.innerHTML = [
-    `<div class="alert alert-${type} alert-dismissible" role="alert">`,
-    `   <div>${message}</div>`,
-    '   <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>',
-    '</div>'
-  ].join('')
-
-  alertPlaceholder.append(wrapper)
-}
-
-const alertTrigger = document.getElementById('liveAlertBtn')
-if (alertTrigger) {
-  alertTrigger.addEventListener('click', () => {
-    appendAlert('Nice, you triggered this alert message!', 'success')
-  })
-}
- -

Use the .alert-link utility class to quickly provide matching colored links within any alert.

-
-
- +
const alertPlaceholder = document.getElementById('liveAlertPlaceholder')
+const appendAlert = (message, type) => {
+  const wrapper = document.createElement('div')
+  wrapper.innerHTML = [
+    `<div class="alert alert-${type} alert-dismissible" role="alert">`,
+    `   <div>${message}</div>`,
+    '   <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>',
+    '</div>'
+  ].join('')
 
-
+ +

Use the .alert-link utility class to quickly provide matching colored links within any alert.

+
- -
- html -
- - -
-
<div class="alert alert-primary" role="alert">
-  A simple primary alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
-</div>
-<div class="alert alert-secondary" role="alert">
-  A simple secondary alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
-</div>
-<div class="alert alert-success" role="alert">
-  A simple success alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
-</div>
-<div class="alert alert-danger" role="alert">
-  A simple danger alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
-</div>
-<div class="alert alert-warning" role="alert">
-  A simple warning alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
-</div>
-<div class="alert alert-info" role="alert">
-  A simple info alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
-</div>
-<div class="alert alert-light" role="alert">
-  A simple light alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
-</div>
-<div class="alert alert-dark" role="alert">
-  A simple dark alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
-</div>
-
- -

Additional content

+
html
<div class="alert alert-primary" role="alert">
+  A simple primary alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
+</div>
+<div class="alert alert-secondary" role="alert">
+  A simple secondary alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
+</div>
+<div class="alert alert-success" role="alert">
+  A simple success alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
+</div>
+<div class="alert alert-danger" role="alert">
+  A simple danger alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
+</div>
+<div class="alert alert-warning" role="alert">
+  A simple warning alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
+</div>
+<div class="alert alert-info" role="alert">
+  A simple info alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
+</div>
+<div class="alert alert-light" role="alert">
+  A simple light alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
+</div>
+<div class="alert alert-dark" role="alert">
+  A simple dark alert with <a href="#" class="alert-link">an example link</a>. Give it a click if you like.
+</div>
+

Additional content

Alerts can also contain additional HTML elements like headings, paragraphs and dividers.

-
-
- -
html
<div class="alert alert-primary d-flex align-items-center" role="alert">
+  <svg xmlns="http://www.w3.org/2000/svg" class="bi flex-shrink-0 me-2" viewBox="0 0 16 16" role="img" aria-label="Warning:">
+    <path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/>
+  </svg>
+  <div>
+    An example alert with an icon
+  </div>
+</div>

Need more than one icon for your alerts? Consider using more Bootstrap Icons and making a local SVG sprite like so to easily reference the same icons repeatedly.

-
-
- - +
@@ -873,330 +213,189 @@
An example danger alert with an icon
-
+
html
<svg xmlns="http://www.w3.org/2000/svg" class="d-none">
+  <symbol id="check-circle-fill" viewBox="0 0 16 16">
+    <path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
+  </symbol>
+  <symbol id="info-fill" viewBox="0 0 16 16">
+    <path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/>
+  </symbol>
+  <symbol id="exclamation-triangle-fill" viewBox="0 0 16 16">
+    <path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/>
+  </symbol>
+</svg>
 
-  
- html -
- - -
-
<svg xmlns="http://www.w3.org/2000/svg" class="d-none">
-  <symbol id="check-circle-fill" viewBox="0 0 16 16">
-    <path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
-  </symbol>
-  <symbol id="info-fill" viewBox="0 0 16 16">
-    <path d="M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16zm.93-9.412-1 4.705c-.07.34.029.533.304.533.194 0 .487-.07.686-.246l-.088.416c-.287.346-.92.598-1.465.598-.703 0-1.002-.422-.808-1.319l.738-3.468c.064-.293.006-.399-.287-.47l-.451-.081.082-.381 2.29-.287zM8 5.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"/>
-  </symbol>
-  <symbol id="exclamation-triangle-fill" viewBox="0 0 16 16">
-    <path d="M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"/>
-  </symbol>
-</svg>
-
-<div class="alert alert-primary d-flex align-items-center" role="alert">
-  <svg class="bi flex-shrink-0 me-2" role="img" aria-label="Info:"><use xlink:href="#info-fill"/></svg>
-  <div>
-    An example alert with an icon
-  </div>
-</div>
-<div class="alert alert-success d-flex align-items-center" role="alert">
-  <svg class="bi flex-shrink-0 me-2" role="img" aria-label="Success:"><use xlink:href="#check-circle-fill"/></svg>
-  <div>
-    An example success alert with an icon
-  </div>
-</div>
-<div class="alert alert-warning d-flex align-items-center" role="alert">
-  <svg class="bi flex-shrink-0 me-2" role="img" aria-label="Warning:"><use xlink:href="#exclamation-triangle-fill"/></svg>
-  <div>
-    An example warning alert with an icon
-  </div>
-</div>
-<div class="alert alert-danger d-flex align-items-center" role="alert">
-  <svg class="bi flex-shrink-0 me-2" role="img" aria-label="Danger:"><use xlink:href="#exclamation-triangle-fill"/></svg>
-  <div>
-    An example danger alert with an icon
-  </div>
-</div>
-
- -

Dismissing

-

Using the alert JavaScript plugin, it’s possible to dismiss any alert inline. Here’s how:

+<div class="alert alert-primary d-flex align-items-center" role="alert"> + <svg class="bi flex-shrink-0 me-2" role="img" aria-label="Info:"><use xlink:href="#info-fill"/></svg> + <div> + An example alert with an icon + </div> +</div> +<div class="alert alert-success d-flex align-items-center" role="alert"> + <svg class="bi flex-shrink-0 me-2" role="img" aria-label="Success:"><use xlink:href="#check-circle-fill"/></svg> + <div> + An example success alert with an icon + </div> +</div> +<div class="alert alert-warning d-flex align-items-center" role="alert"> + <svg class="bi flex-shrink-0 me-2" role="img" aria-label="Warning:"><use xlink:href="#exclamation-triangle-fill"/></svg> + <div> + An example warning alert with an icon + </div> +</div> +<div class="alert alert-danger d-flex align-items-center" role="alert"> + <svg class="bi flex-shrink-0 me-2" role="img" aria-label="Danger:"><use xlink:href="#exclamation-triangle-fill"/></svg> + <div> + An example danger alert with an icon + </div> +</div>
+

Dismissing

+

Using the alert JavaScript plugin, it’s possible to dismiss any alert inline. Here’s how:

    -
  • Be sure you’ve loaded the alert plugin, or the compiled Bootstrap JavaScript.
  • -
  • Add a close button and the .alert-dismissible class, which adds extra padding to the right of the alert and positions the close button.
  • +
  • Be sure you’ve loaded the alert plugin, or the compiled Bootstrap JavaScript.
  • +
  • Add a close button and the .alert-dismissible class, which adds extra padding to the right of the alert and positions the close button.
  • On the close button, add the data-bs-dismiss="alert" attribute, which triggers the JavaScript functionality. Be sure to use the <button> element with it for proper behavior across all devices.
  • To animate alerts when dismissing them, be sure to add the .fade and .show classes.

You can see this in action with a live demo:

-
-
- -
html
<div class="alert alert-warning alert-dismissible fade show" role="alert">
+  <strong>Holy guacamole!</strong> You should check in on some of those fields below.
+  <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
+</div>
+

When an alert is dismissed, the element is completely removed from the page structure. If a keyboard user dismisses the alert using the close button, their focus will suddenly be lost and, depending on the browser, reset to the start of the page/document. For this reason, we recommend including additional JavaScript that listens for the closed.bs.alert event and programmatically sets focus() to the most appropriate location in the page. If you’re planning to move focus to a non-interactive element that normally does not receive focus, make sure to add tabindex="-1" to the element.

+

CSS

+

Variables

Added in v5.2.0 +

As part of Bootstrap’s evolving CSS variables approach, alerts now use local CSS variables on .alert for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

+
--#{$prefix}alert-bg: transparent;
+--#{$prefix}alert-padding-x: #{$alert-padding-x};
+--#{$prefix}alert-padding-y: #{$alert-padding-y};
+--#{$prefix}alert-margin-bottom: #{$alert-margin-bottom};
+--#{$prefix}alert-color: inherit;
+--#{$prefix}alert-border-color: transparent;
+--#{$prefix}alert-border: #{$alert-border-width} solid var(--#{$prefix}alert-border-color);
+--#{$prefix}alert-border-radius: #{$alert-border-radius};
+--#{$prefix}alert-link-color: inherit;
+
+

Sass variables

+
$alert-padding-y:               $spacer;
+$alert-padding-x:               $spacer;
+$alert-margin-bottom:           1rem;
+$alert-border-radius:           var(--#{$prefix}border-radius);
+$alert-link-font-weight:        $font-weight-bold;
+$alert-border-width:            var(--#{$prefix}border-width);
+$alert-dismissible-padding-r:   $alert-padding-x * 3; // 3x covers width of x plus default padding on either side
+
+

Sass mixins

+ +Deprecated in v5.3.0 +
@mixin alert-variant($background, $border, $color) {
+  --#{$prefix}alert-color: #{$color};
+  --#{$prefix}alert-bg: #{$background};
+  --#{$prefix}alert-border-color: #{$border};
+  --#{$prefix}alert-link-color: #{shade-color($color, 20%)};
 
-

As part of Bootstrap’s evolving CSS variables approach, alerts now use local CSS variables on .alert for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

-
-
- scss/_alert.scss -
- -
-
--#{$prefix}alert-bg: transparent;
---#{$prefix}alert-padding-x: #{$alert-padding-x};
---#{$prefix}alert-padding-y: #{$alert-padding-y};
---#{$prefix}alert-margin-bottom: #{$alert-margin-bottom};
---#{$prefix}alert-color: inherit;
---#{$prefix}alert-border-color: transparent;
---#{$prefix}alert-border: #{$alert-border-width} solid var(--#{$prefix}alert-border-color);
---#{$prefix}alert-border-radius: #{$alert-border-radius};
---#{$prefix}alert-link-color: inherit;
-

Sass variables

-
-
- scss/_variables.scss -
- -
-
$alert-padding-y:               $spacer;
-$alert-padding-x:               $spacer;
-$alert-margin-bottom:           1rem;
-$alert-border-radius:           var(--#{$prefix}border-radius);
-$alert-link-font-weight:        $font-weight-bold;
-$alert-border-width:            var(--#{$prefix}border-width);
-$alert-dismissible-padding-r:   $alert-padding-x * 3; // 3x covers width of x plus default padding on either side
-
-

Sass mixins

-Deprecated in v5.3.0 + @if $enable-gradients { + background-image: var(--#{$prefix}gradient); + } -
-
- scss/mixins/_alert.scss -
- -
-
@mixin alert-variant($background, $border, $color) {
-  --#{$prefix}alert-color: #{$color};
-  --#{$prefix}alert-bg: #{$background};
-  --#{$prefix}alert-border-color: #{$border};
-  --#{$prefix}alert-link-color: #{shade-color($color, 20%)};
-
-  @if $enable-gradients {
-    background-image: var(--#{$prefix}gradient);
-  }
-
-  .alert-link {
-    color: var(--#{$prefix}alert-link-color);
-  }
-}
-
-

Sass loops

+ .alert-link { + color: var(--#{$prefix}alert-link-color); + } +} +
+

Sass loops

Loop that generates the modifier classes with an overriding of CSS variables.

-
-
- scss/_alert.scss -
- -
-
// Generate contextual modifier classes for colorizing the alert
-@each $state in map-keys($theme-colors) {
-  .alert-#{$state} {
-    --#{$prefix}alert-color: var(--#{$prefix}#{$state}-text-emphasis);
-    --#{$prefix}alert-bg: var(--#{$prefix}#{$state}-bg-subtle);
-    --#{$prefix}alert-border-color: var(--#{$prefix}#{$state}-border-subtle);
-    --#{$prefix}alert-link-color: var(--#{$prefix}#{$state}-text-emphasis);
-  }
-}
-
-

JavaScript behavior

-

Initialize

+
// Generate contextual modifier classes for colorizing the alert
+@each $state in map-keys($theme-colors) {
+  .alert-#{$state} {
+    --#{$prefix}alert-color: var(--#{$prefix}#{$state}-text-emphasis);
+    --#{$prefix}alert-bg: var(--#{$prefix}#{$state}-bg-subtle);
+    --#{$prefix}alert-border-color: var(--#{$prefix}#{$state}-border-subtle);
+    --#{$prefix}alert-link-color: var(--#{$prefix}#{$state}-text-emphasis);
+  }
+}
+
+

JavaScript behavior

+

Initialize

Initialize elements as alerts

-
const alertList = document.querySelectorAll('.alert')
-const alerts = [...alertList].map(element => new bootstrap.Alert(element))
-
-

For the sole purpose of dismissing an alert, it isn’t necessary to initialize the component manually via the JS API. By making use of data-bs-dismiss="alert", the component will be initialized automatically and properly dismissed.

-

See the triggers section for more details.

- -
- -

Triggers

-

Dismissal can be achieved with the data-bs-dismiss attribute on a button within the alert as demonstrated below:

-
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
-

or on a button outside the alert using the additional data-bs-target as demonstrated below:

-
<button type="button" class="btn-close" data-bs-dismiss="alert" data-bs-target="#my-alert" aria-label="Close"></button>
-

Note that closing an alert will remove it from the DOM.

-

Methods

+
const alertList = document.querySelectorAll('.alert')
+const alerts = [...alertList].map(element => new bootstrap.Alert(element))
+
+

For the sole purpose of dismissing an alert, it isn’t necessary to initialize the component manually via the JS API. By making use of data-bs-dismiss="alert", the component will be initialized automatically and properly dismissed.

See the triggers section for more details.

+

Triggers

+

+Dismissal can be achieved with the data-bs-dismiss attribute on a button within the alert as demonstrated below: +

<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>

+or on a button outside the alert using the additional data-bs-target as demonstrated below: +

<button type="button" class="btn-close" data-bs-dismiss="alert" data-bs-target="#my-alert" aria-label="Close"></button>
+

Note that closing an alert will remove it from the DOM.

+

Methods

You can create an alert instance with the alert constructor, for example:

-
const bsAlert = new bootstrap.Alert('#myAlert')
-

This makes an alert listen for click events on descendant elements which have the data-bs-dismiss="alert" attribute. (Not necessary when using the data-api’s auto-initialization.)

-
- - - - - - - - - - - - - - - - - - - - - - - - -
MethodDescription
closeCloses an alert by removing it from the DOM. If the .fade and .show classes are present on the element, the alert will fade out before it is removed.
disposeDestroys an element’s alert. (Removes stored data on the DOM element)
getInstanceStatic method which allows you to get the alert instance associated to a DOM element. For example: bootstrap.Alert.getInstance(alert).
getOrCreateInstanceStatic method which returns an alert instance associated to a DOM element or create a new one in case it wasn’t initialized. You can use it like this: bootstrap.Alert.getOrCreateInstance(element).
+
const bsAlert = new bootstrap.Alert('#myAlert')
+
+

This makes an alert listen for click events on descendant elements which have the data-bs-dismiss="alert" attribute. (Not necessary when using the data-api’s auto-initialization.)

+
+ + + + + + + + + + + + + + + + + + + + + + + +
MethodDescription
closeCloses an alert by removing it from the DOM. If the .fade and .show classes are present on the element, the alert will fade out before it is removed.
disposeDestroys an element’s alert. (Removes stored data on the DOM element)
getInstanceStatic method which allows you to get the alert instance associated to a DOM element. For example: bootstrap.Alert.getInstance(alert).
getOrCreateInstanceStatic method which returns an alert instance associated to a DOM element or create a new one in case it wasn’t initialized. You can use it like this: bootstrap.Alert.getOrCreateInstance(element).

Basic usage:

-
const alert = bootstrap.Alert.getOrCreateInstance('#myAlert')
-alert.close()
-

Events

-

Bootstrap’s alert plugin exposes a few events for hooking into alert functionality.

-
- - - - - - - - - - - - - - - - -
EventDescription
close.bs.alertFires immediately when the close instance method is called.
closed.bs.alertFired when the alert has been closed and CSS transitions have completed.
- -
const myAlert = document.getElementById('myAlert')
-myAlert.addEventListener('closed.bs.alert', event => {
-  // do something, for instance, explicitly move focus to the most appropriate element,
-  // so it doesn't get lost/reset to the start of the page
-  // document.getElementById('...').focus()
-})
-
-
- - +
const alert = bootstrap.Alert.getOrCreateInstance('#myAlert')
+alert.close()
+
+

Events

+

Bootstrap’s alert plugin exposes a few events for hooking into alert functionality.

+
- - - - - - - - - + + + + + + + + + + +
EventDescription
close.bs.alertFires immediately when the close instance method is called.
closed.bs.alertFired when the alert has been closed and CSS transitions have completed.
+
const myAlert = document.getElementById('myAlert')
+myAlert.addEventListener('closed.bs.alert', event => {
+  // do something, for instance, explicitly move focus to the most appropriate element,
+  // so it doesn’t get lost/reset to the start of the page
+  // document.getElementById('...').focus()
+})
+
\ No newline at end of file diff --git a/docs/5.3/components/badge/index.html b/docs/5.3/components/badge/index.html index 80759d61a7..1a280879c9 100644 --- a/docs/5.3/components/badge/index.html +++ b/docs/5.3/components/badge/index.html @@ -1,876 +1,132 @@ - - - - - - - - - - - - - - - - -Badges · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-
-
- -

Badges

-
-

Documentation and examples for badges, our small count and labeling component.

- - -
- - -
- - On this page -
- -
- - -
- - -

Examples

+ Badges · Bootstrap v5.3

Documentation and examples for badges, our small count and labeling component.

+

Examples

Badges scale to match the size of the immediate parent element by using relative font sizing and em units. As of v5, badges no longer have focus or hover styles for links.

-

Headings

-
-
- -

Example heading New

+

Headings

+

Example heading New

Example heading New

Example heading New

Example heading New

Example heading New
-
Example heading New
- -
- html -
- - -
-
<h1>Example heading <span class="badge text-bg-secondary">New</span></h1>
-<h2>Example heading <span class="badge text-bg-secondary">New</span></h2>
-<h3>Example heading <span class="badge text-bg-secondary">New</span></h3>
-<h4>Example heading <span class="badge text-bg-secondary">New</span></h4>
-<h5>Example heading <span class="badge text-bg-secondary">New</span></h5>
-<h6>Example heading <span class="badge text-bg-secondary">New</span></h6>
-
- -

Buttons

+
Example heading New
html
<h1>Example heading <span class="badge text-bg-secondary">New</span></h1>
+<h2>Example heading <span class="badge text-bg-secondary">New</span></h2>
+<h3>Example heading <span class="badge text-bg-secondary">New</span></h3>
+<h4>Example heading <span class="badge text-bg-secondary">New</span></h4>
+<h5>Example heading <span class="badge text-bg-secondary">New</span></h5>
+<h6>Example heading <span class="badge text-bg-secondary">New</span></h6>
+

Buttons

Badges can be used as part of links or buttons to provide a counter.

-
-
- - - -
- html -
- - -
-
<button type="button" class="btn btn-primary">
-  Notifications <span class="badge text-bg-secondary">4</span>
-</button>
-
- +
html
<button type="button" class="btn btn-primary">
+  Notifications <span class="badge text-bg-secondary">4</span>
+</button>

Note that depending on how they are used, badges may be confusing for users of screen readers and similar assistive technologies. While the styling of badges provides a visual cue as to their purpose, these users will simply be presented with the content of the badge. Depending on the specific situation, these badges may seem like random additional words or numbers at the end of a sentence, link, or button.

-

Unless the context is clear (as with the “Notifications” example, where it is understood that the “4” is the number of notifications), consider including additional context with a visually hidden piece of additional text.

-

Positioned

+

Unless the context is clear (as with the “Notifications” example, where it is understood that the “4” is the number of notifications), consider including additional context with a visually hidden piece of additional text.

+

Positioned

Use utilities to modify a .badge and position it in the corner of a link or button.

-
-
- - - -
- html -
- - -
-
<button type="button" class="btn btn-primary position-relative">
-  Inbox
-  <span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger">
-    99+
-    <span class="visually-hidden">unread messages</span>
-  </span>
-</button>
-
- +
html
<button type="button" class="btn btn-primary position-relative">
+  Inbox
+  <span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger">
+    99+
+    <span class="visually-hidden">unread messages</span>
+  </span>
+</button>

You can also replace the .badge class with a few more utilities without a count for a more generic indicator.

-
-
- - - -
- html -
- - -
-
<button type="button" class="btn btn-primary position-relative">
-  Profile
-  <span class="position-absolute top-0 start-100 translate-middle p-2 bg-danger border border-light rounded-circle">
-    <span class="visually-hidden">New alerts</span>
-  </span>
-</button>
-
- -

Background colors

+
html
<button type="button" class="btn btn-primary position-relative">
+  Profile
+  <span class="position-absolute top-0 start-100 translate-middle p-2 bg-danger border border-light rounded-circle">
+    <span class="visually-hidden">New alerts</span>
+  </span>
+</button>
+

Background colors

Added in v5.2.0 - -

Set a background-color with contrasting foreground color with our .text-bg-{color} helpers. Previously it was required to manually pair your choice of .text-{color} and .bg-{color} utilities for styling, which you still may use if you prefer.

-
-
- - -Primary +

Set a background-color with contrasting foreground color with our .text-bg-{color} helpers. Previously it was required to manually pair your choice of .text-{color} and .bg-{color} utilities for styling, which you still may use if you prefer.

+
Primary Secondary Success Danger Warning Info Light -Dark - -
- html -
- - -
-
<span class="badge text-bg-primary">Primary</span>
-<span class="badge text-bg-secondary">Secondary</span>
-<span class="badge text-bg-success">Success</span>
-<span class="badge text-bg-danger">Danger</span>
-<span class="badge text-bg-warning">Warning</span>
-<span class="badge text-bg-info">Info</span>
-<span class="badge text-bg-light">Light</span>
-<span class="badge text-bg-dark">Dark</span>
-
- -
-Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class. -
- -

Pill badges

+Dark
html
<span class="badge text-bg-primary">Primary</span>
+<span class="badge text-bg-secondary">Secondary</span>
+<span class="badge text-bg-success">Success</span>
+<span class="badge text-bg-danger">Danger</span>
+<span class="badge text-bg-warning">Warning</span>
+<span class="badge text-bg-info">Info</span>
+<span class="badge text-bg-light">Light</span>
+<span class="badge text-bg-dark">Dark</span>
+

Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class.

+

Pill badges

Use the .rounded-pill utility class to make badges more rounded with a larger border-radius.

-
-
- - -Primary +
Primary Secondary Success Danger Warning Info Light -Dark - -
- html -
- - -
-
<span class="badge rounded-pill text-bg-primary">Primary</span>
-<span class="badge rounded-pill text-bg-secondary">Secondary</span>
-<span class="badge rounded-pill text-bg-success">Success</span>
-<span class="badge rounded-pill text-bg-danger">Danger</span>
-<span class="badge rounded-pill text-bg-warning">Warning</span>
-<span class="badge rounded-pill text-bg-info">Info</span>
-<span class="badge rounded-pill text-bg-light">Light</span>
-<span class="badge rounded-pill text-bg-dark">Dark</span>
-
- -

CSS

-

Variables

+Dark
html
<span class="badge rounded-pill text-bg-primary">Primary</span>
+<span class="badge rounded-pill text-bg-secondary">Secondary</span>
+<span class="badge rounded-pill text-bg-success">Success</span>
+<span class="badge rounded-pill text-bg-danger">Danger</span>
+<span class="badge rounded-pill text-bg-warning">Warning</span>
+<span class="badge rounded-pill text-bg-info">Info</span>
+<span class="badge rounded-pill text-bg-light">Light</span>
+<span class="badge rounded-pill text-bg-dark">Dark</span>
+

CSS

+

Variables

Added in v5.2.0 - -

As part of Bootstrap’s evolving CSS variables approach, badges now use local CSS variables on .badge for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

-
-
- scss/_badge.scss -
- -
-
--#{$prefix}badge-padding-x: #{$badge-padding-x};
---#{$prefix}badge-padding-y: #{$badge-padding-y};
-@include rfs($badge-font-size, --#{$prefix}badge-font-size);
---#{$prefix}badge-font-weight: #{$badge-font-weight};
---#{$prefix}badge-color: #{$badge-color};
---#{$prefix}badge-border-radius: #{$badge-border-radius};
-

Sass variables

-
-
- scss/_variables.scss -
- -
-
$badge-font-size:                   .75em;
-$badge-font-weight:                 $font-weight-bold;
-$badge-color:                       $white;
-$badge-padding-y:                   .35em;
-$badge-padding-x:                   .65em;
-$badge-border-radius:               var(--#{$prefix}border-radius);
-
- - - - - - - - - - - - - - - - - - - +

As part of Bootstrap’s evolving CSS variables approach, badges now use local CSS variables on .badge for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

+
--#{$prefix}badge-padding-x: #{$badge-padding-x};
+--#{$prefix}badge-padding-y: #{$badge-padding-y};
+@include rfs($badge-font-size, --#{$prefix}badge-font-size);
+--#{$prefix}badge-font-weight: #{$badge-font-weight};
+--#{$prefix}badge-color: #{$badge-color};
+--#{$prefix}badge-border-radius: #{$badge-border-radius};
+
+

Sass variables

+
$badge-font-size:                   .75em;
+$badge-font-weight:                 $font-weight-bold;
+$badge-color:                       $white;
+$badge-padding-y:                   .35em;
+$badge-padding-x:                   .65em;
+$badge-border-radius:               var(--#{$prefix}border-radius);
+
\ No newline at end of file diff --git a/docs/5.3/components/breadcrumb/index.html b/docs/5.3/components/breadcrumb/index.html index d8a9aea8f3..a28f4f198c 100644 --- a/docs/5.3/components/breadcrumb/index.html +++ b/docs/5.3/components/breadcrumb/index.html @@ -1,573 +1,29 @@ - - - - - - - - - - - - - - - - -Breadcrumb · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-
-
- -

Breadcrumb

-
-

Indicate the current page’s location within a navigational hierarchy that automatically adds separators via CSS.

- - -
- - -
- - On this page -
- -
- - -
- - -

Example

+ Breadcrumb · Bootstrap v5.3

Breadcrumb

Indicate the current page’s location within a navigational hierarchy that automatically adds separators via CSS.

+
On this page

Example

Use an ordered or unordered list with linked list items to create a minimally styled breadcrumb. Use our utilities to add additional styles as desired.

-
-
- -
html
<nav aria-label="breadcrumb">
+  <ol class="breadcrumb">
+    <li class="breadcrumb-item active" aria-current="page">Home</li>
+  </ol>
+</nav>
 
-  
- html -
- - -
-
<nav aria-label="breadcrumb">
-  <ol class="breadcrumb">
-    <li class="breadcrumb-item active" aria-current="page">Home</li>
-  </ol>
-</nav>
-
-<nav aria-label="breadcrumb">
-  <ol class="breadcrumb">
-    <li class="breadcrumb-item"><a href="#">Home</a></li>
-    <li class="breadcrumb-item active" aria-current="page">Library</li>
-  </ol>
-</nav>
-
-<nav aria-label="breadcrumb">
-  <ol class="breadcrumb">
-    <li class="breadcrumb-item"><a href="#">Home</a></li>
-    <li class="breadcrumb-item"><a href="#">Library</a></li>
-    <li class="breadcrumb-item active" aria-current="page">Data</li>
-  </ol>
-</nav>
-
+<nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + <li class="breadcrumb-item"><a href="#">Home</a></li> + <li class="breadcrumb-item active" aria-current="page">Library</li> + </ol> +</nav> -

Dividers

+<nav aria-label="breadcrumb"> + <ol class="breadcrumb"> + <li class="breadcrumb-item"><a href="#">Home</a></li> + <li class="breadcrumb-item"><a href="#">Library</a></li> + <li class="breadcrumb-item active" aria-current="page">Data</li> + </ol> +</nav>
+

Dividers

Dividers are automatically added in CSS through ::before and content. They can be changed by modifying a local CSS custom property --bs-breadcrumb-divider, or through the $breadcrumb-divider Sass variable — and $breadcrumb-divider-flipped for its RTL counterpart, if needed. We default to our Sass variable, which is set as a fallback to the custom property. This way, you get a global divider that you can override without recompiling CSS at any time.

-
-
- -
html
<nav style="--bs-breadcrumb-divider: '>';" aria-label="breadcrumb">
+  <ol class="breadcrumb">
+    <li class="breadcrumb-item"><a href="#">Home</a></li>
+    <li class="breadcrumb-item active" aria-current="page">Library</li>
+  </ol>
+</nav>

When modifying via Sass, the quote function is required to generate the quotes around a string. For example, using > as the divider, you can use this:

-
$breadcrumb-divider: quote(">");
-

It’s also possible to use an embedded SVG icon. Apply it via our CSS custom property, or use the Sass variable.

-
-Inlined SVG requires properly escaped characters. Some reserved characters, such as <, > and #, must be URL-encoded or escaped. We do this with the $breadcrumb-divider variable using our escape-svg() Sass function. When customizing the CSS variable, you must handle this yourself. Read Kevin Weber’s explanations on CodePen for more info. -
- -
-
- -
html
<nav style="--bs-breadcrumb-divider: '';" aria-label="breadcrumb">
+  <ol class="breadcrumb">
+    <li class="breadcrumb-item"><a href="#">Home</a></li>
+    <li class="breadcrumb-item active" aria-current="page">Library</li>
+  </ol>
+</nav>
+
$breadcrumb-divider: none;
+
+

Accessibility

+

Since breadcrumbs provide a navigation, it’s a good idea to add a meaningful label such as aria-label="breadcrumb" to describe the type of navigation provided in the <nav> element, as well as applying an aria-current="page" to the last item of the set to indicate that it represents the current page.

For more information, see the ARIA Authoring Practices Guide breadcrumb pattern.

-

CSS

-

Variables

+

CSS

+

Variables

Added in v5.2.0 - -

As part of Bootstrap’s evolving CSS variables approach, breadcrumbs now use local CSS variables on .breadcrumb for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

-
-
- scss/_breadcrumb.scss -
- -
-
--#{$prefix}breadcrumb-padding-x: #{$breadcrumb-padding-x};
---#{$prefix}breadcrumb-padding-y: #{$breadcrumb-padding-y};
---#{$prefix}breadcrumb-margin-bottom: #{$breadcrumb-margin-bottom};
-@include rfs($breadcrumb-font-size, --#{$prefix}breadcrumb-font-size);
---#{$prefix}breadcrumb-bg: #{$breadcrumb-bg};
---#{$prefix}breadcrumb-border-radius: #{$breadcrumb-border-radius};
---#{$prefix}breadcrumb-divider-color: #{$breadcrumb-divider-color};
---#{$prefix}breadcrumb-item-padding-x: #{$breadcrumb-item-padding-x};
---#{$prefix}breadcrumb-item-active-color: #{$breadcrumb-active-color};
-

Sass variables

-
-
- scss/_variables.scss -
- -
-
$breadcrumb-font-size:              null;
-$breadcrumb-padding-y:              0;
-$breadcrumb-padding-x:              0;
-$breadcrumb-item-padding-x:         .5rem;
-$breadcrumb-margin-bottom:          1rem;
-$breadcrumb-bg:                     null;
-$breadcrumb-divider-color:          var(--#{$prefix}secondary-color);
-$breadcrumb-active-color:           var(--#{$prefix}secondary-color);
-$breadcrumb-divider:                quote("/");
-$breadcrumb-divider-flipped:        $breadcrumb-divider;
-$breadcrumb-border-radius:          null;
-
- -
-
-
- - - - - - - - - - - - - - - +

As part of Bootstrap’s evolving CSS variables approach, breadcrumbs now use local CSS variables on .breadcrumb for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

+
--#{$prefix}breadcrumb-padding-x: #{$breadcrumb-padding-x};
+--#{$prefix}breadcrumb-padding-y: #{$breadcrumb-padding-y};
+--#{$prefix}breadcrumb-margin-bottom: #{$breadcrumb-margin-bottom};
+@include rfs($breadcrumb-font-size, --#{$prefix}breadcrumb-font-size);
+--#{$prefix}breadcrumb-bg: #{$breadcrumb-bg};
+--#{$prefix}breadcrumb-border-radius: #{$breadcrumb-border-radius};
+--#{$prefix}breadcrumb-divider-color: #{$breadcrumb-divider-color};
+--#{$prefix}breadcrumb-item-padding-x: #{$breadcrumb-item-padding-x};
+--#{$prefix}breadcrumb-item-active-color: #{$breadcrumb-active-color};
+
+

Sass variables

+
$breadcrumb-font-size:              null;
+$breadcrumb-padding-y:              0;
+$breadcrumb-padding-x:              0;
+$breadcrumb-item-padding-x:         .5rem;
+$breadcrumb-margin-bottom:          1rem;
+$breadcrumb-bg:                     null;
+$breadcrumb-divider-color:          var(--#{$prefix}secondary-color);
+$breadcrumb-active-color:           var(--#{$prefix}secondary-color);
+$breadcrumb-divider:                quote("/");
+$breadcrumb-divider-flipped:        $breadcrumb-divider;
+$breadcrumb-border-radius:          null;
+
\ No newline at end of file diff --git a/docs/5.3/components/button-group/index.html b/docs/5.3/components/button-group/index.html index 7817022926..31ae4f8f0a 100644 --- a/docs/5.3/components/button-group/index.html +++ b/docs/5.3/components/button-group/index.html @@ -1,685 +1,71 @@ - - - - - - - - - - - - - - - - -Button group · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - -
-
-
- -

Button group

-
-

Group a series of buttons together on a single line or stack them in a vertical column.

- - -
- - - - - -
- - -

Basic example

+ Button group · Bootstrap v5.3

Button group

Group a series of buttons together on a single line or stack them in a vertical column.

+

Basic example

Wrap a series of buttons with .btn in .btn-group.

-
-
- -
+
-
- -
- html -
- - -
-
<div class="btn-group" role="group" aria-label="Basic example">
-  <button type="button" class="btn btn-primary">Left</button>
-  <button type="button" class="btn btn-primary">Middle</button>
-  <button type="button" class="btn btn-primary">Right</button>
-</div>
-
- -
-Button groups require an appropriate role attribute and explicit label to ensure assistive technologies like screen readers identify buttons as grouped and announce them. Use role="group" for button groups or role="toolbar" for button toolbars. Then use aria-label or aria-labelledby to label them. -
- -

These classes can also be added to groups of links, as an alternative to the .nav navigation components.

-
-
- -
+
html
<div class="btn-group" role="group" aria-label="Basic example">
+  <button type="button" class="btn btn-primary">Left</button>
+  <button type="button" class="btn btn-primary">Middle</button>
+  <button type="button" class="btn btn-primary">Right</button>
+</div>
+

Button groups require an appropriate role attribute and explicit label to ensure assistive technologies like screen readers identify buttons as grouped and announce them. Use role="group" for button groups or role="toolbar" for button toolbars. Then use aria-label or aria-labelledby to label them.

+

These classes can also be added to groups of links, as an alternative to the .nav navigation components.

+
- html -
- - -
-
<div class="btn-group">
-  <a href="#" class="btn btn-primary active" aria-current="page">Active link</a>
-  <a href="#" class="btn btn-primary">Link</a>
-  <a href="#" class="btn btn-primary">Link</a>
-</div>
-
- -

Mixed styles

-
-
- -
+
html
<div class="btn-group">
+  <a href="#" class="btn btn-primary active" aria-current="page">Active link</a>
+  <a href="#" class="btn btn-primary">Link</a>
+  <a href="#" class="btn btn-primary">Link</a>
+</div>
+

Mixed styles

+
-
- -
- html -
- - -
-
<div class="btn-group" role="group" aria-label="Basic mixed styles example">
-  <button type="button" class="btn btn-danger">Left</button>
-  <button type="button" class="btn btn-warning">Middle</button>
-  <button type="button" class="btn btn-success">Right</button>
-</div>
-
- -

Outlined styles

-
-
- -
+
html
<div class="btn-group" role="group" aria-label="Basic mixed styles example">
+  <button type="button" class="btn btn-danger">Left</button>
+  <button type="button" class="btn btn-warning">Middle</button>
+  <button type="button" class="btn btn-success">Right</button>
+</div>
+

Outlined styles

+
-
- -
- html -
- - -
-
<div class="btn-group" role="group" aria-label="Basic outlined example">
-  <button type="button" class="btn btn-outline-primary">Left</button>
-  <button type="button" class="btn btn-outline-primary">Middle</button>
-  <button type="button" class="btn btn-outline-primary">Right</button>
-</div>
-
- -

Checkbox and radio button groups

-

Combine button-like checkbox and radio toggle buttons into a seamless looking button group.

-
-
- -
+
html
<div class="btn-group" role="group" aria-label="Basic outlined example">
+  <button type="button" class="btn btn-outline-primary">Left</button>
+  <button type="button" class="btn btn-outline-primary">Middle</button>
+  <button type="button" class="btn btn-outline-primary">Right</button>
+</div>
+

Checkbox and radio button groups

+

Combine button-like checkbox and radio toggle buttons into a seamless looking button group.

+
@@ -688,34 +74,17 @@ Button groups require an appropriate role attribute and explicit la -
+
html
<div class="btn-group" role="group" aria-label="Basic checkbox toggle button group">
+  <input type="checkbox" class="btn-check" id="btncheck1" autocomplete="off">
+  <label class="btn btn-outline-primary" for="btncheck1">Checkbox 1</label>
 
-  
- html -
- - -
-
<div class="btn-group" role="group" aria-label="Basic checkbox toggle button group">
-  <input type="checkbox" class="btn-check" id="btncheck1" autocomplete="off">
-  <label class="btn btn-outline-primary" for="btncheck1">Checkbox 1</label>
-
-  <input type="checkbox" class="btn-check" id="btncheck2" autocomplete="off">
-  <label class="btn btn-outline-primary" for="btncheck2">Checkbox 2</label>
-
-  <input type="checkbox" class="btn-check" id="btncheck3" autocomplete="off">
-  <label class="btn btn-outline-primary" for="btncheck3">Checkbox 3</label>
-</div>
-
+ <input type="checkbox" class="btn-check" id="btncheck2" autocomplete="off"> + <label class="btn btn-outline-primary" for="btncheck2">Checkbox 2</label> -
-
- -
+ <input type="checkbox" class="btn-check" id="btncheck3" autocomplete="off"> + <label class="btn btn-outline-primary" for="btncheck3">Checkbox 3</label> +</div>
+
@@ -724,36 +93,19 @@ Button groups require an appropriate role attribute and explicit la -
+
html
<div class="btn-group" role="group" aria-label="Basic radio toggle button group">
+  <input type="radio" class="btn-check" name="btnradio" id="btnradio1" autocomplete="off" checked>
+  <label class="btn btn-outline-primary" for="btnradio1">Radio 1</label>
 
-  
- html -
- - -
-
<div class="btn-group" role="group" aria-label="Basic radio toggle button group">
-  <input type="radio" class="btn-check" name="btnradio" id="btnradio1" autocomplete="off" checked>
-  <label class="btn btn-outline-primary" for="btnradio1">Radio 1</label>
-
-  <input type="radio" class="btn-check" name="btnradio" id="btnradio2" autocomplete="off">
-  <label class="btn btn-outline-primary" for="btnradio2">Radio 2</label>
-
-  <input type="radio" class="btn-check" name="btnradio" id="btnradio3" autocomplete="off">
-  <label class="btn btn-outline-primary" for="btnradio3">Radio 3</label>
-</div>
-
+ <input type="radio" class="btn-check" name="btnradio" id="btnradio2" autocomplete="off"> + <label class="btn btn-outline-primary" for="btnradio2">Radio 2</label> -

Button toolbar

+ <input type="radio" class="btn-check" name="btnradio" id="btnradio3" autocomplete="off"> + <label class="btn btn-outline-primary" for="btnradio3">Radio 3</label> +</div>
+

Button toolbar

Combine sets of button groups into button toolbars for more complex components. Use utility classes as needed to space out groups, buttons, and more.

-
-
- -
+

Sizing

Instead of applying button sizing classes to every button in a group, just add .btn-group-* to each .btn-group, including each one when nesting multiple groups.

-
-
- -
+
@@ -886,43 +204,26 @@ Button groups require an appropriate role attribute and explicit la -
- -
- html -
- - -
-
<div class="btn-group btn-group-lg" role="group" aria-label="Large button group">
-  <button type="button" class="btn btn-outline-primary">Left</button>
-  <button type="button" class="btn btn-outline-primary">Middle</button>
-  <button type="button" class="btn btn-outline-primary">Right</button>
-</div>
-<br>
-<div class="btn-group" role="group" aria-label="Default button group">
-  <button type="button" class="btn btn-outline-primary">Left</button>
-  <button type="button" class="btn btn-outline-primary">Middle</button>
-  <button type="button" class="btn btn-outline-primary">Right</button>
-</div>
-<br>
-<div class="btn-group btn-group-sm" role="group" aria-label="Small button group">
-  <button type="button" class="btn btn-outline-primary">Left</button>
-  <button type="button" class="btn btn-outline-primary">Middle</button>
-  <button type="button" class="btn btn-outline-primary">Right</button>
-</div>
-
- -

Nesting

+
html
<div class="btn-group btn-group-lg" role="group" aria-label="Large button group">
+  <button type="button" class="btn btn-outline-primary">Left</button>
+  <button type="button" class="btn btn-outline-primary">Middle</button>
+  <button type="button" class="btn btn-outline-primary">Right</button>
+</div>
+<br>
+<div class="btn-group" role="group" aria-label="Default button group">
+  <button type="button" class="btn btn-outline-primary">Left</button>
+  <button type="button" class="btn btn-outline-primary">Middle</button>
+  <button type="button" class="btn btn-outline-primary">Right</button>
+</div>
+<br>
+<div class="btn-group btn-group-sm" role="group" aria-label="Small button group">
+  <button type="button" class="btn btn-outline-primary">Left</button>
+  <button type="button" class="btn btn-outline-primary">Middle</button>
+  <button type="button" class="btn btn-outline-primary">Right</button>
+</div>
+

Nesting

Place a .btn-group within another .btn-group when you want dropdown menus mixed with a series of buttons.

-
-
- -
+
@@ -935,68 +236,34 @@ Button groups require an appropriate role attribute and explicit la
  • Dropdown link
  • -
    +
    html
    <div class="btn-group" role="group" aria-label="Button group with nested dropdown">
    +  <button type="button" class="btn btn-primary">1</button>
    +  <button type="button" class="btn btn-primary">2</button>
     
    -  
    - html -
    - - -
    -
    <div class="btn-group" role="group" aria-label="Button group with nested dropdown">
    -  <button type="button" class="btn btn-primary">1</button>
    -  <button type="button" class="btn btn-primary">2</button>
    -
    -  <div class="btn-group" role="group">
    -    <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    -      Dropdown
    -    </button>
    -    <ul class="dropdown-menu">
    -      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    -      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    -    </ul>
    -  </div>
    -</div>
    -
    - -

    Vertical variation

    + <div class="btn-group" role="group"> + <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> + Dropdown + </button> + <ul class="dropdown-menu"> + <li><a class="dropdown-item" href="#">Dropdown link</a></li> + <li><a class="dropdown-item" href="#">Dropdown link</a></li> + </ul> + </div> +</div>
    +

    Vertical variation

    Make a set of buttons appear vertically stacked rather than horizontally. Split button dropdowns are not supported here.

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="btn-group-vertical" role="group" aria-label="Vertical button group">
    -  <button type="button" class="btn btn-primary">Button</button>
    -  <button type="button" class="btn btn-primary">Button</button>
    -  <button type="button" class="btn btn-primary">Button</button>
    -  <button type="button" class="btn btn-primary">Button</button>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="btn-group-vertical" role="group" aria-label="Vertical button group">
    +  <button type="button" class="btn btn-primary">Button</button>
    +  <button type="button" class="btn btn-primary">Button</button>
    +  <button type="button" class="btn btn-primary">Button</button>
    +  <button type="button" class="btn btn-primary">Button</button>
    +</div>
    +
    -
    - -
    - html -
    - - -
    -
    <div class="btn-group-vertical" role="group" aria-label="Vertical button group">
    -  <div class="btn-group" role="group">
    -    <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    -      Dropdown
    -    </button>
    -    <ul class="dropdown-menu">
    -      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    -      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    -    </ul>
    -  </div>
    -  <button type="button" class="btn btn-primary">Button</button>
    -  <button type="button" class="btn btn-primary">Button</button>
    -  <div class="btn-group dropstart" role="group">
    -    <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    -      Dropdown
    -    </button>
    -    <ul class="dropdown-menu">
    -      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    -      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    -    </ul>
    -  </div>
    -  <div class="btn-group dropend" role="group">
    -    <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    -      Dropdown
    -    </button>
    -    <ul class="dropdown-menu">
    -      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    -      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    -    </ul>
    -  </div>
    -  <div class="btn-group dropup" role="group">
    -    <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    -      Dropdown
    -    </button>
    -    <ul class="dropdown-menu">
    -      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    -      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    -    </ul>
    -  </div>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="btn-group-vertical" role="group" aria-label="Vertical button group">
    +  <div class="btn-group" role="group">
    +    <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    +      Dropdown
    +    </button>
    +    <ul class="dropdown-menu">
    +      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    +      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    +    </ul>
    +  </div>
    +  <button type="button" class="btn btn-primary">Button</button>
    +  <button type="button" class="btn btn-primary">Button</button>
    +  <div class="btn-group dropstart" role="group">
    +    <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    +      Dropdown
    +    </button>
    +    <ul class="dropdown-menu">
    +      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    +      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    +    </ul>
    +  </div>
    +  <div class="btn-group dropend" role="group">
    +    <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    +      Dropdown
    +    </button>
    +    <ul class="dropdown-menu">
    +      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    +      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    +    </ul>
    +  </div>
    +  <div class="btn-group dropup" role="group">
    +    <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    +      Dropdown
    +    </button>
    +    <ul class="dropdown-menu">
    +      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    +      <li><a class="dropdown-item" href="#">Dropdown link</a></li>
    +    </ul>
    +  </div>
    +</div>
    +
    -
    - -
    - html -
    - - -
    -
    <div class="btn-group-vertical" role="group" aria-label="Vertical radio toggle button group">
    -  <input type="radio" class="btn-check" name="vbtn-radio" id="vbtn-radio1" autocomplete="off" checked>
    -  <label class="btn btn-outline-danger" for="vbtn-radio1">Radio 1</label>
    -  <input type="radio" class="btn-check" name="vbtn-radio" id="vbtn-radio2" autocomplete="off">
    -  <label class="btn btn-outline-danger" for="vbtn-radio2">Radio 2</label>
    -  <input type="radio" class="btn-check" name="vbtn-radio" id="vbtn-radio3" autocomplete="off">
    -  <label class="btn btn-outline-danger" for="vbtn-radio3">Radio 3</label>
    -</div>
    -
    - - -
    -
    -
    - - - - - - - - - - - - - - - +
    html
    <div class="btn-group-vertical" role="group" aria-label="Vertical radio toggle button group">
    +  <input type="radio" class="btn-check" name="vbtn-radio" id="vbtn-radio1" autocomplete="off" checked>
    +  <label class="btn btn-outline-danger" for="vbtn-radio1">Radio 1</label>
    +  <input type="radio" class="btn-check" name="vbtn-radio" id="vbtn-radio2" autocomplete="off">
    +  <label class="btn btn-outline-danger" for="vbtn-radio2">Radio 2</label>
    +  <input type="radio" class="btn-check" name="vbtn-radio" id="vbtn-radio3" autocomplete="off">
    +  <label class="btn btn-outline-danger" for="vbtn-radio3">Radio 3</label>
    +</div>
    \ No newline at end of file diff --git a/docs/5.3/components/buttons/index.html b/docs/5.3/components/buttons/index.html index d3bb8fb2e0..d2eb940a97 100644 --- a/docs/5.3/components/buttons/index.html +++ b/docs/5.3/components/buttons/index.html @@ -1,616 +1,34 @@ - - - - - - - - - - - - - - - - -Buttons · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Buttons

    -
    -

    Use Bootstrap’s custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.

    - - -
    - - - - - -
    - - -

    Base class

    + Buttons · Bootstrap v5.3

    Use Bootstrap’s custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.

    +

    Base class

    Bootstrap has a base .btn class that sets up basic styles such as padding and content alignment. By default, .btn controls have a transparent border and background color, and lack any explicit focus and hover styles.

    -
    -
    - - - -
    - html -
    - - -
    -
    <button type="button" class="btn">Base class</button>
    -
    - +
    html
    <button type="button" class="btn">Base class</button>

    The .btn class is intended to be used in conjunction with our button variants, or to serve as a basis for your own custom styles.

    -
    -If you are using the .btn class on its own, remember to at least define some explicit :focus and/or :focus-visible styles. -
    - -

    Variants

    +

    If you are using the .btn class on its own, remember to at least define some explicit :focus and/or :focus-visible styles.

    +

    Variants

    Bootstrap includes several button variants, each serving its own semantic purpose, with a few extras thrown in for more control.

    -
    -
    - - - +
    @@ -619,359 +37,128 @@ If you are using the .btn class on its own, remember to at least de - +
    html
    <button type="button" class="btn btn-primary">Primary</button>
    +<button type="button" class="btn btn-secondary">Secondary</button>
    +<button type="button" class="btn btn-success">Success</button>
    +<button type="button" class="btn btn-danger">Danger</button>
    +<button type="button" class="btn btn-warning">Warning</button>
    +<button type="button" class="btn btn-info">Info</button>
    +<button type="button" class="btn btn-light">Light</button>
    +<button type="button" class="btn btn-dark">Dark</button>
     
    -  
    - html -
    - - -
    -
    <button type="button" class="btn btn-primary">Primary</button>
    -<button type="button" class="btn btn-secondary">Secondary</button>
    -<button type="button" class="btn btn-success">Success</button>
    -<button type="button" class="btn btn-danger">Danger</button>
    -<button type="button" class="btn btn-warning">Warning</button>
    -<button type="button" class="btn btn-info">Info</button>
    -<button type="button" class="btn btn-light">Light</button>
    -<button type="button" class="btn btn-dark">Dark</button>
    -
    -<button type="button" class="btn btn-link">Link</button>
    -
    - -
    -Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class. -
    - -

    Disable text wrapping

    -

    If you don’t want the button text to wrap, you can add the .text-nowrap class to the button. In Sass, you can set $btn-white-space: nowrap to disable text wrapping for each button.

    -

    Button tags

    +<button type="button" class="btn btn-link">Link</button>
    +

    Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class.

    +

    Disable text wrapping

    +

    If you don’t want the button text to wrap, you can add the .text-nowrap class to the button. In Sass, you can set $btn-white-space: nowrap to disable text wrapping for each button.

    +

    Button tags

    The .btn classes are designed to be used with the <button> element. However, you can also use these classes on <a> or <input> elements (though some browsers may apply a slightly different rendering).

    When using button classes on <a> elements that are used to trigger in-page functionality (like collapsing content), rather than linking to new pages or sections within the current page, these links should be given a role="button" to appropriately convey their purpose to assistive technologies such as screen readers.

    -
    -
    - -Link +
    Link - - -
    - html -
    - - -
    -
    <a class="btn btn-primary" href="#" role="button">Link</a>
    -<button class="btn btn-primary" type="submit">Button</button>
    -<input class="btn btn-primary" type="button" value="Input">
    -<input class="btn btn-primary" type="submit" value="Submit">
    -<input class="btn btn-primary" type="reset" value="Reset">
    -
    - -

    Outline buttons

    +
    html
    <a class="btn btn-primary" href="#" role="button">Link</a>
    +<button class="btn btn-primary" type="submit">Button</button>
    +<input class="btn btn-primary" type="button" value="Input">
    +<input class="btn btn-primary" type="submit" value="Submit">
    +<input class="btn btn-primary" type="reset" value="Reset">
    +

    Outline buttons

    In need of a button, but not the hefty background colors they bring? Replace the default modifier classes with the .btn-outline-* ones to remove all background images and colors on any button.

    -
    -
    - - - +
    - - -
    - html -
    - - -
    -
    <button type="button" class="btn btn-outline-primary">Primary</button>
    -<button type="button" class="btn btn-outline-secondary">Secondary</button>
    -<button type="button" class="btn btn-outline-success">Success</button>
    -<button type="button" class="btn btn-outline-danger">Danger</button>
    -<button type="button" class="btn btn-outline-warning">Warning</button>
    -<button type="button" class="btn btn-outline-info">Info</button>
    -<button type="button" class="btn btn-outline-light">Light</button>
    -<button type="button" class="btn btn-outline-dark">Dark</button>
    -
    - -
    -Some of the button styles use a relatively light foreground color, and should only be used on a dark background in order to have sufficient contrast. -
    - -

    Sizes

    +
    html
    <button type="button" class="btn btn-outline-primary">Primary</button>
    +<button type="button" class="btn btn-outline-secondary">Secondary</button>
    +<button type="button" class="btn btn-outline-success">Success</button>
    +<button type="button" class="btn btn-outline-danger">Danger</button>
    +<button type="button" class="btn btn-outline-warning">Warning</button>
    +<button type="button" class="btn btn-outline-info">Info</button>
    +<button type="button" class="btn btn-outline-light">Light</button>
    +<button type="button" class="btn btn-outline-dark">Dark</button>
    +

    Some of the button styles use a relatively light foreground color, and should only be used on a dark background in order to have sufficient contrast.

    +

    Sizes

    Fancy larger or smaller buttons? Add .btn-lg or .btn-sm for additional sizes.

    -
    -
    - - - - -
    - html -
    - - -
    -
    <button type="button" class="btn btn-primary btn-lg">Large button</button>
    -<button type="button" class="btn btn-secondary btn-lg">Large button</button>
    -
    - -
    -
    - - - - -
    - html -
    - - -
    -
    <button type="button" class="btn btn-primary btn-sm">Small button</button>
    -<button type="button" class="btn btn-secondary btn-sm">Small button</button>
    -
    - +
    +
    html
    <button type="button" class="btn btn-primary btn-lg">Large button</button>
    +<button type="button" class="btn btn-secondary btn-lg">Large button</button>
    +
    +
    html
    <button type="button" class="btn btn-primary btn-sm">Small button</button>
    +<button type="button" class="btn btn-secondary btn-sm">Small button</button>

    You can even roll your own custom sizing with CSS variables:

    -
    -
    - - - -
    - html -
    - - -
    -
    <button type="button" class="btn btn-primary"
    -        style="--bs-btn-padding-y: .25rem; --bs-btn-padding-x: .5rem; --bs-btn-font-size: .75rem;">
    -  Custom button
    -</button>
    -
    - -

    Disabled state

    +
    html
    <button type="button" class="btn btn-primary"
    +        style="--bs-btn-padding-y: .25rem; --bs-btn-padding-x: .5rem; --bs-btn-font-size: .75rem;">
    +  Custom button
    +</button>
    +

    Disabled state

    Make buttons look inactive by adding the disabled boolean attribute to any <button> element. Disabled buttons have pointer-events: none applied to, preventing hover and active states from triggering.

    -
    -
    - - +
    - - -
    - html -
    - - -
    -
    <button type="button" class="btn btn-primary" disabled>Primary button</button>
    -<button type="button" class="btn btn-secondary" disabled>Button</button>
    -<button type="button" class="btn btn-outline-primary" disabled>Primary button</button>
    -<button type="button" class="btn btn-outline-secondary" disabled>Button</button>
    -
    - +
    html
    <button type="button" class="btn btn-primary" disabled>Primary button</button>
    +<button type="button" class="btn btn-secondary" disabled>Button</button>
    +<button type="button" class="btn btn-outline-primary" disabled>Primary button</button>
    +<button type="button" class="btn btn-outline-secondary" disabled>Button</button>

    Disabled buttons using the <a> element behave a bit different:

      -
    • <a>s don’t support the disabled attribute, so you must add the .disabled class to make it visually appear disabled.
    • +
    • <a>s don’t support the disabled attribute, so you must add the .disabled class to make it visually appear disabled.
    • Some future-friendly styles are included to disable all pointer-events on anchor buttons.
    • Disabled buttons using <a> should include the aria-disabled="true" attribute to indicate the state of the element to assistive technologies.
    • Disabled buttons using <a> should not include the href attribute.
    -
    -
    - -Primary link -Link - -
    - html -
    - - -
    -
    <a class="btn btn-primary disabled" role="button" aria-disabled="true">Primary link</a>
    -<a class="btn btn-secondary disabled" role="button" aria-disabled="true">Link</a>
    -
    - - +
    html
    <a class="btn btn-primary disabled" role="button" aria-disabled="true">Primary link</a>
    +<a class="btn btn-secondary disabled" role="button" aria-disabled="true">Link</a>
    +

    To cover cases where you have to keep the href attribute on a disabled link, the .disabled class uses pointer-events: none to try to disable the link functionality of <a>s. Note that this CSS property is not yet standardized for HTML, but all modern browsers support it. In addition, even in browsers that do support pointer-events: none, keyboard navigation remains unaffected, meaning that sighted keyboard users and users of assistive technologies will still be able to activate these links. So to be safe, in addition to aria-disabled="true", also include a tabindex="-1" attribute on these links to prevent them from receiving keyboard focus, and use custom JavaScript to disable their functionality altogether.

    -
    -
    - -Primary link -Link - -
    - html -
    - - -
    -
    <a href="#" class="btn btn-primary disabled" tabindex="-1" role="button" aria-disabled="true">Primary link</a>
    -<a href="#" class="btn btn-secondary disabled" tabindex="-1" role="button" aria-disabled="true">Link</a>
    -
    - -

    Block buttons

    -

    Create responsive stacks of full-width, “block buttons” like those in Bootstrap 4 with a mix of our display and gap utilities. By using utilities instead of button-specific classes, we have much greater control over spacing, alignment, and responsive behaviors.

    -
    -
    - -
    +
    html
    <a href="#" class="btn btn-primary disabled" tabindex="-1" role="button" aria-disabled="true">Primary link</a>
    +<a href="#" class="btn btn-secondary disabled" tabindex="-1" role="button" aria-disabled="true">Link</a>
    +

    Block buttons

    +

    Create responsive stacks of full-width, “block buttons” like those in Bootstrap 4 with a mix of our display and gap utilities. By using utilities instead of button-specific classes, we have much greater control over spacing, alignment, and responsive behaviors.

    +
    -
    - -
    - html -
    - - -
    -
    <div class="d-grid gap-2">
    -  <button class="btn btn-primary" type="button">Button</button>
    -  <button class="btn btn-primary" type="button">Button</button>
    -</div>
    -
    - +
    html
    <div class="d-grid gap-2">
    +  <button class="btn btn-primary" type="button">Button</button>
    +  <button class="btn btn-primary" type="button">Button</button>
    +</div>

    Here we create a responsive variation, starting with vertically stacked buttons until the md breakpoint, where .d-md-block replaces the .d-grid class, thus nullifying the gap-2 utility. Resize your browser to see them change.

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="d-grid gap-2 d-md-block">
    -  <button class="btn btn-primary" type="button">Button</button>
    -  <button class="btn btn-primary" type="button">Button</button>
    -</div>
    -
    - -

    You can adjust the width of your block buttons with grid column width classes. For example, for a half-width “block button”, use .col-6. Center it horizontally with .mx-auto, too.

    -
    -
    - -
    +
    html
    <div class="d-grid gap-2 d-md-block">
    +  <button class="btn btn-primary" type="button">Button</button>
    +  <button class="btn btn-primary" type="button">Button</button>
    +</div>
    +

    You can adjust the width of your block buttons with grid column width classes. For example, for a half-width “block button”, use .col-6. Center it horizontally with .mx-auto, too.

    +
    -
    - -
    - html -
    - - -
    -
    <div class="d-grid gap-2 col-6 mx-auto">
    -  <button class="btn btn-primary" type="button">Button</button>
    -  <button class="btn btn-primary" type="button">Button</button>
    -</div>
    -
    - -

    Additional utilities can be used to adjust the alignment of buttons when horizontal. Here we’ve taken our previous responsive example and added some flex utilities and a margin utility on the button to right-align the buttons when they’re no longer stacked.

    -
    -
    - -
    +
    html
    <div class="d-grid gap-2 col-6 mx-auto">
    +  <button class="btn btn-primary" type="button">Button</button>
    +  <button class="btn btn-primary" type="button">Button</button>
    +</div>
    +

    Additional utilities can be used to adjust the alignment of buttons when horizontal. Here we’ve taken our previous responsive example and added some flex utilities and a margin utility on the button to right-align the buttons when they’re no longer stacked.

    +
    -
    - -
    - html -
    - - -
    -
    <div class="d-grid gap-2 d-md-flex justify-content-md-end">
    -  <button class="btn btn-primary me-md-2" type="button">Button</button>
    -  <button class="btn btn-primary" type="button">Button</button>
    -</div>
    -
    - -

    Button plugin

    +
    html
    <div class="d-grid gap-2 d-md-flex justify-content-md-end">
    +  <button class="btn btn-primary me-md-2" type="button">Button</button>
    +  <button class="btn btn-primary" type="button">Button</button>
    +</div>
    +

    Button plugin

    The button plugin allows you to create simple on/off toggle buttons.

    -
    -Visually, these toggle buttons are identical to the checkbox toggle buttons. However, they are conveyed differently by assistive technologies: the checkbox toggles will be announced by screen readers as “checked”/“not checked” (since, despite their appearance, they are fundamentally still checkboxes), whereas these toggle buttons will be announced as “button”/“button pressed”. The choice between these two approaches will depend on the type of toggle you are creating, and whether or not the toggle will make sense to users when announced as a checkbox or as an actual button. -
    - -

    Toggle states

    -

    Add data-bs-toggle="button" to toggle a button’s active state. If you’re pre-toggling a button, you must manually add the .active class and aria-pressed="true" to ensure that it is conveyed appropriately to assistive technologies.

    -
    -
    - -

    +

    Visually, these toggle buttons are identical to the checkbox toggle buttons. However, they are conveyed differently by assistive technologies: the checkbox toggles will be announced by screen readers as “checked”/“not checked” (since, despite their appearance, they are fundamentally still checkboxes), whereas these toggle buttons will be announced as “button”/“button pressed”. The choice between these two approaches will depend on the type of toggle you are creating, and whether or not the toggle will make sense to users when announced as a checkbox or as an actual button.

    +

    Toggle states

    +

    Add data-bs-toggle="button" to toggle a button’s active state. If you’re pre-toggling a button, you must manually add the .active class and aria-pressed="true" to ensure that it is conveyed appropriately to assistive technologies.

    + - -
    -
    - -

    +

    html
    <p class="d-inline-flex gap-1">
    +  <button type="button" class="btn" data-bs-toggle="button">Toggle button</button>
    +  <button type="button" class="btn active" data-bs-toggle="button" aria-pressed="true">Active toggle button</button>
    +  <button type="button" class="btn" disabled data-bs-toggle="button">Disabled toggle button</button>
    +</p>
    +<p class="d-inline-flex gap-1">
    +  <button type="button" class="btn btn-primary" data-bs-toggle="button">Toggle button</button>
    +  <button type="button" class="btn btn-primary active" data-bs-toggle="button" aria-pressed="true">Active toggle button</button>
    +  <button type="button" class="btn btn-primary" disabled data-bs-toggle="button">Disabled toggle button</button>
    +</p>
    +

    Toggle link Active toggle link Disabled toggle link @@ -1016,377 +186,233 @@ Visually, these toggle buttons are identical to the Toggle link Active toggle link Disabled toggle link -

    - -
    - html -
    - - -
    -
    <p class="d-inline-flex gap-1">
    -  <a href="#" class="btn" role="button" data-bs-toggle="button">Toggle link</a>
    -  <a href="#" class="btn active" role="button" data-bs-toggle="button" aria-pressed="true">Active toggle link</a>
    -  <a class="btn disabled" aria-disabled="true" role="button" data-bs-toggle="button">Disabled toggle link</a>
    -</p>
    -<p class="d-inline-flex gap-1">
    -  <a href="#" class="btn btn-primary" role="button" data-bs-toggle="button">Toggle link</a>
    -  <a href="#" class="btn btn-primary active" role="button" data-bs-toggle="button" aria-pressed="true">Active toggle link</a>
    -  <a class="btn btn-primary disabled" aria-disabled="true" role="button" data-bs-toggle="button">Disabled toggle link</a>
    -</p>
    -
    - -

    Methods

    +

    html
    <p class="d-inline-flex gap-1">
    +  <a href="#" class="btn" role="button" data-bs-toggle="button">Toggle link</a>
    +  <a href="#" class="btn active" role="button" data-bs-toggle="button" aria-pressed="true">Active toggle link</a>
    +  <a class="btn disabled" aria-disabled="true" role="button" data-bs-toggle="button">Disabled toggle link</a>
    +</p>
    +<p class="d-inline-flex gap-1">
    +  <a href="#" class="btn btn-primary" role="button" data-bs-toggle="button">Toggle link</a>
    +  <a href="#" class="btn btn-primary active" role="button" data-bs-toggle="button" aria-pressed="true">Active toggle link</a>
    +  <a class="btn btn-primary disabled" aria-disabled="true" role="button" data-bs-toggle="button">Disabled toggle link</a>
    +</p>
    +

    Methods

    You can create a button instance with the button constructor, for example:

    -
    const bsButton = new bootstrap.Button('#myButton')
    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    MethodDescription
    disposeDestroys an element’s button. (Removes stored data on the DOM element)
    getInstanceStatic method which allows you to get the button instance associated with a DOM element, you can use it like this: bootstrap.Button.getInstance(element).
    getOrCreateInstanceStatic method which returns a button instance associated with a DOM element or creates a new one in case it wasn’t initialized. You can use it like this: bootstrap.Button.getOrCreateInstance(element).
    toggleToggles push state. Gives the button the appearance that it has been activated.
    +
    const bsButton = new bootstrap.Button('#myButton')
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + +
    MethodDescription
    disposeDestroys an element’s button. (Removes stored data on the DOM element)
    getInstanceStatic method which allows you to get the button instance associated with a DOM element, you can use it like this: bootstrap.Button.getInstance(element).
    getOrCreateInstanceStatic method which returns a button instance associated with a DOM element or creates a new one in case it wasn’t initialized. You can use it like this: bootstrap.Button.getOrCreateInstance(element).
    toggleToggles push state. Gives the button the appearance that it has been activated.

    For example, to toggle all buttons

    -
    document.querySelectorAll('.btn').forEach(buttonElement => {
    -  const button = bootstrap.Button.getOrCreateInstance(buttonElement)
    -  button.toggle()
    -})
    -

    CSS

    -

    Variables

    +
    document.querySelectorAll('.btn').forEach(buttonElement => {
    +  const button = bootstrap.Button.getOrCreateInstance(buttonElement)
    +  button.toggle()
    +})
    +
    +

    CSS

    +

    Variables

    Added in v5.2.0 - -

    As part of Bootstrap’s evolving CSS variables approach, buttons now use local CSS variables on .btn for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    -
    -
    - scss/_buttons.scss -
    - -
    -
    --#{$prefix}btn-padding-x: #{$btn-padding-x};
    ---#{$prefix}btn-padding-y: #{$btn-padding-y};
    ---#{$prefix}btn-font-family: #{$btn-font-family};
    -@include rfs($btn-font-size, --#{$prefix}btn-font-size);
    ---#{$prefix}btn-font-weight: #{$btn-font-weight};
    ---#{$prefix}btn-line-height: #{$btn-line-height};
    ---#{$prefix}btn-color: #{$btn-color};
    ---#{$prefix}btn-bg: transparent;
    ---#{$prefix}btn-border-width: #{$btn-border-width};
    ---#{$prefix}btn-border-color: transparent;
    ---#{$prefix}btn-border-radius: #{$btn-border-radius};
    ---#{$prefix}btn-hover-border-color: transparent;
    ---#{$prefix}btn-box-shadow: #{$btn-box-shadow};
    ---#{$prefix}btn-disabled-opacity: #{$btn-disabled-opacity};
    ---#{$prefix}btn-focus-box-shadow: 0 0 0 #{$btn-focus-width} rgba(var(--#{$prefix}btn-focus-shadow-rgb), .5);
    +

    As part of Bootstrap’s evolving CSS variables approach, buttons now use local CSS variables on .btn for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    +
    --#{$prefix}btn-padding-x: #{$btn-padding-x};
    +--#{$prefix}btn-padding-y: #{$btn-padding-y};
    +--#{$prefix}btn-font-family: #{$btn-font-family};
    +@include rfs($btn-font-size, --#{$prefix}btn-font-size);
    +--#{$prefix}btn-font-weight: #{$btn-font-weight};
    +--#{$prefix}btn-line-height: #{$btn-line-height};
    +--#{$prefix}btn-color: #{$btn-color};
    +--#{$prefix}btn-bg: transparent;
    +--#{$prefix}btn-border-width: #{$btn-border-width};
    +--#{$prefix}btn-border-color: transparent;
    +--#{$prefix}btn-border-radius: #{$btn-border-radius};
    +--#{$prefix}btn-hover-border-color: transparent;
    +--#{$prefix}btn-box-shadow: #{$btn-box-shadow};
    +--#{$prefix}btn-disabled-opacity: #{$btn-disabled-opacity};
    +--#{$prefix}btn-focus-box-shadow: 0 0 0 #{$btn-focus-width} rgba(var(--#{$prefix}btn-focus-shadow-rgb), .5);
    +

    Each .btn-* modifier class updates the appropriate CSS variables to minimize additional CSS rules with our button-variant(), button-outline-variant(), and button-size() mixins.

    -

    Here’s an example of building a custom .btn-* modifier class as we do for the buttons unique to our docs by reassigning Bootstrap’s CSS variables with a mixture of our own CSS and Sass variables.

    -
    - -
    -
    -
    .btn-bd-primary {
    -  --bs-btn-font-weight: 600;
    -  --bs-btn-color: var(--bs-white);
    -  --bs-btn-bg: var(--bd-violet-bg);
    -  --bs-btn-border-color: var(--bd-violet-bg);
    -  --bs-btn-hover-color: var(--bs-white);
    -  --bs-btn-hover-bg: #{shade-color($bd-violet, 10%)};
    -  --bs-btn-hover-border-color: #{shade-color($bd-violet, 10%)};
    -  --bs-btn-focus-shadow-rgb: var(--bd-violet-rgb);
    -  --bs-btn-active-color: var(--bs-btn-hover-color);
    -  --bs-btn-active-bg: #{shade-color($bd-violet, 20%)};
    -  --bs-btn-active-border-color: #{shade-color($bd-violet, 20%)};
    -}
    -
    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $btn-color:                   var(--#{$prefix}body-color);
    -$btn-padding-y:               $input-btn-padding-y;
    -$btn-padding-x:               $input-btn-padding-x;
    -$btn-font-family:             $input-btn-font-family;
    -$btn-font-size:               $input-btn-font-size;
    -$btn-line-height:             $input-btn-line-height;
    -$btn-white-space:             null; // Set to `nowrap` to prevent text wrapping
    -
    -$btn-padding-y-sm:            $input-btn-padding-y-sm;
    -$btn-padding-x-sm:            $input-btn-padding-x-sm;
    -$btn-font-size-sm:            $input-btn-font-size-sm;
    -
    -$btn-padding-y-lg:            $input-btn-padding-y-lg;
    -$btn-padding-x-lg:            $input-btn-padding-x-lg;
    -$btn-font-size-lg:            $input-btn-font-size-lg;
    -
    -$btn-border-width:            $input-btn-border-width;
    -
    -$btn-font-weight:             $font-weight-normal;
    -$btn-box-shadow:              inset 0 1px 0 rgba($white, .15), 0 1px 1px rgba($black, .075);
    -$btn-focus-width:             $input-btn-focus-width;
    -$btn-focus-box-shadow:        $input-btn-focus-box-shadow;
    -$btn-disabled-opacity:        .65;
    -$btn-active-box-shadow:       inset 0 3px 5px rgba($black, .125);
    -
    -$btn-link-color:              var(--#{$prefix}link-color);
    -$btn-link-hover-color:        var(--#{$prefix}link-hover-color);
    -$btn-link-disabled-color:     $gray-600;
    -$btn-link-focus-shadow-rgb:   to-rgb(mix(color-contrast($link-color), $link-color, 15%));
    -
    -// Allows for customizing button radius independently from global border radius
    -$btn-border-radius:           var(--#{$prefix}border-radius);
    -$btn-border-radius-sm:        var(--#{$prefix}border-radius-sm);
    -$btn-border-radius-lg:        var(--#{$prefix}border-radius-lg);
    -
    -$btn-transition:              color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    -
    -$btn-hover-bg-shade-amount:       15%;
    -$btn-hover-bg-tint-amount:        15%;
    -$btn-hover-border-shade-amount:   20%;
    -$btn-hover-border-tint-amount:    10%;
    -$btn-active-bg-shade-amount:      20%;
    -$btn-active-bg-tint-amount:       20%;
    -$btn-active-border-shade-amount:  25%;
    -$btn-active-border-tint-amount:   10%;
    -
    -

    Sass mixins

    +

    Here’s an example of building a custom .btn-* modifier class as we do for the buttons unique to our docs by reassigning Bootstrap’s CSS variables with a mixture of our own CSS and Sass variables.

    +
    +
    .btn-bd-primary {
    +  --bs-btn-font-weight: 600;
    +  --bs-btn-color: var(--bs-white);
    +  --bs-btn-bg: var(--bd-violet-bg);
    +  --bs-btn-border-color: var(--bd-violet-bg);
    +  --bs-btn-hover-color: var(--bs-white);
    +  --bs-btn-hover-bg: #{shade-color($bd-violet, 10%)};
    +  --bs-btn-hover-border-color: #{shade-color($bd-violet, 10%)};
    +  --bs-btn-focus-shadow-rgb: var(--bd-violet-rgb);
    +  --bs-btn-active-color: var(--bs-btn-hover-color);
    +  --bs-btn-active-bg: #{shade-color($bd-violet, 20%)};
    +  --bs-btn-active-border-color: #{shade-color($bd-violet, 20%)};
    +}
    +
    +

    Sass variables

    +
    $btn-color:                   var(--#{$prefix}body-color);
    +$btn-padding-y:               $input-btn-padding-y;
    +$btn-padding-x:               $input-btn-padding-x;
    +$btn-font-family:             $input-btn-font-family;
    +$btn-font-size:               $input-btn-font-size;
    +$btn-line-height:             $input-btn-line-height;
    +$btn-white-space:             null; // Set to `nowrap` to prevent text wrapping
    +
    +$btn-padding-y-sm:            $input-btn-padding-y-sm;
    +$btn-padding-x-sm:            $input-btn-padding-x-sm;
    +$btn-font-size-sm:            $input-btn-font-size-sm;
    +
    +$btn-padding-y-lg:            $input-btn-padding-y-lg;
    +$btn-padding-x-lg:            $input-btn-padding-x-lg;
    +$btn-font-size-lg:            $input-btn-font-size-lg;
    +
    +$btn-border-width:            $input-btn-border-width;
    +
    +$btn-font-weight:             $font-weight-normal;
    +$btn-box-shadow:              inset 0 1px 0 rgba($white, .15), 0 1px 1px rgba($black, .075);
    +$btn-focus-width:             $input-btn-focus-width;
    +$btn-focus-box-shadow:        $input-btn-focus-box-shadow;
    +$btn-disabled-opacity:        .65;
    +$btn-active-box-shadow:       inset 0 3px 5px rgba($black, .125);
    +
    +$btn-link-color:              var(--#{$prefix}link-color);
    +$btn-link-hover-color:        var(--#{$prefix}link-hover-color);
    +$btn-link-disabled-color:     $gray-600;
    +$btn-link-focus-shadow-rgb:   to-rgb(mix(color-contrast($link-color), $link-color, 15%));
    +
    +// Allows for customizing button radius independently from global border radius
    +$btn-border-radius:           var(--#{$prefix}border-radius);
    +$btn-border-radius-sm:        var(--#{$prefix}border-radius-sm);
    +$btn-border-radius-lg:        var(--#{$prefix}border-radius-lg);
    +
    +$btn-transition:              color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    +
    +$btn-hover-bg-shade-amount:       15%;
    +$btn-hover-bg-tint-amount:        15%;
    +$btn-hover-border-shade-amount:   20%;
    +$btn-hover-border-tint-amount:    10%;
    +$btn-active-bg-shade-amount:      20%;
    +$btn-active-bg-tint-amount:       20%;
    +$btn-active-border-shade-amount:  25%;
    +$btn-active-border-tint-amount:   10%;
    +
    +

    Sass mixins

    There are three mixins for buttons: button and button outline variant mixins (both based on $theme-colors), plus a button size mixin.

    -
    -
    @mixin button-variant(
    -  $background,
    -  $border,
    -  $color: color-contrast($background),
    -  $hover-background: if($color == $color-contrast-light, shade-color($background, $btn-hover-bg-shade-amount), tint-color($background, $btn-hover-bg-tint-amount)),
    -  $hover-border: if($color == $color-contrast-light, shade-color($border, $btn-hover-border-shade-amount), tint-color($border, $btn-hover-border-tint-amount)),
    -  $hover-color: color-contrast($hover-background),
    -  $active-background: if($color == $color-contrast-light, shade-color($background, $btn-active-bg-shade-amount), tint-color($background, $btn-active-bg-tint-amount)),
    -  $active-border: if($color == $color-contrast-light, shade-color($border, $btn-active-border-shade-amount), tint-color($border, $btn-active-border-tint-amount)),
    -  $active-color: color-contrast($active-background),
    -  $disabled-background: $background,
    -  $disabled-border: $border,
    -  $disabled-color: color-contrast($disabled-background)
    -) {
    -  --#{$prefix}btn-color: #{$color};
    -  --#{$prefix}btn-bg: #{$background};
    -  --#{$prefix}btn-border-color: #{$border};
    -  --#{$prefix}btn-hover-color: #{$hover-color};
    -  --#{$prefix}btn-hover-bg: #{$hover-background};
    -  --#{$prefix}btn-hover-border-color: #{$hover-border};
    -  --#{$prefix}btn-focus-shadow-rgb: #{to-rgb(mix($color, $border, 15%))};
    -  --#{$prefix}btn-active-color: #{$active-color};
    -  --#{$prefix}btn-active-bg: #{$active-background};
    -  --#{$prefix}btn-active-border-color: #{$active-border};
    -  --#{$prefix}btn-active-shadow: #{$btn-active-box-shadow};
    -  --#{$prefix}btn-disabled-color: #{$disabled-color};
    -  --#{$prefix}btn-disabled-bg: #{$disabled-background};
    -  --#{$prefix}btn-disabled-border-color: #{$disabled-border};
    -}
    -
    -
    -
    @mixin button-outline-variant(
    -  $color,
    -  $color-hover: color-contrast($color),
    -  $active-background: $color,
    -  $active-border: $color,
    -  $active-color: color-contrast($active-background)
    -) {
    -  --#{$prefix}btn-color: #{$color};
    -  --#{$prefix}btn-border-color: #{$color};
    -  --#{$prefix}btn-hover-color: #{$color-hover};
    -  --#{$prefix}btn-hover-bg: #{$active-background};
    -  --#{$prefix}btn-hover-border-color: #{$active-border};
    -  --#{$prefix}btn-focus-shadow-rgb: #{to-rgb($color)};
    -  --#{$prefix}btn-active-color: #{$active-color};
    -  --#{$prefix}btn-active-bg: #{$active-background};
    -  --#{$prefix}btn-active-border-color: #{$active-border};
    -  --#{$prefix}btn-active-shadow: #{$btn-active-box-shadow};
    -  --#{$prefix}btn-disabled-color: #{$color};
    -  --#{$prefix}btn-disabled-bg: transparent;
    -  --#{$prefix}btn-disabled-border-color: #{$color};
    -  --#{$prefix}gradient: none;
    -}
    -
    -
    -
    @mixin button-size($padding-y, $padding-x, $font-size, $border-radius) {
    -  --#{$prefix}btn-padding-y: #{$padding-y};
    -  --#{$prefix}btn-padding-x: #{$padding-x};
    -  @include rfs($font-size, --#{$prefix}btn-font-size);
    -  --#{$prefix}btn-border-radius: #{$border-radius};
    -}
    -
    -

    Sass loops

    +
    @mixin button-variant(
    +  $background,
    +  $border,
    +  $color: color-contrast($background),
    +  $hover-background: if($color == $color-contrast-light, shade-color($background, $btn-hover-bg-shade-amount), tint-color($background, $btn-hover-bg-tint-amount)),
    +  $hover-border: if($color == $color-contrast-light, shade-color($border, $btn-hover-border-shade-amount), tint-color($border, $btn-hover-border-tint-amount)),
    +  $hover-color: color-contrast($hover-background),
    +  $active-background: if($color == $color-contrast-light, shade-color($background, $btn-active-bg-shade-amount), tint-color($background, $btn-active-bg-tint-amount)),
    +  $active-border: if($color == $color-contrast-light, shade-color($border, $btn-active-border-shade-amount), tint-color($border, $btn-active-border-tint-amount)),
    +  $active-color: color-contrast($active-background),
    +  $disabled-background: $background,
    +  $disabled-border: $border,
    +  $disabled-color: color-contrast($disabled-background)
    +) {
    +  --#{$prefix}btn-color: #{$color};
    +  --#{$prefix}btn-bg: #{$background};
    +  --#{$prefix}btn-border-color: #{$border};
    +  --#{$prefix}btn-hover-color: #{$hover-color};
    +  --#{$prefix}btn-hover-bg: #{$hover-background};
    +  --#{$prefix}btn-hover-border-color: #{$hover-border};
    +  --#{$prefix}btn-focus-shadow-rgb: #{to-rgb(mix($color, $border, 15%))};
    +  --#{$prefix}btn-active-color: #{$active-color};
    +  --#{$prefix}btn-active-bg: #{$active-background};
    +  --#{$prefix}btn-active-border-color: #{$active-border};
    +  --#{$prefix}btn-active-shadow: #{$btn-active-box-shadow};
    +  --#{$prefix}btn-disabled-color: #{$disabled-color};
    +  --#{$prefix}btn-disabled-bg: #{$disabled-background};
    +  --#{$prefix}btn-disabled-border-color: #{$disabled-border};
    +}
    +
    +
    @mixin button-outline-variant(
    +  $color,
    +  $color-hover: color-contrast($color),
    +  $active-background: $color,
    +  $active-border: $color,
    +  $active-color: color-contrast($active-background)
    +) {
    +  --#{$prefix}btn-color: #{$color};
    +  --#{$prefix}btn-border-color: #{$color};
    +  --#{$prefix}btn-hover-color: #{$color-hover};
    +  --#{$prefix}btn-hover-bg: #{$active-background};
    +  --#{$prefix}btn-hover-border-color: #{$active-border};
    +  --#{$prefix}btn-focus-shadow-rgb: #{to-rgb($color)};
    +  --#{$prefix}btn-active-color: #{$active-color};
    +  --#{$prefix}btn-active-bg: #{$active-background};
    +  --#{$prefix}btn-active-border-color: #{$active-border};
    +  --#{$prefix}btn-active-shadow: #{$btn-active-box-shadow};
    +  --#{$prefix}btn-disabled-color: #{$color};
    +  --#{$prefix}btn-disabled-bg: transparent;
    +  --#{$prefix}btn-disabled-border-color: #{$color};
    +  --#{$prefix}gradient: none;
    +}
    +
    +
    @mixin button-size($padding-y, $padding-x, $font-size, $border-radius) {
    +  --#{$prefix}btn-padding-y: #{$padding-y};
    +  --#{$prefix}btn-padding-x: #{$padding-x};
    +  @include rfs($font-size, --#{$prefix}btn-font-size);
    +  --#{$prefix}btn-border-radius: #{$border-radius};
    +}
    +
    +

    Sass loops

    Button variants (for regular and outline buttons) use their respective mixins with our $theme-colors map to generate the modifier classes in scss/_buttons.scss.

    -
    -
    - scss/_buttons.scss -
    - -
    -
    @each $color, $value in $theme-colors {
    -  .btn-#{$color} {
    -    @if $color == "light" {
    -      @include button-variant(
    -        $value,
    -        $value,
    -        $hover-background: shade-color($value, $btn-hover-bg-shade-amount),
    -        $hover-border: shade-color($value, $btn-hover-border-shade-amount),
    -        $active-background: shade-color($value, $btn-active-bg-shade-amount),
    -        $active-border: shade-color($value, $btn-active-border-shade-amount)
    -      );
    -    } @else if $color == "dark" {
    -      @include button-variant(
    -        $value,
    -        $value,
    -        $hover-background: tint-color($value, $btn-hover-bg-tint-amount),
    -        $hover-border: tint-color($value, $btn-hover-border-tint-amount),
    -        $active-background: tint-color($value, $btn-active-bg-tint-amount),
    -        $active-border: tint-color($value, $btn-active-border-tint-amount)
    -      );
    -    } @else {
    -      @include button-variant($value, $value);
    -    }
    -  }
    -}
    -
    -@each $color, $value in $theme-colors {
    -  .btn-outline-#{$color} {
    -    @include button-outline-variant($value);
    -  }
    -}
    -
    +
    @each $color, $value in $theme-colors {
    +  .btn-#{$color} {
    +    @if $color == "light" {
    +      @include button-variant(
    +        $value,
    +        $value,
    +        $hover-background: shade-color($value, $btn-hover-bg-shade-amount),
    +        $hover-border: shade-color($value, $btn-hover-border-shade-amount),
    +        $active-background: shade-color($value, $btn-active-bg-shade-amount),
    +        $active-border: shade-color($value, $btn-active-border-shade-amount)
    +      );
    +    } @else if $color == "dark" {
    +      @include button-variant(
    +        $value,
    +        $value,
    +        $hover-background: tint-color($value, $btn-hover-bg-tint-amount),
    +        $hover-border: tint-color($value, $btn-hover-border-tint-amount),
    +        $active-background: tint-color($value, $btn-active-bg-tint-amount),
    +        $active-border: tint-color($value, $btn-active-border-tint-amount)
    +      );
    +    } @else {
    +      @include button-variant($value, $value);
    +    }
    +  }
    +}
     
    -      
    -
    -
    - - - - - - - - - - - - - - - +@each $color, $value in $theme-colors { + .btn-outline-#{$color} { + @include button-outline-variant($value); + } +} + \ No newline at end of file diff --git a/docs/5.3/components/card/index.html b/docs/5.3/components/card/index.html index 18ff17961d..e4e1325702 100644 --- a/docs/5.3/components/card/index.html +++ b/docs/5.3/components/card/index.html @@ -1,776 +1,108 @@ - - - - - - - - - - - - - - - - -Cards · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Cards

    -
    -

    Bootstrap’s cards provide a flexible and extensible content container with multiple variants and options.

    - - -
    - - - - - -
    - - -

    About

    -

    A card is a flexible and extensible content container. It includes options for headers and footers, a wide variety of content, contextual background colors, and powerful display options. If you’re familiar with Bootstrap 3, cards replace our old panels, wells, and thumbnails. Similar functionality to those components is available as modifier classes for cards.

    -

    Example

    -

    Cards are built with as little markup and styles as possible, but still manage to deliver a ton of control and customization. Built with flexbox, they offer easy alignment and mix well with other Bootstrap components. They have no margin by default, so use spacing utilities as needed.

    -

    Below is an example of a basic card with mixed content and a fixed width. Cards have no fixed width to start, so they’ll naturally fill the full width of its parent element. This is easily customized with our various sizing options.

    -
    -
    - -
    - PlaceholderImage cap + Cards · Bootstrap v5.3

    Bootstrap’s cards provide a flexible and extensible content container with multiple variants and options.

    +

    About

    +

    A card is a flexible and extensible content container. It includes options for headers and footers, a wide variety of content, contextual background colors, and powerful display options. If you’re familiar with Bootstrap 3, cards replace our old panels, wells, and thumbnails. Similar functionality to those components is available as modifier classes for cards.

    +

    Example

    +

    Cards are built with as little markup and styles as possible, but still manage to deliver a ton of control and customization. Built with flexbox, they offer easy alignment and mix well with other Bootstrap components. They have no margin by default, so use spacing utilities as needed.

    +

    Below is an example of a basic card with mixed content and a fixed width. Cards have no fixed width to start, so they’ll naturally fill the full width of its parent element. This is easily customized with our various sizing options.

    +
    + PlaceholderImage cap
    Card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Go somewhere
    -
    - -
    - html -
    - - -
    -
    <div class="card" style="width: 18rem;">
    -  <img src="..." class="card-img-top" alt="...">
    -  <div class="card-body">
    -    <h5 class="card-title">Card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -    <a href="#" class="btn btn-primary">Go somewhere</a>
    -  </div>
    -</div>
    -
    - -

    Content types

    -

    Cards support a wide variety of content, including images, text, list groups, links, and more. Below are examples of what’s supported.

    -

    Body

    +
    html
    <div class="card" style="width: 18rem;">
    +  <img src="..." class="card-img-top" alt="...">
    +  <div class="card-body">
    +    <h5 class="card-title">Card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +    <a href="#" class="btn btn-primary">Go somewhere</a>
    +  </div>
    +</div>
    +

    Content types

    +

    Cards support a wide variety of content, including images, text, list groups, links, and more. Below are examples of what’s supported.

    +

    Body

    The building block of a card is the .card-body. Use it whenever you need a padded section within a card.

    -
    -
    - -
    +
    This is some text within a card body.
    -
    - -
    - html -
    - - -
    -
    <div class="card">
    -  <div class="card-body">
    -    This is some text within a card body.
    -  </div>
    -</div>
    -
    - - +
    html
    <div class="card">
    +  <div class="card-body">
    +    This is some text within a card body.
    +  </div>
    +</div>
    +

    Card titles are used by adding .card-title to a <h*> tag. In the same way, links are added and placed next to each other by adding .card-link to an <a> tag.

    Subtitles are used by adding a .card-subtitle to a <h*> tag. If the .card-title and the .card-subtitle items are placed in a .card-body item, the card title and subtitle are aligned nicely.

    -
    -
    - -
    +
    Card title
    Card subtitle
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Card link Another link
    -
    - -
    - html -
    - - -
    -
    <div class="card" style="width: 18rem;">
    -  <div class="card-body">
    -    <h5 class="card-title">Card title</h5>
    -    <h6 class="card-subtitle mb-2 text-body-secondary">Card subtitle</h6>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -    <a href="#" class="card-link">Card link</a>
    -    <a href="#" class="card-link">Another link</a>
    -  </div>
    -</div>
    -
    - -

    Images

    -

    .card-img-top and .card-img-bottom respectively set the top and bottom corners rounded to match the card’s borders. With .card-text, text can be added to the card. Text within .card-text can also be styled with the standard HTML tags.

    -
    -
    - -
    - PlaceholderImage cap +
    html
    <div class="card" style="width: 18rem;">
    +  <div class="card-body">
    +    <h5 class="card-title">Card title</h5>
    +    <h6 class="card-subtitle mb-2 text-body-secondary">Card subtitle</h6>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +    <a href="#" class="card-link">Card link</a>
    +    <a href="#" class="card-link">Another link</a>
    +  </div>
    +</div>
    +

    Images

    +

    .card-img-top and .card-img-bottom respectively set the top and bottom corners rounded to match the card’s borders. With .card-text, text can be added to the card. Text within .card-text can also be styled with the standard HTML tags.

    +
    + PlaceholderImage cap
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    -
    - -
    - html -
    - - -
    -
    <div class="card" style="width: 18rem;">
    -  <img src="..." class="card-img-top" alt="...">
    -  <div class="card-body">
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -
    - -

    List groups

    +
    html
    <div class="card" style="width: 18rem;">
    +  <img src="..." class="card-img-top" alt="...">
    +  <div class="card-body">
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +

    List groups

    Create lists of content in a card with a flush list group.

    -
    -
    - -
    +
    • An item
    • A second item
    • A third item
    -
    - -
    - html -
    - - -
    -
    <div class="card" style="width: 18rem;">
    -  <ul class="list-group list-group-flush">
    -    <li class="list-group-item">An item</li>
    -    <li class="list-group-item">A second item</li>
    -    <li class="list-group-item">A third item</li>
    -  </ul>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="card" style="width: 18rem;">
    +  <ul class="list-group list-group-flush">
    +    <li class="list-group-item">An item</li>
    +    <li class="list-group-item">A second item</li>
    +    <li class="list-group-item">A third item</li>
    +  </ul>
    +</div>
    +
    Featured
    @@ -779,34 +111,17 @@
  • A second item
  • A third item
  • -
    - -
    - html -
    - - -
    -
    <div class="card" style="width: 18rem;">
    -  <div class="card-header">
    -    Featured
    -  </div>
    -  <ul class="list-group list-group-flush">
    -    <li class="list-group-item">An item</li>
    -    <li class="list-group-item">A second item</li>
    -    <li class="list-group-item">A third item</li>
    -  </ul>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="card" style="width: 18rem;">
    +  <div class="card-header">
    +    Featured
    +  </div>
    +  <ul class="list-group list-group-flush">
    +    <li class="list-group-item">An item</li>
    +    <li class="list-group-item">A second item</li>
    +    <li class="list-group-item">A third item</li>
    +  </ul>
    +</div>
    +
    • An item
    • A second item
    • @@ -815,40 +130,23 @@ -
    - -
    - html -
    - - -
    -
    <div class="card" style="width: 18rem;">
    -  <ul class="list-group list-group-flush">
    -    <li class="list-group-item">An item</li>
    -    <li class="list-group-item">A second item</li>
    -    <li class="list-group-item">A third item</li>
    -  </ul>
    -  <div class="card-footer">
    -    Card footer
    -  </div>
    -</div>
    -
    - -

    Kitchen sink

    +
    html
    <div class="card" style="width: 18rem;">
    +  <ul class="list-group list-group-flush">
    +    <li class="list-group-item">An item</li>
    +    <li class="list-group-item">A second item</li>
    +    <li class="list-group-item">A third item</li>
    +  </ul>
    +  <div class="card-footer">
    +    Card footer
    +  </div>
    +</div>
    +

    Kitchen sink

    Mix and match multiple content types to create the card you need, or throw everything in there. Shown below are image styles, blocks, text styles, and a list group—all wrapped in a fixed-width card.

    -
    -
    - -
    - PlaceholderImage cap +
    + PlaceholderImage cap
    Card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    -
    - -
    - html -
    - - -
    -
    <div class="card" style="width: 18rem;">
    -  <img src="..." class="card-img-top" alt="...">
    -  <div class="card-body">
    -    <h5 class="card-title">Card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -  <ul class="list-group list-group-flush">
    -    <li class="list-group-item">An item</li>
    -    <li class="list-group-item">A second item</li>
    -    <li class="list-group-item">A third item</li>
    -  </ul>
    -  <div class="card-body">
    -    <a href="#" class="card-link">Card link</a>
    -    <a href="#" class="card-link">Another link</a>
    -  </div>
    -</div>
    -
    - - +
    html
    <div class="card" style="width: 18rem;">
    +  <img src="..." class="card-img-top" alt="...">
    +  <div class="card-body">
    +    <h5 class="card-title">Card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +  <ul class="list-group list-group-flush">
    +    <li class="list-group-item">An item</li>
    +    <li class="list-group-item">A second item</li>
    +    <li class="list-group-item">A third item</li>
    +  </ul>
    +  <div class="card-body">
    +    <a href="#" class="card-link">Card link</a>
    +    <a href="#" class="card-link">Another link</a>
    +  </div>
    +</div>
    +

    Add an optional header and/or footer within a card.

    -
    -
    - -
    +
    Featured
    @@ -903,105 +184,62 @@

    With supporting text below as a natural lead-in to additional content.

    Go somewhere
    -
    - -
    - html -
    - - -
    -
    <div class="card">
    -  <div class="card-header">
    -    Featured
    -  </div>
    -  <div class="card-body">
    -    <h5 class="card-title">Special title treatment</h5>
    -    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    -    <a href="#" class="btn btn-primary">Go somewhere</a>
    -  </div>
    -</div>
    -
    - +
    html
    <div class="card">
    +  <div class="card-header">
    +    Featured
    +  </div>
    +  <div class="card-body">
    +    <h5 class="card-title">Special title treatment</h5>
    +    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    +    <a href="#" class="btn btn-primary">Go somewhere</a>
    +  </div>
    +</div>

    Card headers can be styled by adding .card-header to <h*> elements.

    -
    -
    - -
    +
    Featured
    Special title treatment

    With supporting text below as a natural lead-in to additional content.

    Go somewhere
    -
    - -
    - html -
    - - -
    -
    <div class="card">
    -  <h5 class="card-header">Featured</h5>
    -  <div class="card-body">
    -    <h5 class="card-title">Special title treatment</h5>
    -    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    -    <a href="#" class="btn btn-primary">Go somewhere</a>
    -  </div>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="card">
    +  <h5 class="card-header">Featured</h5>
    +  <div class="card-body">
    +    <h5 class="card-title">Special title treatment</h5>
    +    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    +    <a href="#" class="btn btn-primary">Go somewhere</a>
    +  </div>
    +</div>
    +
    Quote
    -
    -

    A well-known quote, contained in a blockquote element.

    -
    Someone famous in Source Title
    -
    +
    +
    +

    A well-known quote, contained in a blockquote element.

    +
    + +
    -
    - -
    - html -
    - - -
    -
    <div class="card">
    -  <div class="card-header">
    -    Quote
    -  </div>
    -  <div class="card-body">
    -    <blockquote class="blockquote mb-0">
    -      <p>A well-known quote, contained in a blockquote element.</p>
    -      <footer class="blockquote-footer">Someone famous in <cite title="Source Title">Source Title</cite></footer>
    -    </blockquote>
    -  </div>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="card">
    +  <div class="card-header">
    +    Quote
    +  </div>
    +  <div class="card-body">
    +    <figure>
    +      <blockquote class="blockquote">
    +        <p>A well-known quote, contained in a blockquote element.</p>
    +      </blockquote>
    +      <figcaption class="blockquote-footer">
    +        Someone famous in <cite title="Source Title">Source Title</cite>
    +      </figcaption>
    +    </figure>
    +  </div>
    +</div>
    +
    Featured
    @@ -1013,41 +251,24 @@ -
    - -
    - html -
    - - -
    -
    <div class="card text-center">
    -  <div class="card-header">
    -    Featured
    -  </div>
    -  <div class="card-body">
    -    <h5 class="card-title">Special title treatment</h5>
    -    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    -    <a href="#" class="btn btn-primary">Go somewhere</a>
    -  </div>
    -  <div class="card-footer text-body-secondary">
    -    2 days ago
    -  </div>
    -</div>
    -
    - -

    Sizing

    -

    Cards assume no specific width to start, so they’ll be 100% wide unless otherwise stated. You can change this as needed with custom CSS, grid classes, grid Sass mixins, or utilities.

    -

    Using grid markup

    +
    html
    <div class="card text-center">
    +  <div class="card-header">
    +    Featured
    +  </div>
    +  <div class="card-body">
    +    <h5 class="card-title">Special title treatment</h5>
    +    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    +    <a href="#" class="btn btn-primary">Go somewhere</a>
    +  </div>
    +  <div class="card-footer text-body-secondary">
    +    2 days ago
    +  </div>
    +</div>
    +

    Sizing

    +

    Cards assume no specific width to start, so they’ll be 100% wide unless otherwise stated. You can change this as needed with custom CSS, grid classes, grid Sass mixins, or utilities.

    +

    Using grid markup

    Using the grid, wrap cards in columns and rows as needed.

    -
    -
    - -
    +
    @@ -1066,46 +287,29 @@
    -
    - -
    - html -
    - - -
    -
    <div class="row">
    -  <div class="col-sm-6 mb-3 mb-sm-0">
    -    <div class="card">
    -      <div class="card-body">
    -        <h5 class="card-title">Special title treatment</h5>
    -        <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    -        <a href="#" class="btn btn-primary">Go somewhere</a>
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col-sm-6">
    -    <div class="card">
    -      <div class="card-body">
    -        <h5 class="card-title">Special title treatment</h5>
    -        <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    -        <a href="#" class="btn btn-primary">Go somewhere</a>
    -      </div>
    -    </div>
    -  </div>
    -</div>
    -
    - -

    Using utilities

    -

    Use our handful of available sizing utilities to quickly set a card’s width.

    -
    -
    - -
    +
    html
    <div class="row">
    +  <div class="col-sm-6 mb-3 mb-sm-0">
    +    <div class="card">
    +      <div class="card-body">
    +        <h5 class="card-title">Special title treatment</h5>
    +        <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    +        <a href="#" class="btn btn-primary">Go somewhere</a>
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col-sm-6">
    +    <div class="card">
    +      <div class="card-body">
    +        <h5 class="card-title">Special title treatment</h5>
    +        <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    +        <a href="#" class="btn btn-primary">Go somewhere</a>
    +      </div>
    +    </div>
    +  </div>
    +</div>
    +

    Using utilities

    +

    Use our handful of available sizing utilities to quickly set a card’s width.

    +
    Card title

    With supporting text below as a natural lead-in to additional content.

    @@ -1119,73 +323,39 @@

    With supporting text below as a natural lead-in to additional content.

    Button
    -
    +
    html
    <div class="card w-75 mb-3">
    +  <div class="card-body">
    +    <h5 class="card-title">Card title</h5>
    +    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    +    <a href="#" class="btn btn-primary">Button</a>
    +  </div>
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="card w-75 mb-3">
    -  <div class="card-body">
    -    <h5 class="card-title">Card title</h5>
    -    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    -    <a href="#" class="btn btn-primary">Button</a>
    -  </div>
    -</div>
    -
    -<div class="card w-50">
    -  <div class="card-body">
    -    <h5 class="card-title">Card title</h5>
    -    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    -    <a href="#" class="btn btn-primary">Button</a>
    -  </div>
    -</div>
    -
    - -

    Using custom CSS

    +<div class="card w-50"> + <div class="card-body"> + <h5 class="card-title">Card title</h5> + <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> + <a href="#" class="btn btn-primary">Button</a> + </div> +</div>
    +

    Using custom CSS

    Use custom CSS in your stylesheets or as inline styles to set a width.

    -
    -
    - -
    +
    Special title treatment

    With supporting text below as a natural lead-in to additional content.

    Go somewhere
    -
    - -
    - html -
    - - -
    -
    <div class="card" style="width: 18rem;">
    -  <div class="card-body">
    -    <h5 class="card-title">Special title treatment</h5>
    -    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    -    <a href="#" class="btn btn-primary">Go somewhere</a>
    -  </div>
    -</div>
    -
    - -

    Text alignment

    -

    You can quickly change the text alignment of any card—in its entirety or specific parts—with our text align classes.

    -
    -
    - -
    +
    html
    <div class="card" style="width: 18rem;">
    +  <div class="card-body">
    +    <h5 class="card-title">Special title treatment</h5>
    +    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    +    <a href="#" class="btn btn-primary">Go somewhere</a>
    +  </div>
    +</div>
    +

    Text alignment

    +

    You can quickly change the text alignment of any card—in its entirety or specific parts—with our text align classes.

    +
    Special title treatment

    With supporting text below as a natural lead-in to additional content.

    @@ -1207,49 +377,32 @@

    With supporting text below as a natural lead-in to additional content.

    Go somewhere
    -
    +
    html
    <div class="card mb-3" style="width: 18rem;">
    +  <div class="card-body">
    +    <h5 class="card-title">Special title treatment</h5>
    +    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    +    <a href="#" class="btn btn-primary">Go somewhere</a>
    +  </div>
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="card mb-3" style="width: 18rem;">
    -  <div class="card-body">
    -    <h5 class="card-title">Special title treatment</h5>
    -    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    -    <a href="#" class="btn btn-primary">Go somewhere</a>
    -  </div>
    -</div>
    -
    -<div class="card text-center mb-3" style="width: 18rem;">
    -  <div class="card-body">
    -    <h5 class="card-title">Special title treatment</h5>
    -    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    -    <a href="#" class="btn btn-primary">Go somewhere</a>
    -  </div>
    -</div>
    -
    -<div class="card text-end" style="width: 18rem;">
    -  <div class="card-body">
    -    <h5 class="card-title">Special title treatment</h5>
    -    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    -    <a href="#" class="btn btn-primary">Go somewhere</a>
    -  </div>
    -</div>
    -
    +<div class="card text-center mb-3" style="width: 18rem;"> + <div class="card-body"> + <h5 class="card-title">Special title treatment</h5> + <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> + <a href="#" class="btn btn-primary">Go somewhere</a> + </div> +</div> - -

    Add some navigation to a card’s header (or block) with Bootstrap’s nav components.

    -
    -
    - -
    +<div class="card text-end" style="width: 18rem;"> + <div class="card-body"> + <h5 class="card-title">Special title treatment</h5> + <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> + <a href="#" class="btn btn-primary">Go somewhere</a> + </div> +</div>
    + +

    Add some navigation to a card’s header (or block) with Bootstrap’s nav components.

    +
    -
    - -
    - html -
    - - -
    -
    <div class="card text-center">
    -  <div class="card-header">
    -    <ul class="nav nav-tabs card-header-tabs">
    -      <li class="nav-item">
    -        <a class="nav-link active" aria-current="true" href="#">Active</a>
    -      </li>
    -      <li class="nav-item">
    -        <a class="nav-link" href="#">Link</a>
    -      </li>
    -      <li class="nav-item">
    -        <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    -      </li>
    -    </ul>
    -  </div>
    -  <div class="card-body">
    -    <h5 class="card-title">Special title treatment</h5>
    -    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    -    <a href="#" class="btn btn-primary">Go somewhere</a>
    -  </div>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="card text-center">
    +  <div class="card-header">
    +    <ul class="nav nav-tabs card-header-tabs">
    +      <li class="nav-item">
    +        <a class="nav-link active" aria-current="true" href="#">Active</a>
    +      </li>
    +      <li class="nav-item">
    +        <a class="nav-link" href="#">Link</a>
    +      </li>
    +      <li class="nav-item">
    +        <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +      </li>
    +    </ul>
    +  </div>
    +  <div class="card-body">
    +    <h5 class="card-title">Special title treatment</h5>
    +    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    +    <a href="#" class="btn btn-primary">Go somewhere</a>
    +  </div>
    +</div>
    +
    -
    - -
    - html -
    - - -
    -
    <div class="card text-center">
    -  <div class="card-header">
    -    <ul class="nav nav-pills card-header-pills">
    -      <li class="nav-item">
    -        <a class="nav-link active" href="#">Active</a>
    -      </li>
    -      <li class="nav-item">
    -        <a class="nav-link" href="#">Link</a>
    -      </li>
    -      <li class="nav-item">
    -        <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    -      </li>
    -    </ul>
    -  </div>
    -  <div class="card-body">
    -    <h5 class="card-title">Special title treatment</h5>
    -    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    -    <a href="#" class="btn btn-primary">Go somewhere</a>
    -  </div>
    -</div>
    -
    - -

    Images

    -

    Cards include a few options for working with images. Choose from appending “image caps” at either end of a card, overlaying images with card content, or simply embedding the image in a card.

    -

    Image caps

    -

    Similar to headers and footers, cards can include top and bottom “image caps”—images at the top or bottom of a card.

    -
    -
    - -
    - PlaceholderImage cap +
    html
    <div class="card text-center">
    +  <div class="card-header">
    +    <ul class="nav nav-pills card-header-pills">
    +      <li class="nav-item">
    +        <a class="nav-link active" href="#">Active</a>
    +      </li>
    +      <li class="nav-item">
    +        <a class="nav-link" href="#">Link</a>
    +      </li>
    +      <li class="nav-item">
    +        <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +      </li>
    +    </ul>
    +  </div>
    +  <div class="card-body">
    +    <h5 class="card-title">Special title treatment</h5>
    +    <p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
    +    <a href="#" class="btn btn-primary">Go somewhere</a>
    +  </div>
    +</div>
    +

    Images

    +

    Cards include a few options for working with images. Choose from appending “image caps” at either end of a card, overlaying images with card content, or simply embedding the image in a card.

    +

    Image caps

    +

    Similar to headers and footers, cards can include top and bottom “image caps”—images at the top or bottom of a card.

    +
    + PlaceholderImage cap
    Card title

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    @@ -1379,84 +498,47 @@

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    Last updated 3 mins ago

    - PlaceholderImage cap -
    - -
    - html -
    - - -
    -
    <div class="card mb-3">
    -  <img src="..." class="card-img-top" alt="...">
    -  <div class="card-body">
    -    <h5 class="card-title">Card title</h5>
    -    <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    -    <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p>
    -  </div>
    -</div>
    -<div class="card">
    -  <div class="card-body">
    -    <h5 class="card-title">Card title</h5>
    -    <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    -    <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p>
    -  </div>
    -  <img src="..." class="card-img-bottom" alt="...">
    -</div>
    -
    - -

    Image overlays

    -

    Turn an image into a card background and overlay your card’s text. Depending on the image, you may or may not need additional styles or utilities.

    -
    -
    - -
    - PlaceholderCard image + PlaceholderImage cap +
    html
    <div class="card mb-3">
    +  <img src="..." class="card-img-top" alt="...">
    +  <div class="card-body">
    +    <h5 class="card-title">Card title</h5>
    +    <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    +    <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p>
    +  </div>
    +</div>
    +<div class="card">
    +  <div class="card-body">
    +    <h5 class="card-title">Card title</h5>
    +    <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    +    <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p>
    +  </div>
    +  <img src="..." class="card-img-bottom" alt="...">
    +</div>
    +

    Image overlays

    +

    Turn an image into a card background and overlay your card’s text. Depending on the image, you may or may not need additional styles or utilities.

    +
    + PlaceholderCard image
    Card title

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    Last updated 3 mins ago

    -
    - -
    - html -
    - - -
    -
    <div class="card text-bg-dark">
    -  <img src="..." class="card-img" alt="...">
    -  <div class="card-img-overlay">
    -    <h5 class="card-title">Card title</h5>
    -    <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    -    <p class="card-text"><small>Last updated 3 mins ago</small></p>
    -  </div>
    -</div>
    -
    - -
    -Note that content should not be larger than the height of the image. If content is larger than the image the content will be displayed outside the image. -
    - -

    Horizontal

    +
    html
    <div class="card text-bg-dark">
    +  <img src="..." class="card-img" alt="...">
    +  <div class="card-img-overlay">
    +    <h5 class="card-title">Card title</h5>
    +    <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    +    <p class="card-text"><small>Last updated 3 mins ago</small></p>
    +  </div>
    +</div>
    +

    Note that content should not be larger than the height of the image. If content is larger than the image the content will be displayed outside the image.

    +

    Horizontal

    Using a combination of grid and utility classes, cards can be made horizontal in a mobile-friendly and responsive way. In the example below, we remove the grid gutters with .g-0 and use .col-md-* classes to make the card horizontal at the md breakpoint. Further adjustments may be needed depending on your card content.

    -
    -
    - -
    +
    - PlaceholderImage + PlaceholderImage
    @@ -1466,348 +548,274 @@ Note that content should not be larger than the height of the image. If content
    -
    - -
    - html -
    - - -
    -
    <div class="card mb-3" style="max-width: 540px;">
    -  <div class="row g-0">
    -    <div class="col-md-4">
    -      <img src="..." class="img-fluid rounded-start" alt="...">
    -    </div>
    -    <div class="col-md-8">
    -      <div class="card-body">
    -        <h5 class="card-title">Card title</h5>
    -        <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    -        <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p>
    -      </div>
    -    </div>
    -  </div>
    -</div>
    -
    - -

    Card styles

    +
    html
    <div class="card mb-3" style="max-width: 540px;">
    +  <div class="row g-0">
    +    <div class="col-md-4">
    +      <img src="..." class="img-fluid rounded-start" alt="...">
    +    </div>
    +    <div class="col-md-8">
    +      <div class="card-body">
    +        <h5 class="card-title">Card title</h5>
    +        <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    +        <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p>
    +      </div>
    +    </div>
    +  </div>
    +</div>
    +

    Card styles

    Cards include various options for customizing their backgrounds, borders, and color.

    -

    Background and color

    +

    Background and color

    Added in v5.2.0 - -

    Set a background-color with contrasting foreground color with our .text-bg-{color} helpers. Previously it was required to manually pair your choice of .text-{color} and .bg-{color} utilities for styling, which you still may use if you prefer.

    -
    -
    - - -
    +

    Set a background-color with contrasting foreground color with our .text-bg-{color} helpers. Previously it was required to manually pair your choice of .text-{color} and .bg-{color} utilities for styling, which you still may use if you prefer.

    +
    Header
    Primary card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Header
    Secondary card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Header
    Success card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Header
    Danger card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Header
    Warning card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Header
    Info card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Header
    Light card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Header
    Dark card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    -
    - -
    - html -
    - - -
    -
    <div class="card text-bg-primary mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body">
    -    <h5 class="card-title">Primary card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -<div class="card text-bg-secondary mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body">
    -    <h5 class="card-title">Secondary card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -<div class="card text-bg-success mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body">
    -    <h5 class="card-title">Success card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -<div class="card text-bg-danger mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body">
    -    <h5 class="card-title">Danger card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -<div class="card text-bg-warning mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body">
    -    <h5 class="card-title">Warning card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -<div class="card text-bg-info mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body">
    -    <h5 class="card-title">Info card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -<div class="card text-bg-light mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body">
    -    <h5 class="card-title">Light card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -<div class="card text-bg-dark mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body">
    -    <h5 class="card-title">Dark card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -
    - -
    -Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class. -
    - -

    Border

    -

    Use border utilities to change just the border-color of a card. Note that you can put .text-{color} classes on the parent .card or a subset of the card’s contents as shown below.

    -
    -
    - - -
    +
    html
    <div class="card text-bg-primary mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body">
    +    <h5 class="card-title">Primary card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +<div class="card text-bg-secondary mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body">
    +    <h5 class="card-title">Secondary card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +<div class="card text-bg-success mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body">
    +    <h5 class="card-title">Success card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +<div class="card text-bg-danger mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body">
    +    <h5 class="card-title">Danger card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +<div class="card text-bg-warning mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body">
    +    <h5 class="card-title">Warning card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +<div class="card text-bg-info mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body">
    +    <h5 class="card-title">Info card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +<div class="card text-bg-light mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body">
    +    <h5 class="card-title">Light card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +<div class="card text-bg-dark mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body">
    +    <h5 class="card-title">Dark card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +

    Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class.

    +

    Border

    +

    Use border utilities to change just the border-color of a card. Note that you can put .text-{color} classes on the parent .card or a subset of the card’s contents as shown below.

    +
    Header
    Primary card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Header
    Secondary card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Header
    Success card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Header
    Danger card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Header
    Warning card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Header
    Info card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Header
    Light card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Header
    Dark card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    -
    - -
    - html -
    - - -
    -
    <div class="card border-primary mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body text-primary">
    -    <h5 class="card-title">Primary card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -<div class="card border-secondary mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body text-secondary">
    -    <h5 class="card-title">Secondary card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -<div class="card border-success mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body text-success">
    -    <h5 class="card-title">Success card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -<div class="card border-danger mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body text-danger">
    -    <h5 class="card-title">Danger card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -<div class="card border-warning mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body">
    -    <h5 class="card-title">Warning card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -<div class="card border-info mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body">
    -    <h5 class="card-title">Info card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -<div class="card border-light mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body">
    -    <h5 class="card-title">Light card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -<div class="card border-dark mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body">
    -    <h5 class="card-title">Dark card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -
    - -

    Mixins utilities

    +
    html
    <div class="card border-primary mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body text-primary">
    +    <h5 class="card-title">Primary card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +<div class="card border-secondary mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body text-secondary">
    +    <h5 class="card-title">Secondary card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +<div class="card border-success mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body text-success">
    +    <h5 class="card-title">Success card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +<div class="card border-danger mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body text-danger">
    +    <h5 class="card-title">Danger card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +<div class="card border-warning mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body">
    +    <h5 class="card-title">Warning card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +<div class="card border-info mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body">
    +    <h5 class="card-title">Info card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +<div class="card border-light mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body">
    +    <h5 class="card-title">Light card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +<div class="card border-dark mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body">
    +    <h5 class="card-title">Dark card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +

    Mixins utilities

    You can also change the borders on the card header and footer as needed, and even remove their background-color with .bg-transparent.

    -
    -
    - -
    +
    Header
    Success card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    -
    - -
    - html -
    - - -
    -
    <div class="card border-success mb-3" style="max-width: 18rem;">
    -  <div class="card-header bg-transparent border-success">Header</div>
    -  <div class="card-body text-success">
    -    <h5 class="card-title">Success card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -  <div class="card-footer bg-transparent border-success">Footer</div>
    -</div>
    -
    - -

    Card layout

    +
    html
    <div class="card border-success mb-3" style="max-width: 18rem;">
    +  <div class="card-header bg-transparent border-success">Header</div>
    +  <div class="card-body text-success">
    +    <h5 class="card-title">Success card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +  <div class="card-footer bg-transparent border-success">Footer</div>
    +</div>
    +

    Card layout

    In addition to styling the content within cards, Bootstrap includes a few options for laying out series of cards. For the time being, these layout options are not yet responsive.

    -

    Card groups

    +

    Card groups

    Use card groups to render cards as a single, attached element with equal width and height columns. Card groups start off stacked and use display: flex; to become attached with uniform dimensions starting at the sm breakpoint.

    -
    -
    - -
    +
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    @@ -1815,7 +823,7 @@ Note that content should not be larger than the height of the image. If content
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This card has supporting text below as a natural lead-in to additional content.

    @@ -1823,60 +831,43 @@ Note that content should not be larger than the height of the image. If content
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.

    Last updated 3 mins ago

    -
    - -
    - html -
    - - -
    -
    <div class="card-group">
    -  <div class="card">
    -    <img src="..." class="card-img-top" alt="...">
    -    <div class="card-body">
    -      <h5 class="card-title">Card title</h5>
    -      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    -      <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p>
    -    </div>
    -  </div>
    -  <div class="card">
    -    <img src="..." class="card-img-top" alt="...">
    -    <div class="card-body">
    -      <h5 class="card-title">Card title</h5>
    -      <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
    -      <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p>
    -    </div>
    -  </div>
    -  <div class="card">
    -    <img src="..." class="card-img-top" alt="...">
    -    <div class="card-body">
    -      <h5 class="card-title">Card title</h5>
    -      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
    -      <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p>
    -    </div>
    -  </div>
    -</div>
    -
    - +
    html
    <div class="card-group">
    +  <div class="card">
    +    <img src="..." class="card-img-top" alt="...">
    +    <div class="card-body">
    +      <h5 class="card-title">Card title</h5>
    +      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    +      <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p>
    +    </div>
    +  </div>
    +  <div class="card">
    +    <img src="..." class="card-img-top" alt="...">
    +    <div class="card-body">
    +      <h5 class="card-title">Card title</h5>
    +      <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
    +      <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p>
    +    </div>
    +  </div>
    +  <div class="card">
    +    <img src="..." class="card-img-top" alt="...">
    +    <div class="card-body">
    +      <h5 class="card-title">Card title</h5>
    +      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
    +      <p class="card-text"><small class="text-body-secondary">Last updated 3 mins ago</small></p>
    +    </div>
    +  </div>
    +</div>

    When using card groups with footers, their content will automatically line up.

    -
    -
    - -
    +
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    @@ -1886,7 +877,7 @@ Note that content should not be larger than the height of the image. If content
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This card has supporting text below as a natural lead-in to additional content.

    @@ -1896,7 +887,7 @@ Note that content should not be larger than the height of the image. If content
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.

    @@ -1905,61 +896,44 @@ Note that content should not be larger than the height of the image. If content Last updated 3 mins ago
    -
    - -
    - html -
    - - -
    -
    <div class="card-group">
    -  <div class="card">
    -    <img src="..." class="card-img-top" alt="...">
    -    <div class="card-body">
    -      <h5 class="card-title">Card title</h5>
    -      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    -    </div>
    -    <div class="card-footer">
    -      <small class="text-body-secondary">Last updated 3 mins ago</small>
    -    </div>
    -  </div>
    -  <div class="card">
    -    <img src="..." class="card-img-top" alt="...">
    -    <div class="card-body">
    -      <h5 class="card-title">Card title</h5>
    -      <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
    -    </div>
    -    <div class="card-footer">
    -      <small class="text-body-secondary">Last updated 3 mins ago</small>
    -    </div>
    -  </div>
    -  <div class="card">
    -    <img src="..." class="card-img-top" alt="...">
    -    <div class="card-body">
    -      <h5 class="card-title">Card title</h5>
    -      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
    -    </div>
    -    <div class="card-footer">
    -      <small class="text-body-secondary">Last updated 3 mins ago</small>
    -    </div>
    -  </div>
    -</div>
    -
    - -

    Grid cards

    -

    Use the Bootstrap grid system and its .row-cols classes to control how many grid columns (wrapped around your cards) you show per row. For example, here’s .row-cols-1 laying out the cards on one column, and .row-cols-md-2 splitting four cards to equal width across multiple rows, from the medium breakpoint up.

    -
    -
    - -
    +
    html
    <div class="card-group">
    +  <div class="card">
    +    <img src="..." class="card-img-top" alt="...">
    +    <div class="card-body">
    +      <h5 class="card-title">Card title</h5>
    +      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    +    </div>
    +    <div class="card-footer">
    +      <small class="text-body-secondary">Last updated 3 mins ago</small>
    +    </div>
    +  </div>
    +  <div class="card">
    +    <img src="..." class="card-img-top" alt="...">
    +    <div class="card-body">
    +      <h5 class="card-title">Card title</h5>
    +      <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
    +    </div>
    +    <div class="card-footer">
    +      <small class="text-body-secondary">Last updated 3 mins ago</small>
    +    </div>
    +  </div>
    +  <div class="card">
    +    <img src="..." class="card-img-top" alt="...">
    +    <div class="card-body">
    +      <h5 class="card-title">Card title</h5>
    +      <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
    +    </div>
    +    <div class="card-footer">
    +      <small class="text-body-secondary">Last updated 3 mins ago</small>
    +    </div>
    +  </div>
    +</div>
    +

    Grid cards

    +

    Use the Bootstrap grid system and its .row-cols classes to control how many grid columns (wrapped around your cards) you show per row. For example, here’s .row-cols-1 laying out the cards on one column, and .row-cols-md-2 splitting four cards to equal width across multiple rows, from the medium breakpoint up.

    +
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    @@ -1968,7 +942,7 @@ Note that content should not be larger than the height of the image. If content
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    @@ -1977,7 +951,7 @@ Note that content should not be larger than the height of the image. If content
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a longer card with supporting text below as a natural lead-in to additional content.

    @@ -1986,73 +960,56 @@ Note that content should not be larger than the height of the image. If content
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    -
    - -
    - html -
    - - -
    -
    <div class="row row-cols-1 row-cols-md-2 g-4">
    -  <div class="col">
    -    <div class="card">
    -      <img src="..." class="card-img-top" alt="...">
    -      <div class="card-body">
    -        <h5 class="card-title">Card title</h5>
    -        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col">
    -    <div class="card">
    -      <img src="..." class="card-img-top" alt="...">
    -      <div class="card-body">
    -        <h5 class="card-title">Card title</h5>
    -        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col">
    -    <div class="card">
    -      <img src="..." class="card-img-top" alt="...">
    -      <div class="card-body">
    -        <h5 class="card-title">Card title</h5>
    -        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p>
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col">
    -    <div class="card">
    -      <img src="..." class="card-img-top" alt="...">
    -      <div class="card-body">
    -        <h5 class="card-title">Card title</h5>
    -        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    -      </div>
    -    </div>
    -  </div>
    -</div>
    -
    - -

    Change it to .row-cols-3 and you’ll see the fourth card wrap.

    -
    -
    - -
    +
    html
    <div class="row row-cols-1 row-cols-md-2 g-4">
    +  <div class="col">
    +    <div class="card">
    +      <img src="..." class="card-img-top" alt="...">
    +      <div class="card-body">
    +        <h5 class="card-title">Card title</h5>
    +        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col">
    +    <div class="card">
    +      <img src="..." class="card-img-top" alt="...">
    +      <div class="card-body">
    +        <h5 class="card-title">Card title</h5>
    +        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col">
    +    <div class="card">
    +      <img src="..." class="card-img-top" alt="...">
    +      <div class="card-body">
    +        <h5 class="card-title">Card title</h5>
    +        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p>
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col">
    +    <div class="card">
    +      <img src="..." class="card-img-top" alt="...">
    +      <div class="card-body">
    +        <h5 class="card-title">Card title</h5>
    +        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    +      </div>
    +    </div>
    +  </div>
    +</div>
    +

    Change it to .row-cols-3 and you’ll see the fourth card wrap.

    +
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    @@ -2061,7 +1018,7 @@ Note that content should not be larger than the height of the image. If content
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    @@ -2070,7 +1027,7 @@ Note that content should not be larger than the height of the image. If content
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a longer card with supporting text below as a natural lead-in to additional content.

    @@ -2079,73 +1036,56 @@ Note that content should not be larger than the height of the image. If content
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    -
    - -
    - html -
    - - -
    -
    <div class="row row-cols-1 row-cols-md-3 g-4">
    -  <div class="col">
    -    <div class="card">
    -      <img src="..." class="card-img-top" alt="...">
    -      <div class="card-body">
    -        <h5 class="card-title">Card title</h5>
    -        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col">
    -    <div class="card">
    -      <img src="..." class="card-img-top" alt="...">
    -      <div class="card-body">
    -        <h5 class="card-title">Card title</h5>
    -        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col">
    -    <div class="card">
    -      <img src="..." class="card-img-top" alt="...">
    -      <div class="card-body">
    -        <h5 class="card-title">Card title</h5>
    -        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p>
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col">
    -    <div class="card">
    -      <img src="..." class="card-img-top" alt="...">
    -      <div class="card-body">
    -        <h5 class="card-title">Card title</h5>
    -        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    -      </div>
    -    </div>
    -  </div>
    -</div>
    -
    - +
    html
    <div class="row row-cols-1 row-cols-md-3 g-4">
    +  <div class="col">
    +    <div class="card">
    +      <img src="..." class="card-img-top" alt="...">
    +      <div class="card-body">
    +        <h5 class="card-title">Card title</h5>
    +        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col">
    +    <div class="card">
    +      <img src="..." class="card-img-top" alt="...">
    +      <div class="card-body">
    +        <h5 class="card-title">Card title</h5>
    +        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col">
    +    <div class="card">
    +      <img src="..." class="card-img-top" alt="...">
    +      <div class="card-body">
    +        <h5 class="card-title">Card title</h5>
    +        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p>
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col">
    +    <div class="card">
    +      <img src="..." class="card-img-top" alt="...">
    +      <div class="card-body">
    +        <h5 class="card-title">Card title</h5>
    +        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    +      </div>
    +    </div>
    +  </div>
    +</div>

    When you need equal height, add .h-100 to the cards. If you want equal heights by default, you can set $card-height: 100% in Sass.

    -
    -
    - -
    +
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    @@ -2154,7 +1094,7 @@ Note that content should not be larger than the height of the image. If content
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a short card.

    @@ -2163,7 +1103,7 @@ Note that content should not be larger than the height of the image. If content
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a longer card with supporting text below as a natural lead-in to additional content.

    @@ -2172,73 +1112,56 @@ Note that content should not be larger than the height of the image. If content
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    -
    - -
    - html -
    - - -
    -
    <div class="row row-cols-1 row-cols-md-3 g-4">
    -  <div class="col">
    -    <div class="card h-100">
    -      <img src="..." class="card-img-top" alt="...">
    -      <div class="card-body">
    -        <h5 class="card-title">Card title</h5>
    -        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col">
    -    <div class="card h-100">
    -      <img src="..." class="card-img-top" alt="...">
    -      <div class="card-body">
    -        <h5 class="card-title">Card title</h5>
    -        <p class="card-text">This is a short card.</p>
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col">
    -    <div class="card h-100">
    -      <img src="..." class="card-img-top" alt="...">
    -      <div class="card-body">
    -        <h5 class="card-title">Card title</h5>
    -        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p>
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col">
    -    <div class="card h-100">
    -      <img src="..." class="card-img-top" alt="...">
    -      <div class="card-body">
    -        <h5 class="card-title">Card title</h5>
    -        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    -      </div>
    -    </div>
    -  </div>
    -</div>
    -
    - +
    html
    <div class="row row-cols-1 row-cols-md-3 g-4">
    +  <div class="col">
    +    <div class="card h-100">
    +      <img src="..." class="card-img-top" alt="...">
    +      <div class="card-body">
    +        <h5 class="card-title">Card title</h5>
    +        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col">
    +    <div class="card h-100">
    +      <img src="..." class="card-img-top" alt="...">
    +      <div class="card-body">
    +        <h5 class="card-title">Card title</h5>
    +        <p class="card-text">This is a short card.</p>
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col">
    +    <div class="card h-100">
    +      <img src="..." class="card-img-top" alt="...">
    +      <div class="card-body">
    +        <h5 class="card-title">Card title</h5>
    +        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p>
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col">
    +    <div class="card h-100">
    +      <img src="..." class="card-img-top" alt="...">
    +      <div class="card-body">
    +        <h5 class="card-title">Card title</h5>
    +        <p class="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    +      </div>
    +    </div>
    +  </div>
    +</div>

    Just like with card groups, card footers will automatically line up.

    -
    -
    - -
    +
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    @@ -2250,7 +1173,7 @@ Note that content should not be larger than the height of the image. If content
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This card has supporting text below as a natural lead-in to additional content.

    @@ -2262,7 +1185,7 @@ Note that content should not be larger than the height of the image. If content
    - PlaceholderImage cap + PlaceholderImage cap
    Card title

    This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.

    @@ -2272,195 +1195,92 @@ Note that content should not be larger than the height of the image. If content
    -
    - -
    - html -
    - - -
    -
    <div class="row row-cols-1 row-cols-md-3 g-4">
    -  <div class="col">
    -    <div class="card h-100">
    -      <img src="..." class="card-img-top" alt="...">
    -      <div class="card-body">
    -        <h5 class="card-title">Card title</h5>
    -        <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    -      </div>
    -      <div class="card-footer">
    -        <small class="text-body-secondary">Last updated 3 mins ago</small>
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col">
    -    <div class="card h-100">
    -      <img src="..." class="card-img-top" alt="...">
    -      <div class="card-body">
    -        <h5 class="card-title">Card title</h5>
    -        <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
    -      </div>
    -      <div class="card-footer">
    -        <small class="text-body-secondary">Last updated 3 mins ago</small>
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col">
    -    <div class="card h-100">
    -      <img src="..." class="card-img-top" alt="...">
    -      <div class="card-body">
    -        <h5 class="card-title">Card title</h5>
    -        <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
    -      </div>
    -      <div class="card-footer">
    -        <small class="text-body-secondary">Last updated 3 mins ago</small>
    -      </div>
    -    </div>
    -  </div>
    -</div>
    -
    - -

    Masonry

    -

    In v4 we used a CSS-only technique to mimic the behavior of Masonry-like columns, but this technique came with lots of unpleasant side effects. If you want to have this type of layout in v5, you can just make use of Masonry plugin. Masonry is not included in Bootstrap, but we’ve made a demo example to help you get started.

    -

    CSS

    -

    Variables

    +
    html
    <div class="row row-cols-1 row-cols-md-3 g-4">
    +  <div class="col">
    +    <div class="card h-100">
    +      <img src="..." class="card-img-top" alt="...">
    +      <div class="card-body">
    +        <h5 class="card-title">Card title</h5>
    +        <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
    +      </div>
    +      <div class="card-footer">
    +        <small class="text-body-secondary">Last updated 3 mins ago</small>
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col">
    +    <div class="card h-100">
    +      <img src="..." class="card-img-top" alt="...">
    +      <div class="card-body">
    +        <h5 class="card-title">Card title</h5>
    +        <p class="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
    +      </div>
    +      <div class="card-footer">
    +        <small class="text-body-secondary">Last updated 3 mins ago</small>
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col">
    +    <div class="card h-100">
    +      <img src="..." class="card-img-top" alt="...">
    +      <div class="card-body">
    +        <h5 class="card-title">Card title</h5>
    +        <p class="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
    +      </div>
    +      <div class="card-footer">
    +        <small class="text-body-secondary">Last updated 3 mins ago</small>
    +      </div>
    +    </div>
    +  </div>
    +</div>
    +

    Masonry

    +

    In v4 we used a CSS-only technique to mimic the behavior of Masonry-like columns, but this technique came with lots of unpleasant side effects. If you want to have this type of layout in v5, you can just make use of Masonry plugin. Masonry is not included in Bootstrap, but we’ve made a demo example to help you get started.

    +

    CSS

    +

    Variables

    Added in v5.2.0 - -

    As part of Bootstrap’s evolving CSS variables approach, cards now use local CSS variables on .card for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    -
    -
    - scss/_card.scss -
    - -
    -
    --#{$prefix}card-spacer-y: #{$card-spacer-y};
    ---#{$prefix}card-spacer-x: #{$card-spacer-x};
    ---#{$prefix}card-title-spacer-y: #{$card-title-spacer-y};
    ---#{$prefix}card-title-color: #{$card-title-color};
    ---#{$prefix}card-subtitle-color: #{$card-subtitle-color};
    ---#{$prefix}card-border-width: #{$card-border-width};
    ---#{$prefix}card-border-color: #{$card-border-color};
    ---#{$prefix}card-border-radius: #{$card-border-radius};
    ---#{$prefix}card-box-shadow: #{$card-box-shadow};
    ---#{$prefix}card-inner-border-radius: #{$card-inner-border-radius};
    ---#{$prefix}card-cap-padding-y: #{$card-cap-padding-y};
    ---#{$prefix}card-cap-padding-x: #{$card-cap-padding-x};
    ---#{$prefix}card-cap-bg: #{$card-cap-bg};
    ---#{$prefix}card-cap-color: #{$card-cap-color};
    ---#{$prefix}card-height: #{$card-height};
    ---#{$prefix}card-color: #{$card-color};
    ---#{$prefix}card-bg: #{$card-bg};
    ---#{$prefix}card-img-overlay-padding: #{$card-img-overlay-padding};
    ---#{$prefix}card-group-margin: #{$card-group-margin};
    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $card-spacer-y:                     $spacer;
    -$card-spacer-x:                     $spacer;
    -$card-title-spacer-y:               $spacer * .5;
    -$card-title-color:                  null;
    -$card-subtitle-color:               null;
    -$card-border-width:                 var(--#{$prefix}border-width);
    -$card-border-color:                 var(--#{$prefix}border-color-translucent);
    -$card-border-radius:                var(--#{$prefix}border-radius);
    -$card-box-shadow:                   null;
    -$card-inner-border-radius:          subtract($card-border-radius, $card-border-width);
    -$card-cap-padding-y:                $card-spacer-y * .5;
    -$card-cap-padding-x:                $card-spacer-x;
    -$card-cap-bg:                       rgba(var(--#{$prefix}body-color-rgb), .03);
    -$card-cap-color:                    null;
    -$card-height:                       null;
    -$card-color:                        null;
    -$card-bg:                           var(--#{$prefix}body-bg);
    -$card-img-overlay-padding:          $spacer;
    -$card-group-margin:                 $grid-gutter-width * .5;
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - +

    As part of Bootstrap’s evolving CSS variables approach, cards now use local CSS variables on .card for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    +
    --#{$prefix}card-spacer-y: #{$card-spacer-y};
    +--#{$prefix}card-spacer-x: #{$card-spacer-x};
    +--#{$prefix}card-title-spacer-y: #{$card-title-spacer-y};
    +--#{$prefix}card-title-color: #{$card-title-color};
    +--#{$prefix}card-subtitle-color: #{$card-subtitle-color};
    +--#{$prefix}card-border-width: #{$card-border-width};
    +--#{$prefix}card-border-color: #{$card-border-color};
    +--#{$prefix}card-border-radius: #{$card-border-radius};
    +--#{$prefix}card-box-shadow: #{$card-box-shadow};
    +--#{$prefix}card-inner-border-radius: #{$card-inner-border-radius};
    +--#{$prefix}card-cap-padding-y: #{$card-cap-padding-y};
    +--#{$prefix}card-cap-padding-x: #{$card-cap-padding-x};
    +--#{$prefix}card-cap-bg: #{$card-cap-bg};
    +--#{$prefix}card-cap-color: #{$card-cap-color};
    +--#{$prefix}card-height: #{$card-height};
    +--#{$prefix}card-color: #{$card-color};
    +--#{$prefix}card-bg: #{$card-bg};
    +--#{$prefix}card-img-overlay-padding: #{$card-img-overlay-padding};
    +--#{$prefix}card-group-margin: #{$card-group-margin};
    +
    +

    Sass variables

    +
    $card-spacer-y:                     $spacer;
    +$card-spacer-x:                     $spacer;
    +$card-title-spacer-y:               $spacer * .5;
    +$card-title-color:                  null;
    +$card-subtitle-color:               null;
    +$card-border-width:                 var(--#{$prefix}border-width);
    +$card-border-color:                 var(--#{$prefix}border-color-translucent);
    +$card-border-radius:                var(--#{$prefix}border-radius);
    +$card-box-shadow:                   null;
    +$card-inner-border-radius:          subtract($card-border-radius, $card-border-width);
    +$card-cap-padding-y:                $card-spacer-y * .5;
    +$card-cap-padding-x:                $card-spacer-x;
    +$card-cap-bg:                       rgba(var(--#{$prefix}body-color-rgb), .03);
    +$card-cap-color:                    null;
    +$card-height:                       null;
    +$card-color:                        null;
    +$card-bg:                           var(--#{$prefix}body-bg);
    +$card-img-overlay-padding:          $spacer;
    +$card-group-margin:                 $grid-gutter-width * .5;
    +
    \ No newline at end of file diff --git a/docs/5.3/components/carousel/index.html b/docs/5.3/components/carousel/index.html index 5c04b1ab08..2523cfcf01 100644 --- a/docs/5.3/components/carousel/index.html +++ b/docs/5.3/components/carousel/index.html @@ -1,621 +1,52 @@ - - - - - - - - - - - - - - - - -Carousel · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Carousel

    -
    -

    A slideshow component for cycling through elements—images or slides of text—like a carousel.

    - - -
    - - - - - -
    - - -

    How it works

    + Carousel · Bootstrap v5.3

    A slideshow component for cycling through elements—images or slides of text—like a carousel.

    +

    How it works

    • The carousel is a slideshow for cycling through a series of content, built with CSS 3D transforms and a bit of JavaScript. It works with a series of images, text, or custom markup. It also includes support for previous/next controls and indicators.

    • For performance reasons, carousels must be manually initialized using the carousel constructor method. Without initialization, some of the event listeners (specifically, the events needed touch/swipe support) will not be registered until a user has explicitly activated a control or indicator.

      -

      The only exception are autoplaying carousels with the data-bs-ride="carousel" attribute as these are initialized automatically on page load. If you’re using autoplaying carousels with the data attribute, don’t explicitly initialize the same carousels with the constructor method.

      +

      The only exception are autoplaying carousels with the data-bs-ride="carousel" attribute as these are initialized automatically on page load. If you’re using autoplaying carousels with the data attribute, don’t explicitly initialize the same carousels with the constructor method.

    • Nested carousels are not supported. You should also be aware that carousels in general can often cause usability and accessibility challenges.

    -
    -The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation. -
    - -

    Basic examples

    +

    The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation.

    +

    Basic examples

    Here is a basic example of a carousel with three slides. Note the previous/next controls. We recommend using <button> elements, but you can also use <a> elements with role="button".

    -
    -
    - -
    html
    <div id="carouselExample" class="carousel slide">
    +  <div class="carousel-inner">
    +    <div class="carousel-item active">
    +      <img src="..." class="d-block w-100" alt="...">
    +    </div>
    +    <div class="carousel-item">
    +      <img src="..." class="d-block w-100" alt="...">
    +    </div>
    +    <div class="carousel-item">
    +      <img src="..." class="d-block w-100" alt="...">
    +    </div>
    +  </div>
    +  <button class="carousel-control-prev" type="button" data-bs-target="#carouselExample" data-bs-slide="prev">
    +    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    +    <span class="visually-hidden">Previous</span>
    +  </button>
    +  <button class="carousel-control-next" type="button" data-bs-target="#carouselExample" data-bs-slide="next">
    +    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    +    <span class="visually-hidden">Next</span>
    +  </button>
    +</div>
    +

    Carousels don’t automatically normalize slide dimensions. As such, you may need to use additional utilities or custom styles to appropriately size content. While carousels support previous/next controls and indicators, they’re not explicitly required. Add and customize as you see fit.

    +

    You must add the .active class to one of the slides, otherwise the carousel will not be visible. Also be sure to set a unique id on the .carousel for optional controls, especially if you’re using multiple carousels on a single page. Control and indicator elements must have a data-bs-target attribute (or href for links) that matches the id of the .carousel element.

    +

    Indicators

    You can add indicators to the carousel, alongside the previous/next controls. The indicators let users jump directly to a particular slide.

    -
    -
    - -
    -
    +
    - - - - - - - - - + + + + + + + + + + +
    Event typeDescription
    slid.bs.carouselFired when the carousel has completed its slide transition.
    slide.bs.carouselFires immediately when the slide instance method is invoked.
    +
    const myCarousel = document.getElementById('myCarousel')
    +
    +myCarousel.addEventListener('slide.bs.carousel', event => {
    +  // do something...
    +})
    +
    \ No newline at end of file diff --git a/docs/5.3/components/close-button/index.html b/docs/5.3/components/close-button/index.html index 98d777cda3..3f514dfb4d 100644 --- a/docs/5.3/components/close-button/index.html +++ b/docs/5.3/components/close-button/index.html @@ -1,756 +1,72 @@ - - - - - - - - - - - - - - - - -Close button · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Close button

    -
    -

    A generic close button for dismissing content like modals and alerts.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Example

    -

    Provide an option to dismiss or close a component with .btn-close. Default styling is limited, but highly customizable. Modify the Sass variables to replace the default background-image. Be sure to include text for screen readers, as we’ve done with aria-label.

    -
    -
    - - - -
    - html -
    - - -
    -
    <button type="button" class="btn-close" aria-label="Close"></button>
    -
    - -

    Disabled state

    -

    Disabled close buttons change their opacity. We’ve also applied pointer-events: none and user-select: none to preventing hover and active states from triggering.

    -
    -
    - - - -
    - html -
    - - -
    -
    <button type="button" class="btn-close" disabled aria-label="Close"></button>
    -
    - -

    Dark variant

    -Deprecated in v5.3.0 - -
    -Heads up! As of v5.3.0, the .btn-close-white class is deprecated. Instead, use data-bs-theme="dark" to change the color mode of the close button. -
    - + Close button · Bootstrap v5.3

    Close button

    A generic close button for dismissing content like modals and alerts.

    +

    Example

    +

    Provide an option to dismiss or close a component with .btn-close. Default styling is limited, but highly customizable. Modify the Sass variables to replace the default background-image. Be sure to include text for screen readers, as we’ve done with aria-label.

    +
    html
    <button type="button" class="btn-close" aria-label="Close"></button>
    +

    Disabled state

    +

    Disabled close buttons change their opacity. We’ve also applied pointer-events: none and user-select: none to preventing hover and active states from triggering.

    +
    html
    <button type="button" class="btn-close" disabled aria-label="Close"></button>
    +

    Dark variant

    + +Deprecated in v5.3.0 +

    Heads up! As of v5.3.0, the .btn-close-white class is deprecated. Instead, use data-bs-theme="dark" to change the color mode of the close button.

    Add data-bs-theme="dark" to the .btn-close, or to its parent element, to invert the close button. This uses the filter property to invert the background-image without overriding its value.

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div data-bs-theme="dark">
    -  <button type="button" class="btn-close" aria-label="Close"></button>
    -  <button type="button" class="btn-close" disabled aria-label="Close"></button>
    -</div>
    -
    - -

    CSS

    -

    Variables

    +
    html
    <div data-bs-theme="dark">
    +  <button type="button" class="btn-close" aria-label="Close"></button>
    +  <button type="button" class="btn-close" disabled aria-label="Close"></button>
    +</div>
    +

    CSS

    +

    Variables

    Added in v5.3.0 - -

    As part of Bootstrap’s evolving CSS variables approach, close button now uses local CSS variables on .btn-close for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    -
    -
    - scss/_close.scss -
    - -
    -
    --#{$prefix}btn-close-color: #{$btn-close-color};
    ---#{$prefix}btn-close-bg: #{ escape-svg($btn-close-bg) };
    ---#{$prefix}btn-close-opacity: #{$btn-close-opacity};
    ---#{$prefix}btn-close-hover-opacity: #{$btn-close-hover-opacity};
    ---#{$prefix}btn-close-focus-shadow: #{$btn-close-focus-shadow};
    ---#{$prefix}btn-close-focus-opacity: #{$btn-close-focus-opacity};
    ---#{$prefix}btn-close-disabled-opacity: #{$btn-close-disabled-opacity};
    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $btn-close-width:            1em;
    -$btn-close-height:           $btn-close-width;
    -$btn-close-padding-x:        .25em;
    -$btn-close-padding-y:        $btn-close-padding-x;
    -$btn-close-color:            $black;
    -$btn-close-bg:               url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='#{$btn-close-color}'><path d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414'/></svg>");
    -$btn-close-focus-shadow:     $focus-ring-box-shadow;
    -$btn-close-opacity:          .5;
    -$btn-close-hover-opacity:    .75;
    -$btn-close-focus-opacity:    1;
    -$btn-close-disabled-opacity: .25;
    -$btn-close-filter:           null;
    -$btn-close-white-filter:     invert(1) grayscale(100%) brightness(200%); // Deprecated in v5.3.4
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - +

    As part of Bootstrap’s evolving CSS variables approach, close button now uses local CSS variables on .btn-close for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    +
    --#{$prefix}btn-close-color: #{$btn-close-color};
    +--#{$prefix}btn-close-bg: #{ escape-svg($btn-close-bg) };
    +--#{$prefix}btn-close-opacity: #{$btn-close-opacity};
    +--#{$prefix}btn-close-hover-opacity: #{$btn-close-hover-opacity};
    +--#{$prefix}btn-close-focus-shadow: #{$btn-close-focus-shadow};
    +--#{$prefix}btn-close-focus-opacity: #{$btn-close-focus-opacity};
    +--#{$prefix}btn-close-disabled-opacity: #{$btn-close-disabled-opacity};
    +
    +

    Sass variables

    +
    $btn-close-width:            1em;
    +$btn-close-height:           $btn-close-width;
    +$btn-close-padding-x:        .25em;
    +$btn-close-padding-y:        $btn-close-padding-x;
    +$btn-close-color:            $black;
    +$btn-close-bg:               url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='#{$btn-close-color}'><path d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414'/></svg>");
    +$btn-close-focus-shadow:     $focus-ring-box-shadow;
    +$btn-close-opacity:          .5;
    +$btn-close-hover-opacity:    .75;
    +$btn-close-focus-opacity:    1;
    +$btn-close-disabled-opacity: .25;
    +$btn-close-filter:           null;
    +$btn-close-white-filter:     invert(1) grayscale(100%) brightness(200%); // Deprecated in v5.3.4
    +
    \ No newline at end of file diff --git a/docs/5.3/components/collapse/index.html b/docs/5.3/components/collapse/index.html index 9ebc5b6d29..51f4924b02 100644 --- a/docs/5.3/components/collapse/index.html +++ b/docs/5.3/components/collapse/index.html @@ -1,585 +1,30 @@ - - - - - - - - - - - - - - - - -Collapse · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Collapse

    -
    -

    Toggle the visibility of content across your project with a few classes and our JavaScript plugins.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    How it works

    + Collapse · Bootstrap v5.3

    Toggle the visibility of content across your project with a few classes and our JavaScript plugins.

    +

    How it works

    The collapse JavaScript plugin is used to show and hide content. Buttons or anchors are used as triggers that are mapped to specific elements you toggle. Collapsing an element will animate the height from its current value to 0. Given how CSS handles animations, you cannot use padding on a .collapse element. Instead, use the class as an independent wrapping element.

    -
    -The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation. -
    - -

    Example

    +

    The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation.

    +

    Example

    Click the buttons below to show and hide another element via class changes:

    • .collapse hides content
    • @@ -587,10 +32,7 @@ The animation effect of this component is dependent on the prefers-reduced
    • .collapse.show shows content

    Generally, we recommend using a <button> with the data-bs-target attribute. While not recommended from a semantic point of view, you can also use an <a> link with the href attribute (and a role="button"). In both cases, the data-bs-toggle="collapse" is required.

    -
    -
    - -

    +

    @@ -602,43 +44,23 @@ The animation effect of this component is dependent on the prefers-reduced

    Some placeholder content for the collapse component. This panel is hidden by default but revealed when the user activates the relevant trigger.
    -
    - -
    - html -
    - - -
    -
    <p class="d-inline-flex gap-1">
    -  <a class="btn btn-primary" data-bs-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
    -    Link with href
    -  </a>
    -  <button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
    -    Button with data-bs-target
    -  </button>
    -</p>
    -<div class="collapse" id="collapseExample">
    -  <div class="card card-body">
    -    Some placeholder content for the collapse component. This panel is hidden by default but revealed when the user activates the relevant trigger.
    -  </div>
    -</div>
    -
    - -

    Horizontal

    -

    The collapse plugin supports horizontal collapsing. Add the .collapse-horizontal modifier class to transition the width instead of height and set a width on the immediate child element. Feel free to write your own custom Sass, use inline styles, or use our width utilities.

    -
    -Please note that while the example below has a min-height set to avoid excessive repaints in our docs, this is not explicitly required. Only the width on the child element is required. -
    - -
    -
    - -

    +

    html
    <p class="d-inline-flex gap-1">
    +  <a class="btn btn-primary" data-bs-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
    +    Link with href
    +  </a>
    +  <button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
    +    Button with data-bs-target
    +  </button>
    +</p>
    +<div class="collapse" id="collapseExample">
    +  <div class="card card-body">
    +    Some placeholder content for the collapse component. This panel is hidden by default but revealed when the user activates the relevant trigger.
    +  </div>
    +</div>
    +

    Horizontal

    +

    The collapse plugin supports horizontal collapsing. Add the .collapse-horizontal modifier class to transition the width instead of height and set a width on the immediate child element. Feel free to write your own custom Sass, use inline styles, or use our width utilities.

    +

    Please note that while the example below has a min-height set to avoid excessive repaints in our docs, this is not explicitly required. Only the width on the child element is required.

    +

    @@ -646,42 +68,25 @@ Please note that while the example below has a min-height set to av

    - This is some placeholder content for a horizontal collapse. It's hidden by default and shown when triggered. + This is some placeholder content for a horizontal collapse. It’s hidden by default and shown when triggered.
    -
    - -
    - html -
    - - -
    -
    <p>
    -  <button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#collapseWidthExample" aria-expanded="false" aria-controls="collapseWidthExample">
    -    Toggle width collapse
    -  </button>
    -</p>
    -<div style="min-height: 120px;">
    -  <div class="collapse collapse-horizontal" id="collapseWidthExample">
    -    <div class="card card-body" style="width: 300px;">
    -      This is some placeholder content for a horizontal collapse. It's hidden by default and shown when triggered.
    -    </div>
    -  </div>
    -</div>
    -
    - -

    Multiple toggles and targets

    +
    html
    <p>
    +  <button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#collapseWidthExample" aria-expanded="false" aria-controls="collapseWidthExample">
    +    Toggle width collapse
    +  </button>
    +</p>
    +<div style="min-height: 120px;">
    +  <div class="collapse collapse-horizontal" id="collapseWidthExample">
    +    <div class="card card-body" style="width: 300px;">
    +      This is some placeholder content for a horizontal collapse. It’s hidden by default and shown when triggered.
    +    </div>
    +  </div>
    +</div>
    +

    Multiple toggles and targets

    A <button> or <a> element can show and hide multiple elements by referencing them with a selector in its data-bs-target or href attribute. Conversely, multiple <button> or <a> elements can show and hide the same element if they each reference it with their data-bs-target or href attribute.

    -
    -
    - -

    +

    @@ -701,87 +106,57 @@ Conversely, multiple <button> or <a> eleme

    -
    - -
    - html -
    - - -
    -
    <p class="d-inline-flex gap-1">
    -  <a class="btn btn-primary" data-bs-toggle="collapse" href="#multiCollapseExample1" role="button" aria-expanded="false" aria-controls="multiCollapseExample1">Toggle first element</a>
    -  <button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#multiCollapseExample2" aria-expanded="false" aria-controls="multiCollapseExample2">Toggle second element</button>
    -  <button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target=".multi-collapse" aria-expanded="false" aria-controls="multiCollapseExample1 multiCollapseExample2">Toggle both elements</button>
    -</p>
    -<div class="row">
    -  <div class="col">
    -    <div class="collapse multi-collapse" id="multiCollapseExample1">
    -      <div class="card card-body">
    -        Some placeholder content for the first collapse component of this multi-collapse example. This panel is hidden by default but revealed when the user activates the relevant trigger.
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col">
    -    <div class="collapse multi-collapse" id="multiCollapseExample2">
    -      <div class="card card-body">
    -        Some placeholder content for the second collapse component of this multi-collapse example. This panel is hidden by default but revealed when the user activates the relevant trigger.
    -      </div>
    -    </div>
    -  </div>
    -</div>
    - - -

    Accessibility

    -

    Be sure to add aria-expanded to the control element. This attribute explicitly conveys the current state of the collapsible element tied to the control to screen readers and similar assistive technologies. If the collapsible element is closed by default, the attribute on the control element should have a value of aria-expanded="false". If you’ve set the collapsible element to be open by default using the show class, set aria-expanded="true" on the control instead. The plugin will automatically toggle this attribute on the control based on whether or not the collapsible element has been opened or closed (via JavaScript, or because the user triggered another control element also tied to the same collapsible element). If the control element’s HTML element is not a button (e.g., an <a> or <div>), the attribute role="button" should be added to the element.

    +
    html
    <p class="d-inline-flex gap-1">
    +  <a class="btn btn-primary" data-bs-toggle="collapse" href="#multiCollapseExample1" role="button" aria-expanded="false" aria-controls="multiCollapseExample1">Toggle first element</a>
    +  <button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target="#multiCollapseExample2" aria-expanded="false" aria-controls="multiCollapseExample2">Toggle second element</button>
    +  <button class="btn btn-primary" type="button" data-bs-toggle="collapse" data-bs-target=".multi-collapse" aria-expanded="false" aria-controls="multiCollapseExample1 multiCollapseExample2">Toggle both elements</button>
    +</p>
    +<div class="row">
    +  <div class="col">
    +    <div class="collapse multi-collapse" id="multiCollapseExample1">
    +      <div class="card card-body">
    +        Some placeholder content for the first collapse component of this multi-collapse example. This panel is hidden by default but revealed when the user activates the relevant trigger.
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col">
    +    <div class="collapse multi-collapse" id="multiCollapseExample2">
    +      <div class="card card-body">
    +        Some placeholder content for the second collapse component of this multi-collapse example. This panel is hidden by default but revealed when the user activates the relevant trigger.
    +      </div>
    +    </div>
    +  </div>
    +</div>
    +

    Accessibility

    +

    Be sure to add aria-expanded to the control element. This attribute explicitly conveys the current state of the collapsible element tied to the control to screen readers and similar assistive technologies. If the collapsible element is closed by default, the attribute on the control element should have a value of aria-expanded="false". If you’ve set the collapsible element to be open by default using the show class, set aria-expanded="true" on the control instead. The plugin will automatically toggle this attribute on the control based on whether or not the collapsible element has been opened or closed (via JavaScript, or because the user triggered another control element also tied to the same collapsible element). If the control element’s HTML element is not a button (e.g., an <a> or <div>), the attribute role="button" should be added to the element.

    If your control element is targeting a single collapsible element – i.e. the data-bs-target attribute is pointing to an id selector – you should add the aria-controls attribute to the control element, containing the id of the collapsible element. Modern screen readers and similar assistive technologies make use of this attribute to provide users with additional shortcuts to navigate directly to the collapsible element itself.

    -

    Note that Bootstrap’s current implementation does not cover the various optional keyboard interactions described in the ARIA Authoring Practices Guide accordion pattern - you will need to include these yourself with custom JavaScript.

    -

    CSS

    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $transition-collapse:         height .35s ease;
    -$transition-collapse-width:   width .35s ease;
    -
    -

    Classes

    +

    Note that Bootstrap’s current implementation does not cover the various optional keyboard interactions described in the ARIA Authoring Practices Guide accordion pattern - you will need to include these yourself with custom JavaScript.

    +

    CSS

    +

    Sass variables

    +
    $transition-collapse:         height .35s ease;
    +$transition-collapse-width:   width .35s ease;
    +
    +

    Classes

    Collapse transition classes can be found in scss/_transitions.scss as these are shared across multiple components (collapse and accordion).

    -
    -
    - scss/_transitions.scss -
    - -
    -
    .collapse {
    -  &:not(.show) {
    -    display: none;
    -  }
    -}
    -
    -.collapsing {
    -  height: 0;
    -  overflow: hidden;
    -  @include transition($transition-collapse);
    -
    -  &.collapse-horizontal {
    -    width: 0;
    -    height: auto;
    -    @include transition($transition-collapse-width);
    -  }
    -}
    -
    -

    Usage

    +
    .collapse {
    +  &:not(.show) {
    +    display: none;
    +  }
    +}
    +
    +.collapsing {
    +  height: 0;
    +  overflow: hidden;
    +  @include transition($transition-collapse);
    +
    +  &.collapse-horizontal {
    +    width: 0;
    +    height: auto;
    +    @include transition($transition-collapse-width);
    +  }
    +}
    +
    +

    Usage

    The collapse plugin utilizes a few classes to handle the heavy lifting:

    • .collapse hides the content
    • @@ -789,195 +164,118 @@ Conversely, multiple <button> or <a> eleme
    • .collapsing is added when the transition starts, and removed when it finishes

    These classes can be found in _transitions.scss.

    -

    Via data attributes

    -

    Just add data-bs-toggle="collapse" and a data-bs-target to the element to automatically assign control of one or more collapsible elements. The data-bs-target attribute accepts a CSS selector to apply the collapse to. Be sure to add the class collapse to the collapsible element. If you’d like it to default open, add the additional class show.

    -

    To add accordion-like group management to a collapsible area, add the data attribute data-bs-parent="#selector". Refer to the accordion page for more information.

    -

    Via JavaScript

    +

    Via data attributes

    +

    Just add data-bs-toggle="collapse" and a data-bs-target to the element to automatically assign control of one or more collapsible elements. The data-bs-target attribute accepts a CSS selector to apply the collapse to. Be sure to add the class collapse to the collapsible element. If you’d like it to default open, add the additional class show.

    +

    To add accordion-like group management to a collapsible area, add the data attribute data-bs-parent="#selector". Refer to the accordion page for more information.

    +

    Via JavaScript

    Enable manually with:

    -
    const collapseElementList = document.querySelectorAll('.collapse')
    -const collapseList = [...collapseElementList].map(collapseEl => new bootstrap.Collapse(collapseEl))
    -

    Options

    -

    As options can be passed via data attributes or JavaScript, you can append an option name to data-bs-, as in data-bs-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-bs-custom-class="beautifier" instead of data-bs-customClass="beautifier".

    -

    As of Bootstrap 5.2.0, all components support an experimental reserved data attribute data-bs-config that can house simple component configuration as a JSON string. When an element has data-bs-config='{"delay":0, "title":123}' and data-bs-title="456" attributes, the final title value will be 456 and the separate data attributes will override values given on data-bs-config. In addition, existing data attributes are able to house JSON values like data-bs-delay='{"show":0,"hide":150}'.

    +
    const collapseElementList = document.querySelectorAll('.collapse')
    +const collapseList = [...collapseElementList].map(collapseEl => new bootstrap.Collapse(collapseEl))
    +
    +

    Options

    +

    As options can be passed via data attributes or JavaScript, you can append an option name to data-bs-, as in data-bs-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-bs-custom-class="beautifier" instead of data-bs-customClass="beautifier".

    +

    As of Bootstrap 5.2.0, all components support an experimental reserved data attribute data-bs-config that can house simple component configuration as a JSON string. When an element has data-bs-config='{"delay":0, "title":123}' and data-bs-title="456" attributes, the final title value will be 456 and the separate data attributes will override values given on data-bs-config. In addition, existing data attributes are able to house JSON values like data-bs-delay='{"show":0,"hide":150}'.

    The final configuration object is the merged result of data-bs-config, data-bs-, and js object where the latest given key-value overrides the others.

    +
    -
    - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDefaultDescription
    parentselector, DOM elementnullIf parent is provided, then all collapsible elements under the specified parent will be closed when this collapsible item is shown. (similar to traditional accordion behavior - this is dependent on the card class). The attribute has to be set on the target collapsible area.
    togglebooleantrueToggles the collapsible element on invocation.
    -

    Methods

    -
    -All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started, but before it ends. In addition, a method call on a transitioning component will be ignored. Learn more in our JavaScript docs. -
    + + + + + + + + + + + + + + + + + + + +
    NameTypeDefaultDescription
    parentselector, DOM elementnullIf parent is provided, then all collapsible elements under the specified parent will be closed when this collapsible item is shown. (similar to traditional accordion behavior - this is dependent on the card class). The attribute has to be set on the target collapsible area.
    togglebooleantrueToggles the collapsible element on invocation.
    +

    Methods

    +

    All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started, but before it ends. In addition, a method call on a transitioning component will be ignored. Learn more in our JavaScript docs.

    Activates your content as a collapsible element. Accepts an optional options object.

    You can create a collapse instance with the constructor, for example:

    -
    const bsCollapse = new bootstrap.Collapse('#myCollapse', {
    -  toggle: false
    -})
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    MethodDescription
    disposeDestroys an element’s collapse. (Removes stored data on the DOM element)
    getInstanceStatic method which allows you to get the collapse instance associated to a DOM element, you can use it like this: bootstrap.Collapse.getInstance(element).
    getOrCreateInstanceStatic method which returns a collapse instance associated to a DOM element or create a new one in case it wasn’t initialized. You can use it like this: bootstrap.Collapse.getOrCreateInstance(element).
    hideHides a collapsible element. Returns to the caller before the collapsible element has actually been hidden (e.g., before the hidden.bs.collapse event occurs).
    showShows a collapsible element. Returns to the caller before the collapsible element has actually been shown (e.g., before the shown.bs.collapse event occurs).
    toggleToggles a collapsible element to shown or hidden. Returns to the caller before the collapsible element has actually been shown or hidden (i.e. before the shown.bs.collapse or hidden.bs.collapse event occurs).
    - -

    Events

    -

    Bootstrap’s collapse class exposes a few events for hooking into collapse functionality.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    Event typeDescription
    hide.bs.collapseThis event is fired immediately when the hide method has been called.
    hidden.bs.collapseThis event is fired when a collapse element has been hidden from the user (will wait for CSS transitions to complete).
    show.bs.collapseThis event fires immediately when the show instance method is called.
    shown.bs.collapseThis event is fired when a collapse element has been made visible to the user (will wait for CSS transitions to complete).
    - -
    const myCollapsible = document.getElementById('myCollapsible')
    -myCollapsible.addEventListener('hidden.bs.collapse', event => {
    -  // do something...
    -})
    -
    - - - +
    const bsCollapse = new bootstrap.Collapse('#myCollapse', {
    +  toggle: false
    +})
    +
    +
    - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MethodDescription
    disposeDestroys an element’s collapse. (Removes stored data on the DOM element)
    getInstanceStatic method which allows you to get the collapse instance associated to a DOM element, you can use it like this: bootstrap.Collapse.getInstance(element).
    getOrCreateInstanceStatic method which returns a collapse instance associated to a DOM element or create a new one in case it wasn’t initialized. You can use it like this: bootstrap.Collapse.getOrCreateInstance(element).
    hideHides a collapsible element. Returns to the caller before the collapsible element has actually been hidden (e.g., before the hidden.bs.collapse event occurs).
    showShows a collapsible element. Returns to the caller before the collapsible element has actually been shown (e.g., before the shown.bs.collapse event occurs).
    toggleToggles a collapsible element to shown or hidden. Returns to the caller before the collapsible element has actually been shown or hidden (i.e. before the shown.bs.collapse or hidden.bs.collapse event occurs).
    +

    Events

    +

    Bootstrap’s collapse class exposes a few events for hooking into collapse functionality.

    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    Event typeDescription
    hide.bs.collapseThis event is fired immediately when the hide method has been called.
    hidden.bs.collapseThis event is fired when a collapse element has been hidden from the user (will wait for CSS transitions to complete).
    show.bs.collapseThis event fires immediately when the show instance method is called.
    shown.bs.collapseThis event is fired when a collapse element has been made visible to the user (will wait for CSS transitions to complete).
    +
    const myCollapsible = document.getElementById('myCollapsible')
    +myCollapsible.addEventListener('hidden.bs.collapse', event => {
    +  // do something...
    +})
    +
    \ No newline at end of file diff --git a/docs/5.3/components/dropdowns/index.html b/docs/5.3/components/dropdowns/index.html index 3818a2efa9..164b647d81 100644 --- a/docs/5.3/components/dropdowns/index.html +++ b/docs/5.3/components/dropdowns/index.html @@ -1,637 +1,38 @@ - - - - - - - - - - - - - - - - -Dropdowns · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Dropdowns

    -
    -

    Toggle contextual overlays for displaying lists of links and more with the Bootstrap dropdown plugin.

    - - -
    - - - - - -
    - - -

    Overview

    -

    Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They’re made interactive with the included Bootstrap dropdown JavaScript plugin. They’re toggled by clicking, not by hovering; this is an intentional design decision.

    -

    Dropdowns are built on a third party library, Popper, which provides dynamic positioning and viewport detection. Be sure to include popper.min.js before Bootstrap’s JavaScript or use bootstrap.bundle.min.js / bootstrap.bundle.js which contains Popper. Popper isn’t used to position dropdowns in navbars though as dynamic positioning isn’t required.

    -

    Accessibility

    + Dropdowns · Bootstrap v5.3

    Toggle contextual overlays for displaying lists of links and more with the Bootstrap dropdown plugin.

    +

    Overview

    +

    Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They’re made interactive with the included Bootstrap dropdown JavaScript plugin. They’re toggled by clicking, not by hovering; this is an intentional design decision.

    +

    Dropdowns are built on a third party library, Popper, which provides dynamic positioning and viewport detection. Be sure to include popper.min.js before Bootstrap’s JavaScript or use bootstrap.bundle.min.js / bootstrap.bundle.js which contains Popper. Popper isn’t used to position dropdowns in navbars though as dynamic positioning isn’t required.

    +

    Accessibility

    The WAI ARIA standard defines an actual role="menu" widget, but this is specific to application-like menus which trigger actions or functions. ARIA menus can only contain menu items, checkbox menu items, radio button menu items, radio button groups, and sub-menus.

    -

    Bootstrap’s dropdowns, on the other hand, are designed to be generic and applicable to a variety of situations and markup structures. For instance, it is possible to create dropdowns that contain additional inputs and form controls, such as search fields or login forms. For this reason, Bootstrap does not expect (nor automatically add) any of the role and aria- attributes required for true ARIA menus. Authors will have to include these more specific attributes themselves.

    +

    Bootstrap’s dropdowns, on the other hand, are designed to be generic and applicable to a variety of situations and markup structures. For instance, it is possible to create dropdowns that contain additional inputs and form controls, such as search fields or login forms. For this reason, Bootstrap does not expect (nor automatically add) any of the role and aria- attributes required for true ARIA menus. Authors will have to include these more specific attributes themselves.

    However, Bootstrap does add built-in support for most standard keyboard menu interactions, such as the ability to move through individual .dropdown-item elements using the cursor keys and close the menu with the Esc key.

    -

    Examples

    -

    Wrap the dropdown’s toggle (your button or link) and the dropdown menu within .dropdown, or another element that declares position: relative;. Ideally, you should use a <button> element as the dropdown trigger, but the plugin will work with <a> elements as well. The examples shown here use semantic <ul> elements where appropriate, but custom markup is supported.

    -

    Single button

    -

    Any single .btn can be turned into a dropdown toggle with some markup changes. Here’s how you can put them to work with <button> elements:

    -
    -
    - -
    html
    <div class="dropdown">
    +  <a class="btn btn-secondary dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
    +    Dropdown link
    +  </a>
     
    +  <ul class="dropdown-menu">
    +    <li><a class="dropdown-item" href="#">Action</a></li>
    +    <li><a class="dropdown-item" href="#">Another action</a></li>
    +    <li><a class="dropdown-item" href="#">Something else here</a></li>
    +  </ul>
    +</div>

    The best part is you can do this with any button variant, too:

    -
    - - - - - - +
    -
    <!-- Example single danger button -->
    -<div class="btn-group">
    -  <button type="button" class="btn btn-danger dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    -    Danger
    -  </button>
    -  <ul class="dropdown-menu">
    -    <li><a class="dropdown-item" href="#">Action</a></li>
    -    <li><a class="dropdown-item" href="#">Another action</a></li>
    -    <li><a class="dropdown-item" href="#">Something else here</a></li>
    -    <li><hr class="dropdown-divider"></li>
    -    <li><a class="dropdown-item" href="#">Separated link</a></li>
    -  </ul>
    -</div>
    -

    Split button

    + + + + +
    +
    <!-- Example single danger button -->
    +<div class="btn-group">
    +  <button type="button" class="btn btn-danger dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    +    Danger
    +  </button>
    +  <ul class="dropdown-menu">
    +    <li><a class="dropdown-item" href="#">Action</a></li>
    +    <li><a class="dropdown-item" href="#">Another action</a></li>
    +    <li><a class="dropdown-item" href="#">Something else here</a></li>
    +    <li><hr class="dropdown-divider"></li>
    +    <li><a class="dropdown-item" href="#">Separated link</a></li>
    +  </ul>
    +</div>
    +
    +

    Split button

    Similarly, create split button dropdowns with virtually the same markup as single button dropdowns, but with the addition of .dropdown-toggle-split for proper spacing around the dropdown caret.

    -

    We use this extra class to reduce the horizontal padding on either side of the caret by 25% and remove the margin-left that’s added for regular button dropdowns. Those extra changes keep the caret centered in the split button and provide a more appropriately sized hit area next to the main button.

    -
    -
    - - - -
    -
    - - - -
    -
    - - - -
    -
    - - - -
    -
    - - - -
    -
    - - - -
    +

    We use this extra class to reduce the horizontal padding on either side of the caret by 25% and remove the margin-left that’s added for regular button dropdowns. Those extra changes keep the caret centered in the split button and provide a more appropriately sized hit area next to the main button.

    +
    + + +
    -
    <!-- Example split danger button -->
    -<div class="btn-group">
    -  <button type="button" class="btn btn-danger">Danger</button>
    -  <button type="button" class="btn btn-danger dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    -    <span class="visually-hidden">Toggle Dropdown</span>
    -  </button>
    -  <ul class="dropdown-menu">
    -    <li><a class="dropdown-item" href="#">Action</a></li>
    -    <li><a class="dropdown-item" href="#">Another action</a></li>
    -    <li><a class="dropdown-item" href="#">Something else here</a></li>
    -    <li><hr class="dropdown-divider"></li>
    -    <li><a class="dropdown-item" href="#">Separated link</a></li>
    -  </ul>
    -</div>
    -

    Sizing

    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    + + + +
    +
    <!-- Example split danger button -->
    +<div class="btn-group">
    +  <button type="button" class="btn btn-danger">Danger</button>
    +  <button type="button" class="btn btn-danger dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    +    <span class="visually-hidden">Toggle Dropdown</span>
    +  </button>
    +  <ul class="dropdown-menu">
    +    <li><a class="dropdown-item" href="#">Action</a></li>
    +    <li><a class="dropdown-item" href="#">Another action</a></li>
    +    <li><a class="dropdown-item" href="#">Something else here</a></li>
    +    <li><hr class="dropdown-divider"></li>
    +    <li><a class="dropdown-item" href="#">Separated link</a></li>
    +  </ul>
    +</div>
    +
    +

    Sizing

    Button dropdowns work with buttons of all sizes, including default and split dropdown buttons.

    -
    -
    - - -
    -
    - - - -
    +
    + +
    -
    <!-- Large button groups (default and split) -->
    -<div class="btn-group">
    -  <button class="btn btn-secondary btn-lg dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    -    Large button
    -  </button>
    -  <ul class="dropdown-menu">
    -    ...
    -  </ul>
    -</div>
    -<div class="btn-group">
    -  <button class="btn btn-secondary btn-lg" type="button">
    -    Large split button
    -  </button>
    -  <button type="button" class="btn btn-lg btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    -    <span class="visually-hidden">Toggle Dropdown</span>
    -  </button>
    -  <ul class="dropdown-menu">
    -    ...
    -  </ul>
    -</div>
    -
    -
    - - -
    -
    - - - -
    +
    + + + +
    +
    <!-- Large button groups (default and split) -->
    +<div class="btn-group">
    +  <button class="btn btn-secondary btn-lg dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    +    Large button
    +  </button>
    +  <ul class="dropdown-menu">
    +    ...
    +  </ul>
    +</div>
    +<div class="btn-group">
    +  <button class="btn btn-secondary btn-lg" type="button">
    +    Large split button
    +  </button>
    +  <button type="button" class="btn btn-lg btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    +    <span class="visually-hidden">Toggle Dropdown</span>
    +  </button>
    +  <ul class="dropdown-menu">
    +    ...
    +  </ul>
    +</div>
    +
    +
    + +
    -
    <div class="btn-group">
    -  <button class="btn btn-secondary btn-sm dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    -    Small button
    -  </button>
    -  <ul class="dropdown-menu">
    -    ...
    -  </ul>
    -</div>
    -<div class="btn-group">
    -  <button class="btn btn-secondary btn-sm" type="button">
    -    Small split button
    -  </button>
    -  <button type="button" class="btn btn-sm btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    -    <span class="visually-hidden">Toggle Dropdown</span>
    -  </button>
    -  <ul class="dropdown-menu">
    -    ...
    -  </ul>
    -</div>
    -

    Dark dropdowns

    -Deprecated in v5.3.0 - +
    + + + +
    +
    <div class="btn-group">
    +  <button class="btn btn-secondary btn-sm dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    +    Small button
    +  </button>
    +  <ul class="dropdown-menu">
    +    ...
    +  </ul>
    +</div>
    +<div class="btn-group">
    +  <button class="btn btn-secondary btn-sm" type="button">
    +    Small split button
    +  </button>
    +  <button type="button" class="btn btn-sm btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    +    <span class="visually-hidden">Toggle Dropdown</span>
    +  </button>
    +  <ul class="dropdown-menu">
    +    ...
    +  </ul>
    +</div>
    +
    +

    Dark dropdowns

    + +Deprecated in v5.3.0

    Opt into darker dropdowns to match a dark navbar or custom style by adding .dropdown-menu-dark onto an existing .dropdown-menu. No changes are required to the dropdown items.

    -
    -

    - Heads up! Dark variants for components were deprecated in v5.3.0 with the introduction of color modes. Instead of adding .dropdown-menu-dark, set data-bs-theme="dark" on the root element, a parent wrapper, or the component itself. -

    -
    - -
    -
    - -
    html
    <div class="dropdown">
    +  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    +    Dropdown button
    +  </button>
    +  <ul class="dropdown-menu dropdown-menu-dark">
    +    <li><a class="dropdown-item active" href="#">Action</a></li>
    +    <li><a class="dropdown-item" href="#">Another action</a></li>
    +    <li><a class="dropdown-item" href="#">Something else here</a></li>
    +    <li><hr class="dropdown-divider"></li>
    +    <li><a class="dropdown-item" href="#">Separated link</a></li>
    +  </ul>
    +</div>

    And putting it to use in a navbar:

    -
    -
    - - - -
    - html -
    - - -
    -
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
    -  <div class="container-fluid">
    -    <a class="navbar-brand" href="#">Navbar</a>
    -    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDarkDropdown" aria-controls="navbarNavDarkDropdown" aria-expanded="false" aria-label="Toggle navigation">
    -      <span class="navbar-toggler-icon"></span>
    -    </button>
    -    <div class="collapse navbar-collapse" id="navbarNavDarkDropdown">
    -      <ul class="navbar-nav">
    -        <li class="nav-item dropdown">
    -          <button class="btn btn-dark dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    -            Dropdown
    -          </button>
    -          <ul class="dropdown-menu dropdown-menu-dark">
    -            <li><a class="dropdown-item" href="#">Action</a></li>
    -            <li><a class="dropdown-item" href="#">Another action</a></li>
    -            <li><a class="dropdown-item" href="#">Something else here</a></li>
    -          </ul>
    -        </li>
    -      </ul>
    -    </div>
    -  </div>
    -</nav>
    -
    - -

    Directions

    -
    -Directions are flipped in RTL mode. As such, .dropstart will appear on the right side. -
    - -

    Centered

    +
    html
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
    +  <div class="container-fluid">
    +    <a class="navbar-brand" href="#">Navbar</a>
    +    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDarkDropdown" aria-controls="navbarNavDarkDropdown" aria-expanded="false" aria-label="Toggle navigation">
    +      <span class="navbar-toggler-icon"></span>
    +    </button>
    +    <div class="collapse navbar-collapse" id="navbarNavDarkDropdown">
    +      <ul class="navbar-nav">
    +        <li class="nav-item dropdown">
    +          <button class="btn btn-dark dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    +            Dropdown
    +          </button>
    +          <ul class="dropdown-menu dropdown-menu-dark">
    +            <li><a class="dropdown-item" href="#">Action</a></li>
    +            <li><a class="dropdown-item" href="#">Another action</a></li>
    +            <li><a class="dropdown-item" href="#">Something else here</a></li>
    +          </ul>
    +        </li>
    +      </ul>
    +    </div>
    +  </div>
    +</nav>
    +

    Directions

    +

    Directions are flipped in RTL mode. As such, .dropstart will appear on the right side.

    +

    Centered

    Make the dropdown menu centered below the toggle with .dropdown-center on the parent element.

    -
    -
    - -
    html
    <div class="dropdown-center">
    +  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    +    Centered dropdown
    +  </button>
    +  <ul class="dropdown-menu">
    +    <li><a class="dropdown-item" href="#">Action</a></li>
    +    <li><a class="dropdown-item" href="#">Action two</a></li>
    +    <li><a class="dropdown-item" href="#">Action three</a></li>
    +  </ul>
    +</div>
    +

    Dropup

    Trigger dropdown menus above elements by adding .dropup to the parent element.

    -
    - -
    - - - -
    +
    -
    <!-- Default dropup button -->
    -<div class="btn-group dropup">
    -  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    -    Dropup
    -  </button>
    -  <ul class="dropdown-menu">
    -    <!-- Dropdown menu links -->
    -  </ul>
    -</div>
    -
    -<!-- Split dropup button -->
    -<div class="btn-group dropup">
    -  <button type="button" class="btn btn-secondary">
    -    Split dropup
    -  </button>
    -  <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    -    <span class="visually-hidden">Toggle Dropdown</span>
    -  </button>
    -  <ul class="dropdown-menu">
    -    <!-- Dropdown menu links -->
    -  </ul>
    -</div>
    -

    Dropup centered

    +
    + + + +
    +
    <!-- Default dropup button -->
    +<div class="btn-group dropup">
    +  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    +    Dropup
    +  </button>
    +  <ul class="dropdown-menu">
    +    <!-- Dropdown menu links -->
    +  </ul>
    +</div>
    +
    +<!-- Split dropup button -->
    +<div class="btn-group dropup">
    +  <button type="button" class="btn btn-secondary">
    +    Split dropup
    +  </button>
    +  <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    +    <span class="visually-hidden">Toggle Dropdown</span>
    +  </button>
    +  <ul class="dropdown-menu">
    +    <!-- Dropdown menu links -->
    +  </ul>
    +</div>
    +
    +

    Dropup centered

    Make the dropup menu centered above the toggle with .dropup-center on the parent element.

    -
    -
    - -
    +
    @@ -1192,142 +496,119 @@
  • Action two
  • Action three
  • -
    - -
    - html -
    - - -
    -
    <div class="dropup-center dropup">
    -  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    -    Centered dropup
    -  </button>
    -  <ul class="dropdown-menu">
    -    <li><a class="dropdown-item" href="#">Action</a></li>
    -    <li><a class="dropdown-item" href="#">Action two</a></li>
    -    <li><a class="dropdown-item" href="#">Action three</a></li>
    -  </ul>
    -</div>
    -
    - -

    Dropend

    +
    html
    <div class="dropup-center dropup">
    +  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    +    Centered dropup
    +  </button>
    +  <ul class="dropdown-menu">
    +    <li><a class="dropdown-item" href="#">Action</a></li>
    +    <li><a class="dropdown-item" href="#">Action two</a></li>
    +    <li><a class="dropdown-item" href="#">Action three</a></li>
    +  </ul>
    +</div>
    +

    Dropend

    Trigger dropdown menus at the right of the elements by adding .dropend to the parent element.

    -
    - -
    - - - -
    +
    -
    <!-- Default dropend button -->
    -<div class="btn-group dropend">
    -  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    -    Dropend
    -  </button>
    -  <ul class="dropdown-menu">
    -    <!-- Dropdown menu links -->
    -  </ul>
    -</div>
    -
    -<!-- Split dropend button -->
    -<div class="btn-group dropend">
    -  <button type="button" class="btn btn-secondary">
    -    Split dropend
    -  </button>
    -  <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    -    <span class="visually-hidden">Toggle Dropend</span>
    -  </button>
    -  <ul class="dropdown-menu">
    -    <!-- Dropdown menu links -->
    -  </ul>
    -</div>
    -

    Dropstart

    +
    + + + +
    +
    <!-- Default dropend button -->
    +<div class="btn-group dropend">
    +  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    +    Dropend
    +  </button>
    +  <ul class="dropdown-menu">
    +    <!-- Dropdown menu links -->
    +  </ul>
    +</div>
    +
    +<!-- Split dropend button -->
    +<div class="btn-group dropend">
    +  <button type="button" class="btn btn-secondary">
    +    Split dropend
    +  </button>
    +  <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    +    <span class="visually-hidden">Toggle Dropend</span>
    +  </button>
    +  <ul class="dropdown-menu">
    +    <!-- Dropdown menu links -->
    +  </ul>
    +</div>
    +
    +

    Dropstart

    Trigger dropdown menus at the left of the elements by adding .dropstart to the parent element.

    -
    -
    - - -
    -
    - - - -
    +
    -
    <!-- Default dropstart button -->
    -<div class="btn-group dropstart">
    -  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    -    Dropstart
    -  </button>
    -  <ul class="dropdown-menu">
    -    <!-- Dropdown menu links -->
    -  </ul>
    -</div>
    -
    -<!-- Split dropstart button -->
    -<div class="btn-group dropstart">
    -  <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    -    <span class="visually-hidden">Toggle Dropstart</span>
    -  </button>
    -  <ul class="dropdown-menu">
    -    <!-- Dropdown menu links -->
    -  </ul>
    -  <button type="button" class="btn btn-secondary">
    -    Split dropstart
    -  </button>
    -</div>
    -
    +
    + + + +
    +
    <!-- Default dropstart button -->
    +<div class="btn-group dropstart">
    +  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    +    Dropstart
    +  </button>
    +  <ul class="dropdown-menu">
    +    <!-- Dropdown menu links -->
    +  </ul>
    +</div>
    +
    +<!-- Split dropstart button -->
    +<div class="btn-group dropstart">
    +  <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    +    <span class="visually-hidden">Toggle Dropstart</span>
    +  </button>
    +  <ul class="dropdown-menu">
    +    <!-- Dropdown menu links -->
    +  </ul>
    +  <button type="button" class="btn btn-secondary">
    +    Split dropstart
    +  </button>
    +</div>
    +
    +

    You can use <a> or <button> elements as dropdown items.

    -
    -
    - -
    html
    <div class="dropdown">
    +  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    +    Dropdown
    +  </button>
    +  <ul class="dropdown-menu">
    +    <li><button class="dropdown-item" type="button">Action</button></li>
    +    <li><button class="dropdown-item" type="button">Another action</button></li>
    +    <li><button class="dropdown-item" type="button">Something else here</button></li>
    +  </ul>
    +</div>

    You can also create non-interactive dropdown items with .dropdown-item-text. Feel free to style further with custom CSS or text utilities.

    -
    -
    - -
    html
    <ul class="dropdown-menu">
    +  <li><span class="dropdown-item-text">Dropdown item text</span></li>
    +  <li><a class="dropdown-item" href="#">Action</a></li>
    +  <li><a class="dropdown-item" href="#">Another action</a></li>
    +  <li><a class="dropdown-item" href="#">Something else here</a></li>
    +</ul>
    +

    Active

    Add .active to items in the dropdown to style them as active. To convey the active state to assistive technologies, use the aria-current attribute — using the page value for the current page, or true for the current item in a set.

    -
    -
    - -
    html
    <ul class="dropdown-menu">
    +  <li><a class="dropdown-item" href="#">Regular link</a></li>
    +  <li><a class="dropdown-item active" href="#" aria-current="true">Active link</a></li>
    +  <li><a class="dropdown-item" href="#">Another link</a></li>
    +</ul>
    +

    Disabled

    Add .disabled to items in the dropdown to style them as disabled.

    -
    -
    - -
    html
    <ul class="dropdown-menu">
    +  <li><a class="dropdown-item" href="#">Regular link</a></li>
    +  <li><a class="dropdown-item disabled" aria-disabled="true">Disabled link</a></li>
    +  <li><a class="dropdown-item" href="#">Another link</a></li>
    +</ul>
    +

    By default, a dropdown menu is automatically positioned 100% from the top and along the left side of its parent. You can change this with the directional .drop* classes, but you can also control them with additional modifier classes.

    Add .dropdown-menu-end to a .dropdown-menu to right align the dropdown menu. Directions are mirrored when using Bootstrap in RTL, meaning .dropdown-menu-end will appear on the left side.

    -
    -Heads up! Dropdowns are positioned thanks to Popper except when they are contained in a navbar. -
    - -
    -
    - -
    +

    Heads up! Dropdowns are positioned thanks to Popper except when they are contained in a navbar.

    +
    @@ -1464,37 +674,20 @@
  • -
    - -
    - html -
    - - -
    -
    <div class="btn-group">
    -  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    -    Right-aligned menu example
    -  </button>
    -  <ul class="dropdown-menu dropdown-menu-end">
    -    <li><button class="dropdown-item" type="button">Action</button></li>
    -    <li><button class="dropdown-item" type="button">Another action</button></li>
    -    <li><button class="dropdown-item" type="button">Something else here</button></li>
    -  </ul>
    -</div>
    -
    - -

    Responsive alignment

    +
    html
    <div class="btn-group">
    +  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    +    Right-aligned menu example
    +  </button>
    +  <ul class="dropdown-menu dropdown-menu-end">
    +    <li><button class="dropdown-item" type="button">Action</button></li>
    +    <li><button class="dropdown-item" type="button">Another action</button></li>
    +    <li><button class="dropdown-item" type="button">Something else here</button></li>
    +  </ul>
    +</div>
    +

    Responsive alignment

    If you want to use responsive alignment, disable dynamic positioning by adding the data-bs-display="static" attribute and use the responsive variation classes.

    To align right the dropdown menu with the given breakpoint or larger, add .dropdown-menu{-sm|-md|-lg|-xl|-xxl}-end.

    -
    -
    - -
    +
    @@ -1503,35 +696,18 @@
  • -
    - -
    - html -
    - - -
    -
    <div class="btn-group">
    -  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" data-bs-display="static" aria-expanded="false">
    -    Left-aligned but right aligned when large screen
    -  </button>
    -  <ul class="dropdown-menu dropdown-menu-lg-end">
    -    <li><button class="dropdown-item" type="button">Action</button></li>
    -    <li><button class="dropdown-item" type="button">Another action</button></li>
    -    <li><button class="dropdown-item" type="button">Something else here</button></li>
    -  </ul>
    -</div>
    -
    - +
    html
    <div class="btn-group">
    +  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" data-bs-display="static" aria-expanded="false">
    +    Left-aligned but right aligned when large screen
    +  </button>
    +  <ul class="dropdown-menu dropdown-menu-lg-end">
    +    <li><button class="dropdown-item" type="button">Action</button></li>
    +    <li><button class="dropdown-item" type="button">Another action</button></li>
    +    <li><button class="dropdown-item" type="button">Something else here</button></li>
    +  </ul>
    +</div>

    To align left the dropdown menu with the given breakpoint or larger, add .dropdown-menu-end and .dropdown-menu{-sm|-md|-lg|-xl|-xxl}-start.

    -
    -
    - -
    +
    @@ -1540,37 +716,20 @@
  • -
    - -
    - html -
    - - -
    -
    <div class="btn-group">
    -  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" data-bs-display="static" aria-expanded="false">
    -    Right-aligned but left aligned when large screen
    -  </button>
    -  <ul class="dropdown-menu dropdown-menu-end dropdown-menu-lg-start">
    -    <li><button class="dropdown-item" type="button">Action</button></li>
    -    <li><button class="dropdown-item" type="button">Another action</button></li>
    -    <li><button class="dropdown-item" type="button">Something else here</button></li>
    -  </ul>
    -</div>
    -
    - -

    Note that you don’t need to add a data-bs-display="static" attribute to dropdown buttons in navbars, since Popper isn’t used in navbars.

    -

    Alignment options

    -

    Taking most of the options shown above, here’s a small kitchen sink demo of various dropdown alignment options in one place.

    -
    -
    - -
    +
    html
    <div class="btn-group">
    +  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" data-bs-display="static" aria-expanded="false">
    +    Right-aligned but left aligned when large screen
    +  </button>
    +  <ul class="dropdown-menu dropdown-menu-end dropdown-menu-lg-start">
    +    <li><button class="dropdown-item" type="button">Action</button></li>
    +    <li><button class="dropdown-item" type="button">Another action</button></li>
    +    <li><button class="dropdown-item" type="button">Something else here</button></li>
    +  </ul>
    +</div>
    +

    Note that you don’t need to add a data-bs-display="static" attribute to dropdown buttons in navbars, since Popper isn’t used in navbars.

    +

    Alignment options

    +

    Taking most of the options shown above, here’s a small kitchen sink demo of various dropdown alignment options in one place.

    +
    @@ -1645,197 +804,129 @@
  • Menu item
  • Menu item
  • -
    +
    html
    <div class="btn-group">
    +  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    +    Dropdown
    +  </button>
    +  <ul class="dropdown-menu">
    +    <li><a class="dropdown-item" href="#">Menu item</a></li>
    +    <li><a class="dropdown-item" href="#">Menu item</a></li>
    +    <li><a class="dropdown-item" href="#">Menu item</a></li>
    +  </ul>
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="btn-group">
    -  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    -    Dropdown
    -  </button>
    -  <ul class="dropdown-menu">
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -  </ul>
    -</div>
    -
    -<div class="btn-group">
    -  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    -    Right-aligned menu
    -  </button>
    -  <ul class="dropdown-menu dropdown-menu-end">
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -  </ul>
    -</div>
    -
    -<div class="btn-group">
    -  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" data-bs-display="static" aria-expanded="false">
    -    Left-aligned, right-aligned lg
    -  </button>
    -  <ul class="dropdown-menu dropdown-menu-lg-end">
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -  </ul>
    -</div>
    -
    -<div class="btn-group">
    -  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" data-bs-display="static" aria-expanded="false">
    -    Right-aligned, left-aligned lg
    -  </button>
    -  <ul class="dropdown-menu dropdown-menu-end dropdown-menu-lg-start">
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -  </ul>
    -</div>
    -
    -<div class="btn-group dropstart">
    -  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    -    Dropstart
    -  </button>
    -  <ul class="dropdown-menu">
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -  </ul>
    -</div>
    -
    -<div class="btn-group dropend">
    -  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    -    Dropend
    -  </button>
    -  <ul class="dropdown-menu">
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -  </ul>
    -</div>
    -
    -<div class="btn-group dropup">
    -  <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
    -    Dropup
    -  </button>
    -  <ul class="dropdown-menu">
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -  </ul>
    -</div>
    -
    +<div class="btn-group"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> + Right-aligned menu + </button> + <ul class="dropdown-menu dropdown-menu-end"> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + </ul> +</div> - -

    Headers

    +<div class="btn-group"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" data-bs-display="static" aria-expanded="false"> + Left-aligned, right-aligned lg + </button> + <ul class="dropdown-menu dropdown-menu-lg-end"> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + </ul> +</div> + +<div class="btn-group"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" data-bs-display="static" aria-expanded="false"> + Right-aligned, left-aligned lg + </button> + <ul class="dropdown-menu dropdown-menu-end dropdown-menu-lg-start"> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + </ul> +</div> + +<div class="btn-group dropstart"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> + Dropstart + </button> + <ul class="dropdown-menu"> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + </ul> +</div> + +<div class="btn-group dropend"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> + Dropend + </button> + <ul class="dropdown-menu"> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + </ul> +</div> + +<div class="btn-group dropup"> + <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false"> + Dropup + </button> + <ul class="dropdown-menu"> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + </ul> +</div>
    + +

    Headers

    Add a header to label sections of actions in any dropdown menu.

    -
    -
    - -
    html
    <ul class="dropdown-menu">
    +  <li><h6 class="dropdown-header">Dropdown header</h6></li>
    +  <li><a class="dropdown-item" href="#">Action</a></li>
    +  <li><a class="dropdown-item" href="#">Another action</a></li>
    +</ul>
    +

    Dividers

    Separate groups of related menu items with a divider.

    -
    -
    - -
    html
    <ul class="dropdown-menu">
    +  <li><a class="dropdown-item" href="#">Action</a></li>
    +  <li><a class="dropdown-item" href="#">Another action</a></li>
    +  <li><a class="dropdown-item" href="#">Something else here</a></li>
    +  <li><hr class="dropdown-divider"></li>
    +  <li><a class="dropdown-item" href="#">Separated link</a></li>
    +</ul>
    +

    Text

    +

    Place any freeform text within a dropdown menu with text and use spacing utilities. Note that you’ll likely need additional sizing styles to constrain the menu width.

    +
    - -
    - html -
    - - -
    -
    <div class="dropdown-menu p-4 text-body-secondary" style="max-width: 200px;">
    -  <p>
    -    Some example text that's free-flowing within the dropdown menu.
    -  </p>
    -  <p class="mb-0">
    -    And this is more example text.
    -  </p>
    -</div>
    -
    - -

    Forms

    -

    Put a form within a dropdown menu, or make it into a dropdown menu, and use margin or padding utilities to give it the negative space you require.

    -
    -
    - -
    html
    <div class="dropdown-menu p-4 text-body-secondary" style="max-width: 200px;">
    +  <p>
    +    Some example text that’s free-flowing within the dropdown menu.
    +  </p>
    +  <p class="mb-0">
    +    And this is more example text.
    +  </p>
    +</div>
    +

    Forms

    +

    Put a form within a dropdown menu, or make it into a dropdown menu, and use margin or padding utilities to give it the negative space you require.

    +
    - html -
    - - -
    -
    <div class="dropdown-menu">
    -  <form class="px-4 py-3">
    -    <div class="mb-3">
    -      <label for="exampleDropdownFormEmail1" class="form-label">Email address</label>
    -      <input type="email" class="form-control" id="exampleDropdownFormEmail1" placeholder="email@example.com">
    -    </div>
    -    <div class="mb-3">
    -      <label for="exampleDropdownFormPassword1" class="form-label">Password</label>
    -      <input type="password" class="form-control" id="exampleDropdownFormPassword1" placeholder="Password">
    -    </div>
    -    <div class="mb-3">
    -      <div class="form-check">
    -        <input type="checkbox" class="form-check-input" id="dropdownCheck">
    -        <label class="form-check-label" for="dropdownCheck">
    -          Remember me
    -        </label>
    -      </div>
    -    </div>
    -    <button type="submit" class="btn btn-primary">Sign in</button>
    -  </form>
    -  <div class="dropdown-divider"></div>
    -  <a class="dropdown-item" href="#">New around here? Sign up</a>
    -  <a class="dropdown-item" href="#">Forgot password?</a>
    -</div>
    -
    - -
    -
    - -
    html
    <div class="dropdown-menu">
    +  <form class="px-4 py-3">
    +    <div class="mb-3">
    +      <label for="exampleDropdownFormEmail1" class="form-label">Email address</label>
    +      <input type="email" class="form-control" id="exampleDropdownFormEmail1" placeholder="email@example.com">
    +    </div>
    +    <div class="mb-3">
    +      <label for="exampleDropdownFormPassword1" class="form-label">Password</label>
    +      <input type="password" class="form-control" id="exampleDropdownFormPassword1" placeholder="Password">
    +    </div>
    +    <div class="mb-3">
    +      <div class="form-check">
    +        <input type="checkbox" class="form-check-input" id="dropdownCheck">
    +        <label class="form-check-label" for="dropdownCheck">
    +          Remember me
    +        </label>
    +      </div>
    +    </div>
    +    <button type="submit" class="btn btn-primary">Sign in</button>
    +  </form>
    +  <div class="dropdown-divider"></div>
    +  <a class="dropdown-item" href="#">New around here? Sign up</a>
    +  <a class="dropdown-item" href="#">Forgot password?</a>
    +</div>
    +
    -
    - -
    - html -
    - - -
    -
    <div class="dropdown">
    -  <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" data-bs-auto-close="outside">
    -    Dropdown form
    -  </button>
    -  <form class="dropdown-menu p-4">
    -    <div class="mb-3">
    -      <label for="exampleDropdownFormEmail2" class="form-label">Email address</label>
    -      <input type="email" class="form-control" id="exampleDropdownFormEmail2" placeholder="email@example.com">
    -    </div>
    -    <div class="mb-3">
    -      <label for="exampleDropdownFormPassword2" class="form-label">Password</label>
    -      <input type="password" class="form-control" id="exampleDropdownFormPassword2" placeholder="Password">
    -    </div>
    -    <div class="mb-3">
    -      <div class="form-check">
    -        <input type="checkbox" class="form-check-input" id="dropdownCheck2">
    -        <label class="form-check-label" for="dropdownCheck2">
    -          Remember me
    -        </label>
    -      </div>
    -    </div>
    -    <button type="submit" class="btn btn-primary">Sign in</button>
    -  </form>
    -</div>
    -
    - - +
    html
    <div class="dropdown">
    +  <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" data-bs-auto-close="outside">
    +    Dropdown form
    +  </button>
    +  <form class="dropdown-menu p-4">
    +    <div class="mb-3">
    +      <label for="exampleDropdownFormEmail2" class="form-label">Email address</label>
    +      <input type="email" class="form-control" id="exampleDropdownFormEmail2" placeholder="email@example.com">
    +    </div>
    +    <div class="mb-3">
    +      <label for="exampleDropdownFormPassword2" class="form-label">Password</label>
    +      <input type="password" class="form-control" id="exampleDropdownFormPassword2" placeholder="Password">
    +    </div>
    +    <div class="mb-3">
    +      <div class="form-check">
    +        <input type="checkbox" class="form-check-input" id="dropdownCheck2">
    +        <label class="form-check-label" for="dropdownCheck2">
    +          Remember me
    +        </label>
    +      </div>
    +    </div>
    +    <button type="submit" class="btn btn-primary">Sign in</button>
    +  </form>
    +</div>
    +

    Use data-bs-offset or data-bs-reference to change the location of the dropdown.

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="d-flex">
    -  <div class="dropdown me-1">
    -    <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" data-bs-offset="10,20">
    -      Offset
    -    </button>
    -    <ul class="dropdown-menu">
    -      <li><a class="dropdown-item" href="#">Action</a></li>
    -      <li><a class="dropdown-item" href="#">Another action</a></li>
    -      <li><a class="dropdown-item" href="#">Something else here</a></li>
    -    </ul>
    -  </div>
    -  <div class="btn-group">
    -    <button type="button" class="btn btn-secondary">Reference</button>
    -    <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false" data-bs-reference="parent">
    -      <span class="visually-hidden">Toggle Dropdown</span>
    -    </button>
    -    <ul class="dropdown-menu">
    -      <li><a class="dropdown-item" href="#">Action</a></li>
    -      <li><a class="dropdown-item" href="#">Another action</a></li>
    -      <li><a class="dropdown-item" href="#">Something else here</a></li>
    -      <li><hr class="dropdown-divider"></li>
    -      <li><a class="dropdown-item" href="#">Separated link</a></li>
    -    </ul>
    -  </div>
    -</div>
    -
    - -

    Auto close behavior

    +
    html
    <div class="d-flex">
    +  <div class="dropdown me-1">
    +    <button type="button" class="btn btn-secondary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" data-bs-offset="10,20">
    +      Offset
    +    </button>
    +    <ul class="dropdown-menu">
    +      <li><a class="dropdown-item" href="#">Action</a></li>
    +      <li><a class="dropdown-item" href="#">Another action</a></li>
    +      <li><a class="dropdown-item" href="#">Something else here</a></li>
    +    </ul>
    +  </div>
    +  <div class="btn-group">
    +    <button type="button" class="btn btn-secondary">Reference</button>
    +    <button type="button" class="btn btn-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false" data-bs-reference="parent">
    +      <span class="visually-hidden">Toggle Dropdown</span>
    +    </button>
    +    <ul class="dropdown-menu">
    +      <li><a class="dropdown-item" href="#">Action</a></li>
    +      <li><a class="dropdown-item" href="#">Another action</a></li>
    +      <li><a class="dropdown-item" href="#">Something else here</a></li>
    +      <li><hr class="dropdown-divider"></li>
    +      <li><a class="dropdown-item" href="#">Separated link</a></li>
    +    </ul>
    +  </div>
    +</div>
    +

    Auto close behavior

    By default, the dropdown menu is closed when clicking inside or outside the dropdown menu. You can use the autoClose option to change this behavior of the dropdown.

    -
    -
    - -
    +
    @@ -2075,520 +1115,376 @@
  • Menu item
  • Menu item
  • -
    +
    html
    <div class="btn-group">
    +  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" data-bs-auto-close="true" aria-expanded="false">
    +    Default dropdown
    +  </button>
    +  <ul class="dropdown-menu">
    +    <li><a class="dropdown-item" href="#">Menu item</a></li>
    +    <li><a class="dropdown-item" href="#">Menu item</a></li>
    +    <li><a class="dropdown-item" href="#">Menu item</a></li>
    +  </ul>
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="btn-group">
    -  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" data-bs-auto-close="true" aria-expanded="false">
    -    Default dropdown
    -  </button>
    -  <ul class="dropdown-menu">
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -  </ul>
    -</div>
    -
    -<div class="btn-group">
    -  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" data-bs-auto-close="inside" aria-expanded="false">
    -    Clickable inside
    -  </button>
    -  <ul class="dropdown-menu">
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -  </ul>
    -</div>
    -
    -<div class="btn-group">
    -  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false">
    -    Clickable outside
    -  </button>
    -  <ul class="dropdown-menu">
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -  </ul>
    -</div>
    -
    -<div class="btn-group">
    -  <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" data-bs-auto-close="false" aria-expanded="false">
    -    Manual close
    -  </button>
    -  <ul class="dropdown-menu">
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -    <li><a class="dropdown-item" href="#">Menu item</a></li>
    -  </ul>
    -</div>
    -
    +<div class="btn-group"> + <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" data-bs-auto-close="inside" aria-expanded="false"> + Clickable inside + </button> + <ul class="dropdown-menu"> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + </ul> +</div> -

    CSS

    -

    Variables

    +<div class="btn-group"> + <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" data-bs-auto-close="outside" aria-expanded="false"> + Clickable outside + </button> + <ul class="dropdown-menu"> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + </ul> +</div> + +<div class="btn-group"> + <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" data-bs-auto-close="false" aria-expanded="false"> + Manual close + </button> + <ul class="dropdown-menu"> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + <li><a class="dropdown-item" href="#">Menu item</a></li> + </ul> +</div>
    +

    CSS

    +

    Variables

    Added in v5.2.0 - -

    As part of Bootstrap’s evolving CSS variables approach, dropdowns now use local CSS variables on .dropdown-menu for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    -
    -
    - scss/_dropdown.scss -
    - -
    -
    --#{$prefix}dropdown-zindex: #{$zindex-dropdown};
    ---#{$prefix}dropdown-min-width: #{$dropdown-min-width};
    ---#{$prefix}dropdown-padding-x: #{$dropdown-padding-x};
    ---#{$prefix}dropdown-padding-y: #{$dropdown-padding-y};
    ---#{$prefix}dropdown-spacer: #{$dropdown-spacer};
    -@include rfs($dropdown-font-size, --#{$prefix}dropdown-font-size);
    ---#{$prefix}dropdown-color: #{$dropdown-color};
    ---#{$prefix}dropdown-bg: #{$dropdown-bg};
    ---#{$prefix}dropdown-border-color: #{$dropdown-border-color};
    ---#{$prefix}dropdown-border-radius: #{$dropdown-border-radius};
    ---#{$prefix}dropdown-border-width: #{$dropdown-border-width};
    ---#{$prefix}dropdown-inner-border-radius: #{$dropdown-inner-border-radius};
    ---#{$prefix}dropdown-divider-bg: #{$dropdown-divider-bg};
    ---#{$prefix}dropdown-divider-margin-y: #{$dropdown-divider-margin-y};
    ---#{$prefix}dropdown-box-shadow: #{$dropdown-box-shadow};
    ---#{$prefix}dropdown-link-color: #{$dropdown-link-color};
    ---#{$prefix}dropdown-link-hover-color: #{$dropdown-link-hover-color};
    ---#{$prefix}dropdown-link-hover-bg: #{$dropdown-link-hover-bg};
    ---#{$prefix}dropdown-link-active-color: #{$dropdown-link-active-color};
    ---#{$prefix}dropdown-link-active-bg: #{$dropdown-link-active-bg};
    ---#{$prefix}dropdown-link-disabled-color: #{$dropdown-link-disabled-color};
    ---#{$prefix}dropdown-item-padding-x: #{$dropdown-item-padding-x};
    ---#{$prefix}dropdown-item-padding-y: #{$dropdown-item-padding-y};
    ---#{$prefix}dropdown-header-color: #{$dropdown-header-color};
    ---#{$prefix}dropdown-header-padding-x: #{$dropdown-header-padding-x};
    ---#{$prefix}dropdown-header-padding-y: #{$dropdown-header-padding-y};
    -
    -

    Dropdown items include at least one variable that is not set on .dropdown. This allows you to provide a new value while Bootstrap defaults to a fallback value.

    -
      +

      As part of Bootstrap’s evolving CSS variables approach, dropdowns now use local CSS variables on .dropdown-menu for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

      +
      --#{$prefix}dropdown-zindex: #{$zindex-dropdown};
      +--#{$prefix}dropdown-min-width: #{$dropdown-min-width};
      +--#{$prefix}dropdown-padding-x: #{$dropdown-padding-x};
      +--#{$prefix}dropdown-padding-y: #{$dropdown-padding-y};
      +--#{$prefix}dropdown-spacer: #{$dropdown-spacer};
      +@include rfs($dropdown-font-size, --#{$prefix}dropdown-font-size);
      +--#{$prefix}dropdown-color: #{$dropdown-color};
      +--#{$prefix}dropdown-bg: #{$dropdown-bg};
      +--#{$prefix}dropdown-border-color: #{$dropdown-border-color};
      +--#{$prefix}dropdown-border-radius: #{$dropdown-border-radius};
      +--#{$prefix}dropdown-border-width: #{$dropdown-border-width};
      +--#{$prefix}dropdown-inner-border-radius: #{$dropdown-inner-border-radius};
      +--#{$prefix}dropdown-divider-bg: #{$dropdown-divider-bg};
      +--#{$prefix}dropdown-divider-margin-y: #{$dropdown-divider-margin-y};
      +--#{$prefix}dropdown-box-shadow: #{$dropdown-box-shadow};
      +--#{$prefix}dropdown-link-color: #{$dropdown-link-color};
      +--#{$prefix}dropdown-link-hover-color: #{$dropdown-link-hover-color};
      +--#{$prefix}dropdown-link-hover-bg: #{$dropdown-link-hover-bg};
      +--#{$prefix}dropdown-link-active-color: #{$dropdown-link-active-color};
      +--#{$prefix}dropdown-link-active-bg: #{$dropdown-link-active-bg};
      +--#{$prefix}dropdown-link-disabled-color: #{$dropdown-link-disabled-color};
      +--#{$prefix}dropdown-item-padding-x: #{$dropdown-item-padding-x};
      +--#{$prefix}dropdown-item-padding-y: #{$dropdown-item-padding-y};
      +--#{$prefix}dropdown-header-color: #{$dropdown-header-color};
      +--#{$prefix}dropdown-header-padding-x: #{$dropdown-header-padding-x};
      +--#{$prefix}dropdown-header-padding-y: #{$dropdown-header-padding-y};
      +
      +

      Dropdown items include at least one variable that is not set on .dropdown. This allows you to provide a new value while Bootstrap defaults to a fallback value.

      • --bs-dropdown-item-border-radius
      • -
      -
      - +

    Customization through CSS variables can be seen on the .dropdown-menu-dark class where we override specific values without adding duplicate CSS selectors.

    -
    -
    - scss/_dropdown.scss -
    - -
    -
    --#{$prefix}dropdown-color: #{$dropdown-dark-color};
    ---#{$prefix}dropdown-bg: #{$dropdown-dark-bg};
    ---#{$prefix}dropdown-border-color: #{$dropdown-dark-border-color};
    ---#{$prefix}dropdown-box-shadow: #{$dropdown-dark-box-shadow};
    ---#{$prefix}dropdown-link-color: #{$dropdown-dark-link-color};
    ---#{$prefix}dropdown-link-hover-color: #{$dropdown-dark-link-hover-color};
    ---#{$prefix}dropdown-divider-bg: #{$dropdown-dark-divider-bg};
    ---#{$prefix}dropdown-link-hover-bg: #{$dropdown-dark-link-hover-bg};
    ---#{$prefix}dropdown-link-active-color: #{$dropdown-dark-link-active-color};
    ---#{$prefix}dropdown-link-active-bg: #{$dropdown-dark-link-active-bg};
    ---#{$prefix}dropdown-link-disabled-color: #{$dropdown-dark-link-disabled-color};
    ---#{$prefix}dropdown-header-color: #{$dropdown-dark-header-color};
    -

    Sass variables

    +
    --#{$prefix}dropdown-color: #{$dropdown-dark-color};
    +--#{$prefix}dropdown-bg: #{$dropdown-dark-bg};
    +--#{$prefix}dropdown-border-color: #{$dropdown-dark-border-color};
    +--#{$prefix}dropdown-box-shadow: #{$dropdown-dark-box-shadow};
    +--#{$prefix}dropdown-link-color: #{$dropdown-dark-link-color};
    +--#{$prefix}dropdown-link-hover-color: #{$dropdown-dark-link-hover-color};
    +--#{$prefix}dropdown-divider-bg: #{$dropdown-dark-divider-bg};
    +--#{$prefix}dropdown-link-hover-bg: #{$dropdown-dark-link-hover-bg};
    +--#{$prefix}dropdown-link-active-color: #{$dropdown-dark-link-active-color};
    +--#{$prefix}dropdown-link-active-bg: #{$dropdown-dark-link-active-bg};
    +--#{$prefix}dropdown-link-disabled-color: #{$dropdown-dark-link-disabled-color};
    +--#{$prefix}dropdown-header-color: #{$dropdown-dark-header-color};
    +
    +

    Sass variables

    Variables for all dropdowns:

    -
    -
    - scss/_variables.scss -
    - -
    -
    $dropdown-min-width:                10rem;
    -$dropdown-padding-x:                0;
    -$dropdown-padding-y:                .5rem;
    -$dropdown-spacer:                   .125rem;
    -$dropdown-font-size:                $font-size-base;
    -$dropdown-color:                    var(--#{$prefix}body-color);
    -$dropdown-bg:                       var(--#{$prefix}body-bg);
    -$dropdown-border-color:             var(--#{$prefix}border-color-translucent);
    -$dropdown-border-radius:            var(--#{$prefix}border-radius);
    -$dropdown-border-width:             var(--#{$prefix}border-width);
    -$dropdown-inner-border-radius:      calc(#{$dropdown-border-radius} - #{$dropdown-border-width}); // stylelint-disable-line function-disallowed-list
    -$dropdown-divider-bg:               $dropdown-border-color;
    -$dropdown-divider-margin-y:         $spacer * .5;
    -$dropdown-box-shadow:               var(--#{$prefix}box-shadow);
    -
    -$dropdown-link-color:               var(--#{$prefix}body-color);
    -$dropdown-link-hover-color:         $dropdown-link-color;
    -$dropdown-link-hover-bg:            var(--#{$prefix}tertiary-bg);
    -
    -$dropdown-link-active-color:        $component-active-color;
    -$dropdown-link-active-bg:           $component-active-bg;
    -
    -$dropdown-link-disabled-color:      var(--#{$prefix}tertiary-color);
    -
    -$dropdown-item-padding-y:           $spacer * .25;
    -$dropdown-item-padding-x:           $spacer;
    -
    -$dropdown-header-color:             $gray-600;
    -$dropdown-header-padding-x:         $dropdown-item-padding-x;
    -$dropdown-header-padding-y:         $dropdown-padding-y;
    -// fusv-disable
    -$dropdown-header-padding:           $dropdown-header-padding-y $dropdown-header-padding-x; // Deprecated in v5.2.0
    -// fusv-enable
    -
    +
    $dropdown-min-width:                10rem;
    +$dropdown-padding-x:                0;
    +$dropdown-padding-y:                .5rem;
    +$dropdown-spacer:                   .125rem;
    +$dropdown-font-size:                $font-size-base;
    +$dropdown-color:                    var(--#{$prefix}body-color);
    +$dropdown-bg:                       var(--#{$prefix}body-bg);
    +$dropdown-border-color:             var(--#{$prefix}border-color-translucent);
    +$dropdown-border-radius:            var(--#{$prefix}border-radius);
    +$dropdown-border-width:             var(--#{$prefix}border-width);
    +$dropdown-inner-border-radius:      calc(#{$dropdown-border-radius} - #{$dropdown-border-width}); // stylelint-disable-line function-disallowed-list
    +$dropdown-divider-bg:               $dropdown-border-color;
    +$dropdown-divider-margin-y:         $spacer * .5;
    +$dropdown-box-shadow:               var(--#{$prefix}box-shadow);
    +
    +$dropdown-link-color:               var(--#{$prefix}body-color);
    +$dropdown-link-hover-color:         $dropdown-link-color;
    +$dropdown-link-hover-bg:            var(--#{$prefix}tertiary-bg);
    +
    +$dropdown-link-active-color:        $component-active-color;
    +$dropdown-link-active-bg:           $component-active-bg;
    +
    +$dropdown-link-disabled-color:      var(--#{$prefix}tertiary-color);
    +
    +$dropdown-item-padding-y:           $spacer * .25;
    +$dropdown-item-padding-x:           $spacer;
    +
    +$dropdown-header-color:             $gray-600;
    +$dropdown-header-padding-x:         $dropdown-item-padding-x;
    +$dropdown-header-padding-y:         $dropdown-padding-y;
    +// fusv-disable
    +$dropdown-header-padding:           $dropdown-header-padding-y $dropdown-header-padding-x; // Deprecated in v5.2.0
    +// fusv-enable
    +

    Variables for the dark dropdown:

    -
    -
    - scss/_variables.scss -
    - -
    -
    $dropdown-dark-color:               $gray-300;
    -$dropdown-dark-bg:                  $gray-800;
    -$dropdown-dark-border-color:        $dropdown-border-color;
    -$dropdown-dark-divider-bg:          $dropdown-divider-bg;
    -$dropdown-dark-box-shadow:          null;
    -$dropdown-dark-link-color:          $dropdown-dark-color;
    -$dropdown-dark-link-hover-color:    $white;
    -$dropdown-dark-link-hover-bg:       rgba($white, .15);
    -$dropdown-dark-link-active-color:   $dropdown-link-active-color;
    -$dropdown-dark-link-active-bg:      $dropdown-link-active-bg;
    -$dropdown-dark-link-disabled-color: $gray-500;
    -$dropdown-dark-header-color:        $gray-500;
    -
    -

    Variables for the CSS-based carets that indicate a dropdown’s interactivity:

    -
    -
    - scss/_variables.scss -
    - -
    -
    $caret-width:                 .3em;
    -$caret-vertical-align:        $caret-width * .85;
    -$caret-spacing:               $caret-width * .85;
    -
    -

    Sass mixins

    +
    $dropdown-dark-color:               $gray-300;
    +$dropdown-dark-bg:                  $gray-800;
    +$dropdown-dark-border-color:        $dropdown-border-color;
    +$dropdown-dark-divider-bg:          $dropdown-divider-bg;
    +$dropdown-dark-box-shadow:          null;
    +$dropdown-dark-link-color:          $dropdown-dark-color;
    +$dropdown-dark-link-hover-color:    $white;
    +$dropdown-dark-link-hover-bg:       rgba($white, .15);
    +$dropdown-dark-link-active-color:   $dropdown-link-active-color;
    +$dropdown-dark-link-active-bg:      $dropdown-link-active-bg;
    +$dropdown-dark-link-disabled-color: $gray-500;
    +$dropdown-dark-header-color:        $gray-500;
    +
    +

    Variables for the CSS-based carets that indicate a dropdown’s interactivity:

    +
    $caret-width:                 .3em;
    +$caret-vertical-align:        $caret-width * .85;
    +$caret-spacing:               $caret-width * .85;
    +
    +

    Sass mixins

    Mixins are used to generate the CSS-based carets and can be found in scss/mixins/_caret.scss.

    -
    -
    - scss/mixins/_caret.scss -
    - -
    -
    @mixin caret-down($width: $caret-width) {
    -  border-top: $width solid;
    -  border-right: $width solid transparent;
    -  border-bottom: 0;
    -  border-left: $width solid transparent;
    -}
    -
    -@mixin caret-up($width: $caret-width) {
    -  border-top: 0;
    -  border-right: $width solid transparent;
    -  border-bottom: $width solid;
    -  border-left: $width solid transparent;
    -}
    -
    -@mixin caret-end($width: $caret-width) {
    -  border-top: $width solid transparent;
    -  border-right: 0;
    -  border-bottom: $width solid transparent;
    -  border-left: $width solid;
    -}
    -
    -@mixin caret-start($width: $caret-width) {
    -  border-top: $width solid transparent;
    -  border-right: $width solid;
    -  border-bottom: $width solid transparent;
    -}
    -
    -@mixin caret(
    -  $direction: down,
    -  $width: $caret-width,
    -  $spacing: $caret-spacing,
    -  $vertical-align: $caret-vertical-align
    -) {
    -  @if $enable-caret {
    -    &::after {
    -      display: inline-block;
    -      margin-left: $spacing;
    -      vertical-align: $vertical-align;
    -      content: "";
    -      @if $direction == down {
    -        @include caret-down($width);
    -      } @else if $direction == up {
    -        @include caret-up($width);
    -      } @else if $direction == end {
    -        @include caret-end($width);
    -      }
    -    }
    -
    -    @if $direction == start {
    -      &::after {
    -        display: none;
    -      }
    -
    -      &::before {
    -        display: inline-block;
    -        margin-right: $spacing;
    -        vertical-align: $vertical-align;
    -        content: "";
    -        @include caret-start($width);
    -      }
    -    }
    -
    -    &:empty::after {
    -      margin-left: 0;
    -    }
    -  }
    -}
    -
    -

    Usage

    -

    Via data attributes or JavaScript, the dropdown plugin toggles hidden content (dropdown menus) by toggling the .show class on the parent .dropdown-menu. The data-bs-toggle="dropdown" attribute is relied on for closing dropdown menus at an application level, so it’s a good idea to always use it.

    -
    -On touch-enabled devices, opening a dropdown adds empty mouseover handlers to the immediate children of the <body> element. This admittedly ugly hack is necessary to work around a quirk in iOS’ event delegation, which would otherwise prevent a tap anywhere outside of the dropdown from triggering the code that closes the dropdown. Once the dropdown is closed, these additional empty mouseover handlers are removed. -
    +
    @mixin caret-down($width: $caret-width) {
    +  border-top: $width solid;
    +  border-right: $width solid transparent;
    +  border-bottom: 0;
    +  border-left: $width solid transparent;
    +}
     
    -

    Via data attributes

    +@mixin caret-up($width: $caret-width) { + border-top: 0; + border-right: $width solid transparent; + border-bottom: $width solid; + border-left: $width solid transparent; +} + +@mixin caret-end($width: $caret-width) { + border-top: $width solid transparent; + border-right: 0; + border-bottom: $width solid transparent; + border-left: $width solid; +} + +@mixin caret-start($width: $caret-width) { + border-top: $width solid transparent; + border-right: $width solid; + border-bottom: $width solid transparent; +} + +@mixin caret( + $direction: down, + $width: $caret-width, + $spacing: $caret-spacing, + $vertical-align: $caret-vertical-align +) { + @if $enable-caret { + &::after { + display: inline-block; + margin-left: $spacing; + vertical-align: $vertical-align; + content: ""; + @if $direction == down { + @include caret-down($width); + } @else if $direction == up { + @include caret-up($width); + } @else if $direction == end { + @include caret-end($width); + } + } + + @if $direction == start { + &::after { + display: none; + } + + &::before { + display: inline-block; + margin-right: $spacing; + vertical-align: $vertical-align; + content: ""; + @include caret-start($width); + } + } + + &:empty::after { + margin-left: 0; + } + } +} +
    +

    Usage

    +

    Via data attributes or JavaScript, the dropdown plugin toggles hidden content (dropdown menus) by toggling the .show class on the parent .dropdown-menu. The data-bs-toggle="dropdown" attribute is relied on for closing dropdown menus at an application level, so it’s a good idea to always use it.

    +

    On touch-enabled devices, opening a dropdown adds empty mouseover handlers to the immediate children of the <body> element. This admittedly ugly hack is necessary to work around a quirk in iOs’ event delegation, which would otherwise prevent a tap anywhere outside of the dropdown from triggering the code that closes the dropdown. Once the dropdown is closed, these additional empty mouseover handlers are removed.

    +

    Via data attributes

    Add data-bs-toggle="dropdown" to a link or button to toggle a dropdown.

    -
    <div class="dropdown">
    -  <button type="button" data-bs-toggle="dropdown" aria-expanded="false">
    -    Dropdown trigger
    -  </button>
    -  <ul class="dropdown-menu">
    -    ...
    -  </ul>
    -</div>
    -

    Via JavaScript

    -
    -Dropdowns must have data-bs-toggle="dropdown" on their trigger element, regardless of whether you call your dropdown via JavaScript or use the data-api. -
    - +
    <div class="dropdown">
    +  <button type="button" data-bs-toggle="dropdown" aria-expanded="false">
    +    Dropdown trigger
    +  </button>
    +  <ul class="dropdown-menu">
    +    ...
    +  </ul>
    +</div>
    +
    +

    Via JavaScript

    +

    Dropdowns must have data-bs-toggle="dropdown" on their trigger element, regardless of whether you call your dropdown via JavaScript or use the data-api.

    Call the dropdowns via JavaScript:

    -
    const dropdownElementList = document.querySelectorAll('.dropdown-toggle')
    -const dropdownList = [...dropdownElementList].map(dropdownToggleEl => new bootstrap.Dropdown(dropdownToggleEl))
    -

    Options

    -

    As options can be passed via data attributes or JavaScript, you can append an option name to data-bs-, as in data-bs-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-bs-custom-class="beautifier" instead of data-bs-customClass="beautifier".

    -

    As of Bootstrap 5.2.0, all components support an experimental reserved data attribute data-bs-config that can house simple component configuration as a JSON string. When an element has data-bs-config='{"delay":0, "title":123}' and data-bs-title="456" attributes, the final title value will be 456 and the separate data attributes will override values given on data-bs-config. In addition, existing data attributes are able to house JSON values like data-bs-delay='{"show":0,"hide":150}'.

    +
    const dropdownElementList = document.querySelectorAll('.dropdown-toggle')
    +const dropdownList = [...dropdownElementList].map(dropdownToggleEl => new bootstrap.Dropdown(dropdownToggleEl))
    +
    +

    Options

    +

    As options can be passed via data attributes or JavaScript, you can append an option name to data-bs-, as in data-bs-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-bs-custom-class="beautifier" instead of data-bs-customClass="beautifier".

    +

    As of Bootstrap 5.2.0, all components support an experimental reserved data attribute data-bs-config that can house simple component configuration as a JSON string. When an element has data-bs-config='{"delay":0, "title":123}' and data-bs-title="456" attributes, the final title value will be 456 and the separate data attributes will override values given on data-bs-config. In addition, existing data attributes are able to house JSON values like data-bs-delay='{"show":0,"hide":150}'.

    The final configuration object is the merged result of data-bs-config, data-bs-, and js object where the latest given key-value overrides the others.

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDefaultDescription
    autoCloseboolean, stringtrueConfigure the auto close behavior of the dropdown:
    • true - the dropdown will be closed by clicking outside or inside the dropdown menu.
    • false - the dropdown will be closed by clicking the toggle button and manually calling hide or toggle method. (Also will not be closed by pressing Esc key)
    • 'inside' - the dropdown will be closed (only) by clicking inside the dropdown menu.
    • 'outside' - the dropdown will be closed (only) by clicking outside the dropdown menu.
    Note: the dropdown can always be closed with the Esc key.
    boundarystring, element'clippingParents'Overflow constraint boundary of the dropdown menu (applies only to Popper’s preventOverflow modifier). By default it’s clippingParents and can accept an HTMLElement reference (via JavaScript only). For more information refer to Popper’s detectOverflow docs.
    displaystring'dynamic'By default, we use Popper for dynamic positioning. Disable this with static.
    offsetarray, string, function[0, 2]Offset of the dropdown relative to its target. You can pass a string in data attributes with comma separated values like: data-bs-offset="10,20". When a function is used to determine the offset, it is called with an object containing the popper placement, the reference, and popper rects as its first argument. The triggering element DOM node is passed as the second argument. The function must return an array with two numbers: skidding, distance. For more information refer to Popper’s offset docs.
    popperConfignull, object, functionnullTo change Bootstrap’s default Popper config, see Popper’s configuration. When a function is used to create the Popper configuration, it’s called with an object that contains the Bootstrap’s default Popper configuration. It helps you use and merge the default with your own configuration. The function must return a configuration object for Popper.
    referencestring, element, object'toggle'Reference element of the dropdown menu. Accepts the values of 'toggle', 'parent', an HTMLElement reference or an object providing getBoundingClientRect. For more information refer to Popper’s constructor docs and virtual element docs.
    - -

    Using function with popperConfig

    -
    const dropdown = new bootstrap.Dropdown(element, {
    -  popperConfig(defaultBsPopperConfig) {
    -    // const newPopperConfig = {...}
    -    // use defaultBsPopperConfig if needed...
    -    // return newPopperConfig
    -  }
    -})
    -

    Methods

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    MethodDescription
    disposeDestroys an element’s dropdown. (Removes stored data on the DOM element)
    getInstanceStatic method which allows you to get the dropdown instance associated to a DOM element, you can use it like this: bootstrap.Dropdown.getInstance(element).
    getOrCreateInstanceStatic method which returns a dropdown instance associated to a DOM element or create a new one in case it wasn’t initialized. You can use it like this: bootstrap.Dropdown.getOrCreateInstance(element).
    hideHides the dropdown menu of a given navbar or tabbed navigation.
    showShows the dropdown menu of a given navbar or tabbed navigation.
    toggleToggles the dropdown menu of a given navbar or tabbed navigation.
    updateUpdates the position of an element’s dropdown.
    - -

    Events

    -

    All dropdown events are fired at the toggling element and then bubbled up. So you can also add event listeners on the .dropdown-menu’s parent element. hide.bs.dropdown and hidden.bs.dropdown events have a clickEvent property (only when the original Event type is click) that contains an Event Object for the click event.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    Event typeDescription
    hide.bs.dropdownFires immediately when the hide instance method has been called.
    hidden.bs.dropdownFired when the dropdown has finished being hidden from the user and CSS transitions have completed.
    show.bs.dropdownFires immediately when the show instance method is called.
    shown.bs.dropdownFired when the dropdown has been made visible to the user and CSS transitions have completed.
    - -
    const myDropdown = document.getElementById('myDropdown')
    -myDropdown.addEventListener('show.bs.dropdown', event => {
    -  // do something...
    -})
    -
    -
    -
    -
    +
    - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDefaultDescription
    autoCloseboolean, stringtrueConfigure the auto close behavior of the dropdown:
    • true - the dropdown will be closed by clicking outside or inside the dropdown menu.
    • false - the dropdown will be closed by clicking the toggle button and manually calling hide or toggle method. (Also will not be closed by pressing Esc key)
    • 'inside' - the dropdown will be closed (only) by clicking inside the dropdown menu.
    • 'outside' - the dropdown will be closed (only) by clicking outside the dropdown menu.
    Note: the dropdown can always be closed with the Esc key.
    boundarystring, element'clippingParents'Overflow constraint boundary of the dropdown menu (applies only to Popper’s preventOverflow modifier). By default it’s clippingParents and can accept an HTMLElement reference (via JavaScript only). For more information refer to Popper’s detectOverflow docs.
    displaystring'dynamic'By default, we use Popper for dynamic positioning. Disable this with static.
    offsetarray, string, function[0, 2]Offset of the dropdown relative to its target. You can pass a string in data attributes with comma separated values like: data-bs-offset="10,20". When a function is used to determine the offset, it is called with an object containing the popper placement, the reference, and popper rects as its first argument. The triggering element DOM node is passed as the second argument. The function must return an array with two numbers: skidding, distance. For more information refer to Popper’s offset docs.
    popperConfignull, object, functionnullTo change Bootstrap’s default Popper config, see Popper’s configuration. When a function is used to create the Popper configuration, it’s called with an object that contains the Bootstrap’s default Popper configuration. It helps you use and merge the default with your own configuration. The function must return a configuration object for Popper.
    referencestring, element, object'toggle'Reference element of the dropdown menu. Accepts the values of 'toggle', 'parent', an HTMLElement reference or an object providing getBoundingClientRect. For more information refer to Popper’s constructor docs and virtual element docs.
    +

    Using function with popperConfig

    +
    const dropdown = new bootstrap.Dropdown(element, {
    +  popperConfig(defaultBsPopperConfig) {
    +    // const newPopperConfig = {...}
    +    // use defaultBsPopperConfig if needed...
    +    // return newPopperConfig
    +  }
    +})
    +
    +

    Methods

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MethodDescription
    disposeDestroys an element’s dropdown. (Removes stored data on the DOM element)
    getInstanceStatic method which allows you to get the dropdown instance associated to a DOM element, you can use it like this: bootstrap.Dropdown.getInstance(element).
    getOrCreateInstanceStatic method which returns a dropdown instance associated to a DOM element or create a new one in case it wasn’t initialized. You can use it like this: bootstrap.Dropdown.getOrCreateInstance(element).
    hideHides the dropdown menu of a given navbar or tabbed navigation.
    showShows the dropdown menu of a given navbar or tabbed navigation.
    toggleToggles the dropdown menu of a given navbar or tabbed navigation.
    updateUpdates the position of an element’s dropdown.
    +

    Events

    +

    All dropdown events are fired at the toggling element and then bubbled up. So you can also add event listeners on the .dropdown-menu’s parent element. hide.bs.dropdown and hidden.bs.dropdown events have a clickEvent property (only when the original Event type is click) that contains an Event Object for the click event.

    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    Event typeDescription
    hide.bs.dropdownFires immediately when the hide instance method has been called.
    hidden.bs.dropdownFired when the dropdown has finished being hidden from the user and CSS transitions have completed.
    show.bs.dropdownFires immediately when the show instance method is called.
    shown.bs.dropdownFired when the dropdown has been made visible to the user and CSS transitions have completed.
    +
    const myDropdown = document.getElementById('myDropdown')
    +myDropdown.addEventListener('show.bs.dropdown', event => {
    +  // do something...
    +})
    +
    \ No newline at end of file diff --git a/docs/5.3/components/index.html b/docs/5.3/components/index.html index c965ddaba7..6b199d7367 100644 --- a/docs/5.3/components/index.html +++ b/docs/5.3/components/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/components/accordion/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/components/list-group/index.html b/docs/5.3/components/list-group/index.html index fb424656a2..b9fdbef5ef 100644 --- a/docs/5.3/components/list-group/index.html +++ b/docs/5.3/components/list-group/index.html @@ -1,693 +1,75 @@ - - - - - - - - - - - - - - - - -List group · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    List group

    -
    -

    List groups are a flexible and powerful component for displaying a series of content. Modify and extend them to support just about any content within.

    - - -
    - - - - - -
    - - -

    Basic example

    + List group · Bootstrap v5.3

    List group

    List groups are a flexible and powerful component for displaying a series of content. Modify and extend them to support just about any content within.

    +

    Basic example

    The most basic list group is an unordered list with list items and the proper classes. Build upon it with the options that follow, or with your own CSS as needed.

    -
    -
    - -
      +
      • An item
      • A second item
      • A third item
      • A fourth item
      • And a fifth one
      • -
      - -
      - html -
      - - -
      -
      <ul class="list-group">
      -  <li class="list-group-item">An item</li>
      -  <li class="list-group-item">A second item</li>
      -  <li class="list-group-item">A third item</li>
      -  <li class="list-group-item">A fourth item</li>
      -  <li class="list-group-item">And a fifth one</li>
      -</ul>
      -
      - -

      Active items

      +
    html
    <ul class="list-group">
    +  <li class="list-group-item">An item</li>
    +  <li class="list-group-item">A second item</li>
    +  <li class="list-group-item">A third item</li>
    +  <li class="list-group-item">A fourth item</li>
    +  <li class="list-group-item">And a fifth one</li>
    +</ul>
    +

    Active items

    Add .active to a .list-group-item to indicate the current active selection.

    -
    -
    - -
      +
      • An active item
      • A second item
      • A third item
      • A fourth item
      • And a fifth one
      • -
      - -
      - html -
      - - -
      -
      <ul class="list-group">
      -  <li class="list-group-item active" aria-current="true">An active item</li>
      -  <li class="list-group-item">A second item</li>
      -  <li class="list-group-item">A third item</li>
      -  <li class="list-group-item">A fourth item</li>
      -  <li class="list-group-item">And a fifth one</li>
      -</ul>
      -
      - -

      Disabled items

      +
    html
    <ul class="list-group">
    +  <li class="list-group-item active" aria-current="true">An active item</li>
    +  <li class="list-group-item">A second item</li>
    +  <li class="list-group-item">A third item</li>
    +  <li class="list-group-item">A fourth item</li>
    +  <li class="list-group-item">And a fifth one</li>
    +</ul>
    +

    Disabled items

    Add .disabled to a .list-group-item to make it appear disabled. Note that some elements with .disabled will also require custom JavaScript to fully disable their click events (e.g., links).

    -
    -
    - -
      +
      • A disabled item
      • A second item
      • A third item
      • A fourth item
      • And a fifth one
      • -
      - -
      - html -
      - - -
      -
      <ul class="list-group">
      -  <li class="list-group-item disabled" aria-disabled="true">A disabled item</li>
      -  <li class="list-group-item">A second item</li>
      -  <li class="list-group-item">A third item</li>
      -  <li class="list-group-item">A fourth item</li>
      -  <li class="list-group-item">And a fifth one</li>
      -</ul>
      -
      - - -

      Use <a>s or <button>s to create actionable list group items with hover, disabled, and active states by adding .list-group-item-action. We separate these pseudo-classes to ensure list groups made of non-interactive elements (like <li>s or <div>s) don’t provide a click or tap affordance.

      +
    html
    <ul class="list-group">
    +  <li class="list-group-item disabled" aria-disabled="true">A disabled item</li>
    +  <li class="list-group-item">A second item</li>
    +  <li class="list-group-item">A third item</li>
    +  <li class="list-group-item">A fourth item</li>
    +  <li class="list-group-item">And a fifth one</li>
    +</ul>
    + +

    Use <a>s or <button>s to create actionable list group items with hover, disabled, and active states by adding .list-group-item-action. We separate these pseudo-classes to ensure list groups made of non-interactive elements (like <li>s or <div>s) don’t provide a click or tap affordance.

    Be sure to not use the standard .btn classes here.

    -
    -
    - -
    +
    - html -
    - - -
    -
    <div class="list-group">
    -  <a href="#" class="list-group-item list-group-item-action active" aria-current="true">
    -    The current link item
    -  </a>
    -  <a href="#" class="list-group-item list-group-item-action">A second link item</a>
    -  <a href="#" class="list-group-item list-group-item-action">A third link item</a>
    -  <a href="#" class="list-group-item list-group-item-action">A fourth link item</a>
    -  <a class="list-group-item list-group-item-action disabled" aria-disabled="true">A disabled link item</a>
    -</div>
    -
    - -

    With <button>s, you can also make use of the disabled attribute instead of the .disabled class. Sadly, <a>s don’t support the disabled attribute.

    -
    -
    - -
    +
    html
    <div class="list-group">
    +  <a href="#" class="list-group-item list-group-item-action active" aria-current="true">
    +    The current link item
    +  </a>
    +  <a href="#" class="list-group-item list-group-item-action">A second link item</a>
    +  <a href="#" class="list-group-item list-group-item-action">A third link item</a>
    +  <a href="#" class="list-group-item list-group-item-action">A fourth link item</a>
    +  <a class="list-group-item list-group-item-action disabled" aria-disabled="true">A disabled link item</a>
    +</div>
    +

    With <button>s, you can also make use of the disabled attribute instead of the .disabled class. Sadly, <a>s don’t support the disabled attribute.

    +
    @@ -730,95 +95,44 @@ -
    - -
    - html -
    - - -
    -
    <div class="list-group">
    -  <button type="button" class="list-group-item list-group-item-action active" aria-current="true">
    -    The current button
    -  </button>
    -  <button type="button" class="list-group-item list-group-item-action">A second button item</button>
    -  <button type="button" class="list-group-item list-group-item-action">A third button item</button>
    -  <button type="button" class="list-group-item list-group-item-action">A fourth button item</button>
    -  <button type="button" class="list-group-item list-group-item-action" disabled>A disabled button item</button>
    -</div>
    -
    - -

    Flush

    +
    html
    <div class="list-group">
    +  <button type="button" class="list-group-item list-group-item-action active" aria-current="true">
    +    The current button
    +  </button>
    +  <button type="button" class="list-group-item list-group-item-action">A second button item</button>
    +  <button type="button" class="list-group-item list-group-item-action">A third button item</button>
    +  <button type="button" class="list-group-item list-group-item-action">A fourth button item</button>
    +  <button type="button" class="list-group-item list-group-item-action" disabled>A disabled button item</button>
    +</div>
    +

    Flush

    Add .list-group-flush to remove some borders and rounded corners to render list group items edge-to-edge in a parent container (e.g., cards).

    -
    -
    - -
      +
      • An item
      • A second item
      • A third item
      • A fourth item
      • And a fifth one
      • -
      - -
      - html -
      - - -
      -
      <ul class="list-group list-group-flush">
      -  <li class="list-group-item">An item</li>
      -  <li class="list-group-item">A second item</li>
      -  <li class="list-group-item">A third item</li>
      -  <li class="list-group-item">A fourth item</li>
      -  <li class="list-group-item">And a fifth one</li>
      -</ul>
      -
      - -

      Numbered

      +
    html
    <ul class="list-group list-group-flush">
    +  <li class="list-group-item">An item</li>
    +  <li class="list-group-item">A second item</li>
    +  <li class="list-group-item">A third item</li>
    +  <li class="list-group-item">A fourth item</li>
    +  <li class="list-group-item">And a fifth one</li>
    +</ul>
    +

    Numbered

    Add the .list-group-numbered modifier class (and optionally use an <ol> element) to opt into numbered list group items. Numbers are generated via CSS (as opposed to a <ol>s default browser styling) for better placement inside list group items and to allow for better customization.

    Numbers are generated by counter-reset on the <ol>, and then styled and placed with a ::before pseudo-element on the <li> with counter-increment and content.

    -
    -
    - -
      +
      1. A list item
      2. A list item
      3. A list item
      4. -
      - -
      - html -
      - - -
      -
      <ol class="list-group list-group-numbered">
      -  <li class="list-group-item">A list item</li>
      -  <li class="list-group-item">A list item</li>
      -  <li class="list-group-item">A list item</li>
      -</ol>
      -
      - +
    html
    <ol class="list-group list-group-numbered">
    +  <li class="list-group-item">A list item</li>
    +  <li class="list-group-item">A list item</li>
    +  <li class="list-group-item">A list item</li>
    +</ol>

    These work great with custom content as well.

    -
    -
    - -
      +
      1. Subheading
        @@ -840,51 +154,33 @@
        14
      2. -
      - -
      - html -
      - - -
      -
      <ol class="list-group list-group-numbered">
      -  <li class="list-group-item d-flex justify-content-between align-items-start">
      -    <div class="ms-2 me-auto">
      -      <div class="fw-bold">Subheading</div>
      -      Content for list item
      -    </div>
      -    <span class="badge text-bg-primary rounded-pill">14</span>
      -  </li>
      -  <li class="list-group-item d-flex justify-content-between align-items-start">
      -    <div class="ms-2 me-auto">
      -      <div class="fw-bold">Subheading</div>
      -      Content for list item
      -    </div>
      -    <span class="badge text-bg-primary rounded-pill">14</span>
      -  </li>
      -  <li class="list-group-item d-flex justify-content-between align-items-start">
      -    <div class="ms-2 me-auto">
      -      <div class="fw-bold">Subheading</div>
      -      Content for list item
      -    </div>
      -    <span class="badge text-bg-primary rounded-pill">14</span>
      -  </li>
      -</ol>
      -
      - -

      Horizontal

      -

      Add .list-group-horizontal to change the layout of list group items from vertical to horizontal across all breakpoints. Alternatively, choose a responsive variant .list-group-horizontal-{sm|md|lg|xl|xxl} to make a list group horizontal starting at that breakpoint’s min-width. Currently horizontal list groups cannot be combined with flush list groups.

      +
    html
    <ol class="list-group list-group-numbered">
    +  <li class="list-group-item d-flex justify-content-between align-items-start">
    +    <div class="ms-2 me-auto">
    +      <div class="fw-bold">Subheading</div>
    +      Content for list item
    +    </div>
    +    <span class="badge text-bg-primary rounded-pill">14</span>
    +  </li>
    +  <li class="list-group-item d-flex justify-content-between align-items-start">
    +    <div class="ms-2 me-auto">
    +      <div class="fw-bold">Subheading</div>
    +      Content for list item
    +    </div>
    +    <span class="badge text-bg-primary rounded-pill">14</span>
    +  </li>
    +  <li class="list-group-item d-flex justify-content-between align-items-start">
    +    <div class="ms-2 me-auto">
    +      <div class="fw-bold">Subheading</div>
    +      Content for list item
    +    </div>
    +    <span class="badge text-bg-primary rounded-pill">14</span>
    +  </li>
    +</ol>
    +

    Horizontal

    +

    Add .list-group-horizontal to change the layout of list group items from vertical to horizontal across all breakpoints. Alternatively, choose a responsive variant .list-group-horizontal-{sm|md|lg|xl|xxl} to make a list group horizontal starting at that breakpoint’s min-width. Currently horizontal list groups cannot be combined with flush list groups.

    ProTip: Want equal-width list group items when horizontal? Add .flex-fill to each list group item.

    -
    -
    - - -
      +
      • An item
      • A second item
      • A third item
      • @@ -913,62 +209,42 @@
      • An item
      • A second item
      • A third item
      • -
      - -
      - html -
      - - -
      -
      <ul class="list-group list-group-horizontal">
      -  <li class="list-group-item">An item</li>
      -  <li class="list-group-item">A second item</li>
      -  <li class="list-group-item">A third item</li>
      -</ul>
      -<ul class="list-group list-group-horizontal-sm">
      -  <li class="list-group-item">An item</li>
      -  <li class="list-group-item">A second item</li>
      -  <li class="list-group-item">A third item</li>
      -</ul>
      -<ul class="list-group list-group-horizontal-md">
      -  <li class="list-group-item">An item</li>
      -  <li class="list-group-item">A second item</li>
      -  <li class="list-group-item">A third item</li>
      -</ul>
      -<ul class="list-group list-group-horizontal-lg">
      -  <li class="list-group-item">An item</li>
      -  <li class="list-group-item">A second item</li>
      -  <li class="list-group-item">A third item</li>
      -</ul>
      -<ul class="list-group list-group-horizontal-xl">
      -  <li class="list-group-item">An item</li>
      -  <li class="list-group-item">A second item</li>
      -  <li class="list-group-item">A third item</li>
      -</ul>
      -<ul class="list-group list-group-horizontal-xxl">
      -  <li class="list-group-item">An item</li>
      -  <li class="list-group-item">A second item</li>
      -  <li class="list-group-item">A third item</li>
      -</ul>
      -
      - -

      Variants

      -
      -Heads up! As of v5.3.0, the list-group-item-variant() Sass mixin is deprecated. List group item variants now have their CSS variables overridden in a Sass loop. -
      - +
    html
    <ul class="list-group list-group-horizontal">
    +  <li class="list-group-item">An item</li>
    +  <li class="list-group-item">A second item</li>
    +  <li class="list-group-item">A third item</li>
    +</ul>
    +<ul class="list-group list-group-horizontal-sm">
    +  <li class="list-group-item">An item</li>
    +  <li class="list-group-item">A second item</li>
    +  <li class="list-group-item">A third item</li>
    +</ul>
    +<ul class="list-group list-group-horizontal-md">
    +  <li class="list-group-item">An item</li>
    +  <li class="list-group-item">A second item</li>
    +  <li class="list-group-item">A third item</li>
    +</ul>
    +<ul class="list-group list-group-horizontal-lg">
    +  <li class="list-group-item">An item</li>
    +  <li class="list-group-item">A second item</li>
    +  <li class="list-group-item">A third item</li>
    +</ul>
    +<ul class="list-group list-group-horizontal-xl">
    +  <li class="list-group-item">An item</li>
    +  <li class="list-group-item">A second item</li>
    +  <li class="list-group-item">A third item</li>
    +</ul>
    +<ul class="list-group list-group-horizontal-xxl">
    +  <li class="list-group-item">An item</li>
    +  <li class="list-group-item">A second item</li>
    +  <li class="list-group-item">A third item</li>
    +</ul>
    +

    Variants

    +

    Heads up! As of v5.3.0, the list-group-item-variant() Sass mixin is deprecated. List group item variants now have their CSS variables overridden in a Sass loop.

    Use contextual classes to style list items with a stateful background and color.

    -
    -
    - -
      +
      • A simple default list group item
      • - +
      • A simple primary list group item
      • A simple secondary list group item
      • A simple success list group item
      • @@ -977,40 +253,23 @@
      • A simple info list group item
      • A simple light list group item
      • A simple dark list group item
      • -
      - -
      - html -
      - - -
      -
      <ul class="list-group">
      -  <li class="list-group-item">A simple default list group item</li>
      -
      -  <li class="list-group-item list-group-item-primary">A simple primary list group item</li>
      -  <li class="list-group-item list-group-item-secondary">A simple secondary list group item</li>
      -  <li class="list-group-item list-group-item-success">A simple success list group item</li>
      -  <li class="list-group-item list-group-item-danger">A simple danger list group item</li>
      -  <li class="list-group-item list-group-item-warning">A simple warning list group item</li>
      -  <li class="list-group-item list-group-item-info">A simple info list group item</li>
      -  <li class="list-group-item list-group-item-light">A simple light list group item</li>
      -  <li class="list-group-item list-group-item-dark">A simple dark list group item</li>
      -</ul>
      -
      - - +
    html
    <ul class="list-group">
    +  <li class="list-group-item">A simple default list group item</li>
    +  
    +  <li class="list-group-item list-group-item-primary">A simple primary list group item</li>
    +  <li class="list-group-item list-group-item-secondary">A simple secondary list group item</li>
    +  <li class="list-group-item list-group-item-success">A simple success list group item</li>
    +  <li class="list-group-item list-group-item-danger">A simple danger list group item</li>
    +  <li class="list-group-item list-group-item-warning">A simple warning list group item</li>
    +  <li class="list-group-item list-group-item-info">A simple info list group item</li>
    +  <li class="list-group-item list-group-item-light">A simple light list group item</li>
    +  <li class="list-group-item list-group-item-dark">A simple dark list group item</li>
    +</ul>
    +

    Contextual classes also work with .list-group-item-action for <a> and <button> elements. Note the addition of the hover styles here not present in the previous example. Also supported is the .active state; apply it to indicate an active selection on a contextual list group item.

    -
    -
    - -
    +
    - html -
    - - -
    -
    <div class="list-group">
    -  <a href="#" class="list-group-item list-group-item-action">A simple default list group item</a>
    -
    -  <a href="#" class="list-group-item list-group-item-action list-group-item-primary">A simple primary list group item</a>
    -  <a href="#" class="list-group-item list-group-item-action list-group-item-secondary">A simple secondary list group item</a>
    -  <a href="#" class="list-group-item list-group-item-action list-group-item-success">A simple success list group item</a>
    -  <a href="#" class="list-group-item list-group-item-action list-group-item-danger">A simple danger list group item</a>
    -  <a href="#" class="list-group-item list-group-item-action list-group-item-warning">A simple warning list group item</a>
    -  <a href="#" class="list-group-item list-group-item-action list-group-item-info">A simple info list group item</a>
    -  <a href="#" class="list-group-item list-group-item-action list-group-item-light">A simple light list group item</a>
    -  <a href="#" class="list-group-item list-group-item-action list-group-item-dark">A simple dark list group item</a>
    -</div>
    -
    - -
    -Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class. -
    - -

    With badges

    -

    Add badges to any list group item to show unread counts, activity, and more with the help of some utilities.

    -
    -
    - -
      +
    html
    <div class="list-group">
    +  <a href="#" class="list-group-item list-group-item-action">A simple default list group item</a>
    +  
    +  <a href="#" class="list-group-item list-group-item-action list-group-item-primary">A simple primary list group item</a>
    +  <a href="#" class="list-group-item list-group-item-action list-group-item-secondary">A simple secondary list group item</a>
    +  <a href="#" class="list-group-item list-group-item-action list-group-item-success">A simple success list group item</a>
    +  <a href="#" class="list-group-item list-group-item-action list-group-item-danger">A simple danger list group item</a>
    +  <a href="#" class="list-group-item list-group-item-action list-group-item-warning">A simple warning list group item</a>
    +  <a href="#" class="list-group-item list-group-item-action list-group-item-info">A simple info list group item</a>
    +  <a href="#" class="list-group-item list-group-item-action list-group-item-light">A simple light list group item</a>
    +  <a href="#" class="list-group-item list-group-item-action list-group-item-dark">A simple dark list group item</a>
    +</div>
    +

    Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class.

    +

    With badges

    +

    Add badges to any list group item to show unread counts, activity, and more with the help of some utilities.

    +
    • A list item 14 @@ -1067,40 +306,23 @@ A third list item 1
    • -
    - -
    - html -
    - - -
    -
    <ul class="list-group">
    -  <li class="list-group-item d-flex justify-content-between align-items-center">
    -    A list item
    -    <span class="badge text-bg-primary rounded-pill">14</span>
    -  </li>
    -  <li class="list-group-item d-flex justify-content-between align-items-center">
    -    A second list item
    -    <span class="badge text-bg-primary rounded-pill">2</span>
    -  </li>
    -  <li class="list-group-item d-flex justify-content-between align-items-center">
    -    A third list item
    -    <span class="badge text-bg-primary rounded-pill">1</span>
    -  </li>
    -</ul>
    -
    - -

    Custom content

    -

    Add nearly any HTML within, even for linked list groups like the one below, with the help of flexbox utilities.

    -
    -
    - -
    +
    html
    <ul class="list-group">
    +  <li class="list-group-item d-flex justify-content-between align-items-center">
    +    A list item
    +    <span class="badge text-bg-primary rounded-pill">14</span>
    +  </li>
    +  <li class="list-group-item d-flex justify-content-between align-items-center">
    +    A second list item
    +    <span class="badge text-bg-primary rounded-pill">2</span>
    +  </li>
    +  <li class="list-group-item d-flex justify-content-between align-items-center">
    +    A third list item
    +    <span class="badge text-bg-primary rounded-pill">1</span>
    +  </li>
    +</ul>
    +

    Custom content

    +

    Add nearly any HTML within, even for linked list groups like the one below, with the help of flexbox utilities.

    +
    - html -
    - - -
    -
    <div class="list-group">
    -  <a href="#" class="list-group-item list-group-item-action active" aria-current="true">
    -    <div class="d-flex w-100 justify-content-between">
    -      <h5 class="mb-1">List group item heading</h5>
    -      <small>3 days ago</small>
    -    </div>
    -    <p class="mb-1">Some placeholder content in a paragraph.</p>
    -    <small>And some small print.</small>
    -  </a>
    -  <a href="#" class="list-group-item list-group-item-action">
    -    <div class="d-flex w-100 justify-content-between">
    -      <h5 class="mb-1">List group item heading</h5>
    -      <small class="text-body-secondary">3 days ago</small>
    -    </div>
    -    <p class="mb-1">Some placeholder content in a paragraph.</p>
    -    <small class="text-body-secondary">And some muted small print.</small>
    -  </a>
    -  <a href="#" class="list-group-item list-group-item-action">
    -    <div class="d-flex w-100 justify-content-between">
    -      <h5 class="mb-1">List group item heading</h5>
    -      <small class="text-body-secondary">3 days ago</small>
    -    </div>
    -    <p class="mb-1">Some placeholder content in a paragraph.</p>
    -    <small class="text-body-secondary">And some muted small print.</small>
    -  </a>
    -</div>
    -
    - -

    Checkboxes and radios

    -

    Place Bootstrap’s checkboxes and radios within list group items and customize as needed. You can use them without <label>s, but please remember to include an aria-label attribute and value for accessibility.

    -
    -
    - -
      +
    html
    <div class="list-group">
    +  <a href="#" class="list-group-item list-group-item-action active" aria-current="true">
    +    <div class="d-flex w-100 justify-content-between">
    +      <h5 class="mb-1">List group item heading</h5>
    +      <small>3 days ago</small>
    +    </div>
    +    <p class="mb-1">Some placeholder content in a paragraph.</p>
    +    <small>And some small print.</small>
    +  </a>
    +  <a href="#" class="list-group-item list-group-item-action">
    +    <div class="d-flex w-100 justify-content-between">
    +      <h5 class="mb-1">List group item heading</h5>
    +      <small class="text-body-secondary">3 days ago</small>
    +    </div>
    +    <p class="mb-1">Some placeholder content in a paragraph.</p>
    +    <small class="text-body-secondary">And some muted small print.</small>
    +  </a>
    +  <a href="#" class="list-group-item list-group-item-action">
    +    <div class="d-flex w-100 justify-content-between">
    +      <h5 class="mb-1">List group item heading</h5>
    +      <small class="text-body-secondary">3 days ago</small>
    +    </div>
    +    <p class="mb-1">Some placeholder content in a paragraph.</p>
    +    <small class="text-body-secondary">And some muted small print.</small>
    +  </a>
    +</div>
    +

    Checkboxes and radios

    +

    Place Bootstrap’s checkboxes and radios within list group items and customize as needed. You can use them without <label>s, but please remember to include an aria-label attribute and value for accessibility.

    +
    • @@ -1183,38 +388,21 @@
    • -
    - -
    - html -
    - - -
    -
    <ul class="list-group">
    -  <li class="list-group-item">
    -    <input class="form-check-input me-1" type="checkbox" value="" id="firstCheckbox">
    -    <label class="form-check-label" for="firstCheckbox">First checkbox</label>
    -  </li>
    -  <li class="list-group-item">
    -    <input class="form-check-input me-1" type="checkbox" value="" id="secondCheckbox">
    -    <label class="form-check-label" for="secondCheckbox">Second checkbox</label>
    -  </li>
    -  <li class="list-group-item">
    -    <input class="form-check-input me-1" type="checkbox" value="" id="thirdCheckbox">
    -    <label class="form-check-label" for="thirdCheckbox">Third checkbox</label>
    -  </li>
    -</ul>
    -
    - -
    -
    - -
      +
    html
    <ul class="list-group">
    +  <li class="list-group-item">
    +    <input class="form-check-input me-1" type="checkbox" value="" id="firstCheckbox">
    +    <label class="form-check-label" for="firstCheckbox">First checkbox</label>
    +  </li>
    +  <li class="list-group-item">
    +    <input class="form-check-input me-1" type="checkbox" value="" id="secondCheckbox">
    +    <label class="form-check-label" for="secondCheckbox">Second checkbox</label>
    +  </li>
    +  <li class="list-group-item">
    +    <input class="form-check-input me-1" type="checkbox" value="" id="thirdCheckbox">
    +    <label class="form-check-label" for="thirdCheckbox">Third checkbox</label>
    +  </li>
    +</ul>
    +
    • @@ -1227,39 +415,22 @@
    • -
    - -
    - html -
    - - -
    -
    <ul class="list-group">
    -  <li class="list-group-item">
    -    <input class="form-check-input me-1" type="radio" name="listGroupRadio" value="" id="firstRadio" checked>
    -    <label class="form-check-label" for="firstRadio">First radio</label>
    -  </li>
    -  <li class="list-group-item">
    -    <input class="form-check-input me-1" type="radio" name="listGroupRadio" value="" id="secondRadio">
    -    <label class="form-check-label" for="secondRadio">Second radio</label>
    -  </li>
    -  <li class="list-group-item">
    -    <input class="form-check-input me-1" type="radio" name="listGroupRadio" value="" id="thirdRadio">
    -    <label class="form-check-label" for="thirdRadio">Third radio</label>
    -  </li>
    -</ul>
    -
    - +
    html
    <ul class="list-group">
    +  <li class="list-group-item">
    +    <input class="form-check-input me-1" type="radio" name="listGroupRadio" value="" id="firstRadio" checked>
    +    <label class="form-check-label" for="firstRadio">First radio</label>
    +  </li>
    +  <li class="list-group-item">
    +    <input class="form-check-input me-1" type="radio" name="listGroupRadio" value="" id="secondRadio">
    +    <label class="form-check-label" for="secondRadio">Second radio</label>
    +  </li>
    +  <li class="list-group-item">
    +    <input class="form-check-input me-1" type="radio" name="listGroupRadio" value="" id="thirdRadio">
    +    <label class="form-check-label" for="thirdRadio">Third radio</label>
    +  </li>
    +</ul>

    You can use .stretched-link on <label>s to make the whole list group item clickable.

    -
    -
    - -
      +
      • @@ -1272,290 +443,219 @@
      • -
      - -
      - html -
      - - -
      -
      <ul class="list-group">
      -  <li class="list-group-item">
      -    <input class="form-check-input me-1" type="checkbox" value="" id="firstCheckboxStretched">
      -    <label class="form-check-label stretched-link" for="firstCheckboxStretched">First checkbox</label>
      -  </li>
      -  <li class="list-group-item">
      -    <input class="form-check-input me-1" type="checkbox" value="" id="secondCheckboxStretched">
      -    <label class="form-check-label stretched-link" for="secondCheckboxStretched">Second checkbox</label>
      -  </li>
      -  <li class="list-group-item">
      -    <input class="form-check-input me-1" type="checkbox" value="" id="thirdCheckboxStretched">
      -    <label class="form-check-label stretched-link" for="thirdCheckboxStretched">Third checkbox</label>
      -  </li>
      -</ul>
      -
      - -

      CSS

      -

      Variables

      +
    html
    <ul class="list-group">
    +  <li class="list-group-item">
    +    <input class="form-check-input me-1" type="checkbox" value="" id="firstCheckboxStretched">
    +    <label class="form-check-label stretched-link" for="firstCheckboxStretched">First checkbox</label>
    +  </li>
    +  <li class="list-group-item">
    +    <input class="form-check-input me-1" type="checkbox" value="" id="secondCheckboxStretched">
    +    <label class="form-check-label stretched-link" for="secondCheckboxStretched">Second checkbox</label>
    +  </li>
    +  <li class="list-group-item">
    +    <input class="form-check-input me-1" type="checkbox" value="" id="thirdCheckboxStretched">
    +    <label class="form-check-label stretched-link" for="thirdCheckboxStretched">Third checkbox</label>
    +  </li>
    +</ul>
    +

    CSS

    +

    Variables

    Added in v5.2.0 +

    As part of Bootstrap’s evolving CSS variables approach, list groups now use local CSS variables on .list-group for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    +
    --#{$prefix}list-group-color: #{$list-group-color};
    +--#{$prefix}list-group-bg: #{$list-group-bg};
    +--#{$prefix}list-group-border-color: #{$list-group-border-color};
    +--#{$prefix}list-group-border-width: #{$list-group-border-width};
    +--#{$prefix}list-group-border-radius: #{$list-group-border-radius};
    +--#{$prefix}list-group-item-padding-x: #{$list-group-item-padding-x};
    +--#{$prefix}list-group-item-padding-y: #{$list-group-item-padding-y};
    +--#{$prefix}list-group-action-color: #{$list-group-action-color};
    +--#{$prefix}list-group-action-hover-color: #{$list-group-action-hover-color};
    +--#{$prefix}list-group-action-hover-bg: #{$list-group-hover-bg};
    +--#{$prefix}list-group-action-active-color: #{$list-group-action-active-color};
    +--#{$prefix}list-group-action-active-bg: #{$list-group-action-active-bg};
    +--#{$prefix}list-group-disabled-color: #{$list-group-disabled-color};
    +--#{$prefix}list-group-disabled-bg: #{$list-group-disabled-bg};
    +--#{$prefix}list-group-active-color: #{$list-group-active-color};
    +--#{$prefix}list-group-active-bg: #{$list-group-active-bg};
    +--#{$prefix}list-group-active-border-color: #{$list-group-active-border-color};
    +
    +

    Sass variables

    +
    $list-group-color:                  var(--#{$prefix}body-color);
    +$list-group-bg:                     var(--#{$prefix}body-bg);
    +$list-group-border-color:           var(--#{$prefix}border-color);
    +$list-group-border-width:           var(--#{$prefix}border-width);
    +$list-group-border-radius:          var(--#{$prefix}border-radius);
     
    -

    As part of Bootstrap’s evolving CSS variables approach, list groups now use local CSS variables on .list-group for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    -
    -
    - scss/_list-group.scss -
    - -
    -
    --#{$prefix}list-group-color: #{$list-group-color};
    ---#{$prefix}list-group-bg: #{$list-group-bg};
    ---#{$prefix}list-group-border-color: #{$list-group-border-color};
    ---#{$prefix}list-group-border-width: #{$list-group-border-width};
    ---#{$prefix}list-group-border-radius: #{$list-group-border-radius};
    ---#{$prefix}list-group-item-padding-x: #{$list-group-item-padding-x};
    ---#{$prefix}list-group-item-padding-y: #{$list-group-item-padding-y};
    ---#{$prefix}list-group-action-color: #{$list-group-action-color};
    ---#{$prefix}list-group-action-hover-color: #{$list-group-action-hover-color};
    ---#{$prefix}list-group-action-hover-bg: #{$list-group-hover-bg};
    ---#{$prefix}list-group-action-active-color: #{$list-group-action-active-color};
    ---#{$prefix}list-group-action-active-bg: #{$list-group-action-active-bg};
    ---#{$prefix}list-group-disabled-color: #{$list-group-disabled-color};
    ---#{$prefix}list-group-disabled-bg: #{$list-group-disabled-bg};
    ---#{$prefix}list-group-active-color: #{$list-group-active-color};
    ---#{$prefix}list-group-active-bg: #{$list-group-active-bg};
    ---#{$prefix}list-group-active-border-color: #{$list-group-active-border-color};
    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $list-group-color:                  var(--#{$prefix}body-color);
    -$list-group-bg:                     var(--#{$prefix}body-bg);
    -$list-group-border-color:           var(--#{$prefix}border-color);
    -$list-group-border-width:           var(--#{$prefix}border-width);
    -$list-group-border-radius:          var(--#{$prefix}border-radius);
    -
    -$list-group-item-padding-y:         $spacer * .5;
    -$list-group-item-padding-x:         $spacer;
    -// fusv-disable
    -$list-group-item-bg-scale:          -80%; // Deprecated in v5.3.0
    -$list-group-item-color-scale:       40%; // Deprecated in v5.3.0
    -// fusv-enable
    -
    -$list-group-hover-bg:               var(--#{$prefix}tertiary-bg);
    -$list-group-active-color:           $component-active-color;
    -$list-group-active-bg:              $component-active-bg;
    -$list-group-active-border-color:    $list-group-active-bg;
    -
    -$list-group-disabled-color:         var(--#{$prefix}secondary-color);
    -$list-group-disabled-bg:            $list-group-bg;
    -
    -$list-group-action-color:           var(--#{$prefix}secondary-color);
    -$list-group-action-hover-color:     var(--#{$prefix}emphasis-color);
    -
    -$list-group-action-active-color:    var(--#{$prefix}body-color);
    -$list-group-action-active-bg:       var(--#{$prefix}secondary-bg);
    -
    -

    Sass mixins

    -Deprecated in v5.3.0 +$list-group-item-padding-y: $spacer * .5; +$list-group-item-padding-x: $spacer; +// fusv-disable +$list-group-item-bg-scale: -80%; // Deprecated in v5.3.0 +$list-group-item-color-scale: 40%; // Deprecated in v5.3.0 +// fusv-enable -
    -
    @mixin list-group-item-variant($state, $background, $color) {
    -  .list-group-item-#{$state} {
    -    color: $color;
    -    background-color: $background;
    -
    -    &.list-group-item-action {
    -      &:hover,
    -      &:focus {
    -        color: $color;
    -        background-color: shade-color($background, 10%);
    -      }
    -
    -      &.active {
    -        color: $white;
    -        background-color: $color;
    -        border-color: $color;
    -      }
    -    }
    -  }
    -}
    -
    -

    Sass loops

    +$list-group-hover-bg: var(--#{$prefix}tertiary-bg); +$list-group-active-color: $component-active-color; +$list-group-active-bg: $component-active-bg; +$list-group-active-border-color: $list-group-active-bg; + +$list-group-disabled-color: var(--#{$prefix}secondary-color); +$list-group-disabled-bg: $list-group-bg; + +$list-group-action-color: var(--#{$prefix}secondary-color); +$list-group-action-hover-color: var(--#{$prefix}emphasis-color); + +$list-group-action-active-color: var(--#{$prefix}body-color); +$list-group-action-active-bg: var(--#{$prefix}secondary-bg); +
    +

    Sass mixins

    + +Deprecated in v5.3.0 +
    @mixin list-group-item-variant($state, $background, $color) {
    +  .list-group-item-#{$state} {
    +    color: $color;
    +    background-color: $background;
    +
    +    &.list-group-item-action {
    +      &:hover,
    +      &:focus {
    +        color: $color;
    +        background-color: shade-color($background, 10%);
    +      }
    +
    +      &.active {
    +        color: $white;
    +        background-color: $color;
    +        border-color: $color;
    +      }
    +    }
    +  }
    +}
    +
    +

    Sass loops

    Loop that generates the modifier classes with an overriding of CSS variables.

    -
    -
    - scss/_list-group.scss -
    - -
    -
    // List group contextual variants
    -//
    -// Add modifier classes to change text and background color on individual items.
    -// Organizationally, this must come after the `:hover` states.
    -
    -@each $state in map-keys($theme-colors) {
    -  .list-group-item-#{$state} {
    -    --#{$prefix}list-group-color: var(--#{$prefix}#{$state}-text-emphasis);
    -    --#{$prefix}list-group-bg: var(--#{$prefix}#{$state}-bg-subtle);
    -    --#{$prefix}list-group-border-color: var(--#{$prefix}#{$state}-border-subtle);
    -    --#{$prefix}list-group-action-hover-color: var(--#{$prefix}emphasis-color);
    -    --#{$prefix}list-group-action-hover-bg: var(--#{$prefix}#{$state}-border-subtle);
    -    --#{$prefix}list-group-action-active-color: var(--#{$prefix}emphasis-color);
    -    --#{$prefix}list-group-action-active-bg: var(--#{$prefix}#{$state}-border-subtle);
    -    --#{$prefix}list-group-active-color: var(--#{$prefix}#{$state}-bg-subtle);
    -    --#{$prefix}list-group-active-bg: var(--#{$prefix}#{$state}-text-emphasis);
    -    --#{$prefix}list-group-active-border-color: var(--#{$prefix}#{$state}-text-emphasis);
    -  }
    -}
    -
    -

    JavaScript behavior

    -

    Use the tab JavaScript plugin—include it individually or through the compiled bootstrap.js file—to extend our list group to create tabbable panes of local content.

    -
    -
    -
    - -
    -
    - -
    -
    -
    -
    <div class="row">
    -  <div class="col-4">
    -    <div class="list-group" id="list-tab" role="tablist">
    -      <a class="list-group-item list-group-item-action active" id="list-home-list" data-bs-toggle="list" href="#list-home" role="tab" aria-controls="list-home">Home</a>
    -      <a class="list-group-item list-group-item-action" id="list-profile-list" data-bs-toggle="list" href="#list-profile" role="tab" aria-controls="list-profile">Profile</a>
    -      <a class="list-group-item list-group-item-action" id="list-messages-list" data-bs-toggle="list" href="#list-messages" role="tab" aria-controls="list-messages">Messages</a>
    -      <a class="list-group-item list-group-item-action" id="list-settings-list" data-bs-toggle="list" href="#list-settings" role="tab" aria-controls="list-settings">Settings</a>
    -    </div>
    -  </div>
    -  <div class="col-8">
    -    <div class="tab-content" id="nav-tabContent">
    -      <div class="tab-pane fade show active" id="list-home" role="tabpanel" aria-labelledby="list-home-list">...</div>
    -      <div class="tab-pane fade" id="list-profile" role="tabpanel" aria-labelledby="list-profile-list">...</div>
    -      <div class="tab-pane fade" id="list-messages" role="tabpanel" aria-labelledby="list-messages-list">...</div>
    -      <div class="tab-pane fade" id="list-settings" role="tabpanel" aria-labelledby="list-settings-list">...</div>
    -    </div>
    -  </div>
    -</div>
    -

    Using data attributes

    -

    You can activate a list group navigation without writing any JavaScript by simply specifying data-bs-toggle="list" or on an element. Use these data attributes on .list-group-item.

    -
    <div role="tabpanel">
    -  <!-- List group -->
    -  <div class="list-group" id="myList" role="tablist">
    -    <a class="list-group-item list-group-item-action active" data-bs-toggle="list" href="#home" role="tab">Home</a>
    -    <a class="list-group-item list-group-item-action" data-bs-toggle="list" href="#profile" role="tab">Profile</a>
    -    <a class="list-group-item list-group-item-action" data-bs-toggle="list" href="#messages" role="tab">Messages</a>
    -    <a class="list-group-item list-group-item-action" data-bs-toggle="list" href="#settings" role="tab">Settings</a>
    -  </div>
    -
    -  <!-- Tab panes -->
    -  <div class="tab-content">
    -    <div class="tab-pane active" id="home" role="tabpanel">...</div>
    -    <div class="tab-pane" id="profile" role="tabpanel">...</div>
    -    <div class="tab-pane" id="messages" role="tabpanel">...</div>
    -    <div class="tab-pane" id="settings" role="tabpanel">...</div>
    -  </div>
    -</div>
    -

    Via JavaScript

    -

    Enable tabbable list item via JavaScript (each list item needs to be activated individually):

    -
    const triggerTabList = document.querySelectorAll('#myTab a')
    -triggerTabList.forEach(triggerEl => {
    -  const tabTrigger = new bootstrap.Tab(triggerEl)
    -
    -  triggerEl.addEventListener('click', event => {
    -    event.preventDefault()
    -    tabTrigger.show()
    -  })
    -})
    -

    You can activate individual list item in several ways:

    -
    const triggerEl = document.querySelector('#myTab a[href="#profile"]')
    -bootstrap.Tab.getInstance(triggerEl).show() // Select tab by name
    -
    -const triggerFirstTabEl = document.querySelector('#myTab li:first-child a')
    -bootstrap.Tab.getInstance(triggerFirstTabEl).show() // Select first tab
    -

    Fade effect

    -

    To make tabs panel fade in, add .fade to each .tab-pane. The first tab pane must also have .show to make the initial content visible.

    -
    <div class="tab-content">
    -  <div class="tab-pane fade show active" id="home" role="tabpanel">...</div>
    -  <div class="tab-pane fade" id="profile" role="tabpanel">...</div>
    -  <div class="tab-pane fade" id="messages" role="tabpanel">...</div>
    -  <div class="tab-pane fade" id="settings" role="tabpanel">...</div>
    -</div>
    -

    Methods

    -
    -All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started, but before it ends. In addition, a method call on a transitioning component will be ignored. Learn more in our JavaScript docs. -
    +
    // List group contextual variants
    +//
    +// Add modifier classes to change text and background color on individual items.
    +// Organizationally, this must come after the `:hover` states.
     
    +@each $state in map-keys($theme-colors) {
    +  .list-group-item-#{$state} {
    +    --#{$prefix}list-group-color: var(--#{$prefix}#{$state}-text-emphasis);
    +    --#{$prefix}list-group-bg: var(--#{$prefix}#{$state}-bg-subtle);
    +    --#{$prefix}list-group-border-color: var(--#{$prefix}#{$state}-border-subtle);
    +    --#{$prefix}list-group-action-hover-color: var(--#{$prefix}emphasis-color);
    +    --#{$prefix}list-group-action-hover-bg: var(--#{$prefix}#{$state}-border-subtle);
    +    --#{$prefix}list-group-action-active-color: var(--#{$prefix}emphasis-color);
    +    --#{$prefix}list-group-action-active-bg: var(--#{$prefix}#{$state}-border-subtle);
    +    --#{$prefix}list-group-active-color: var(--#{$prefix}#{$state}-bg-subtle);
    +    --#{$prefix}list-group-active-bg: var(--#{$prefix}#{$state}-text-emphasis);
    +    --#{$prefix}list-group-active-border-color: var(--#{$prefix}#{$state}-text-emphasis);
    +  }
    +}
    +
    +

    JavaScript behavior

    +

    Use the tab JavaScript plugin—include it individually or through the compiled bootstrap.js file—to extend our list group to create tabbable panes of local content.

    +
    +
    <div class="row">
    +  <div class="col-4">
    +    <div class="list-group" id="list-tab" role="tablist">
    +      <a class="list-group-item list-group-item-action active" id="list-home-list" data-bs-toggle="list" href="#list-home" role="tab" aria-controls="list-home">Home</a>
    +      <a class="list-group-item list-group-item-action" id="list-profile-list" data-bs-toggle="list" href="#list-profile" role="tab" aria-controls="list-profile">Profile</a>
    +      <a class="list-group-item list-group-item-action" id="list-messages-list" data-bs-toggle="list" href="#list-messages" role="tab" aria-controls="list-messages">Messages</a>
    +      <a class="list-group-item list-group-item-action" id="list-settings-list" data-bs-toggle="list" href="#list-settings" role="tab" aria-controls="list-settings">Settings</a>
    +    </div>
    +  </div>
    +  <div class="col-8">
    +    <div class="tab-content" id="nav-tabContent">
    +      <div class="tab-pane fade show active" id="list-home" role="tabpanel" aria-labelledby="list-home-list">...</div>
    +      <div class="tab-pane fade" id="list-profile" role="tabpanel" aria-labelledby="list-profile-list">...</div>
    +      <div class="tab-pane fade" id="list-messages" role="tabpanel" aria-labelledby="list-messages-list">...</div>
    +      <div class="tab-pane fade" id="list-settings" role="tabpanel" aria-labelledby="list-settings-list">...</div>
    +    </div>
    +  </div>
    +</div>
    +
    +

    Using data attributes

    +

    You can activate a list group navigation without writing any JavaScript by simply specifying data-bs-toggle="list" or on an element. Use these data attributes on .list-group-item.

    +
    <div role="tabpanel">
    +  <!-- List group -->
    +  <div class="list-group" id="myList" role="tablist">
    +    <a class="list-group-item list-group-item-action active" data-bs-toggle="list" href="#home" role="tab">Home</a>
    +    <a class="list-group-item list-group-item-action" data-bs-toggle="list" href="#profile" role="tab">Profile</a>
    +    <a class="list-group-item list-group-item-action" data-bs-toggle="list" href="#messages" role="tab">Messages</a>
    +    <a class="list-group-item list-group-item-action" data-bs-toggle="list" href="#settings" role="tab">Settings</a>
    +  </div>
    +
    +  <!-- Tab panes -->
    +  <div class="tab-content">
    +    <div class="tab-pane active" id="home" role="tabpanel">...</div>
    +    <div class="tab-pane" id="profile" role="tabpanel">...</div>
    +    <div class="tab-pane" id="messages" role="tabpanel">...</div>
    +    <div class="tab-pane" id="settings" role="tabpanel">...</div>
    +  </div>
    +</div>
    +
    +

    Via JavaScript

    +

    Enable tabbable list item via JavaScript (each list item needs to be activated individually):

    +
    const triggerTabList = document.querySelectorAll('#myTab a')
    +triggerTabList.forEach(triggerEl => {
    +  const tabTrigger = new bootstrap.Tab(triggerEl)
    +
    +  triggerEl.addEventListener('click', event => {
    +    event.preventDefault()
    +    tabTrigger.show()
    +  })
    +})
    +
    +

    You can activate individual list item in several ways:

    +
    const triggerEl = document.querySelector('#myTab a[href="#profile"]')
    +bootstrap.Tab.getInstance(triggerEl).show() // Select tab by name
    +
    +const triggerFirstTabEl = document.querySelector('#myTab li:first-child a')
    +bootstrap.Tab.getInstance(triggerFirstTabEl).show() // Select first tab
    +
    +

    Fade effect

    +

    To make tabs panel fade in, add .fade to each .tab-pane. The first tab pane must also have .show to make the initial content visible.

    +
    <div class="tab-content">
    +  <div class="tab-pane fade show active" id="home" role="tabpanel">...</div>
    +  <div class="tab-pane fade" id="profile" role="tabpanel">...</div>
    +  <div class="tab-pane fade" id="messages" role="tabpanel">...</div>
    +  <div class="tab-pane fade" id="settings" role="tabpanel">...</div>
    +</div>
    +
    +

    Methods

    +

    All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started, but before it ends. In addition, a method call on a transitioning component will be ignored. Learn more in our JavaScript docs.

    Activates your content as a tab element.

    You can create a tab instance with the constructor, for example:

    -
    const bsTab = new bootstrap.Tab('#myTab')
    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    MethodDescription
    disposeDestroys an element’s tab.
    getInstanceStatic method which allows you to get the tab instance associated with a DOM element, you can use it like this: bootstrap.Tab.getInstance(element).
    getOrCreateInstanceStatic method which returns a tab instance associated to a DOM element or create a new one in case it wasn’t initialized. You can use it like this: bootstrap.Tab.getOrCreateInstance(element).
    showSelects the given tab and shows its associated pane. Any other tab that was previously selected becomes unselected and its associated pane is hidden. Returns to the caller before the tab pane has actually been shown (i.e. before the shown.bs.tab event occurs).
    +
    const bsTab = new bootstrap.Tab('#myTab')
    +
    +
    -

    Events

    + + + + + + + + + + + + + + + + + + + + + + + +
    MethodDescription
    disposeDestroys an element’s tab.
    getInstanceStatic method which allows you to get the tab instance associated with a DOM element, you can use it like this: bootstrap.Tab.getInstance(element).
    getOrCreateInstanceStatic method which returns a tab instance associated to a DOM element or create a new one in case it wasn’t initialized. You can use it like this: bootstrap.Tab.getOrCreateInstance(element).
    showSelects the given tab and shows its associated pane. Any other tab that was previously selected becomes unselected and its associated pane is hidden. Returns to the caller before the tab pane has actually been shown (i.e. before the shown.bs.tab event occurs).
    +

    Events

    When showing a new tab, the events fire in the following order:

    1. hide.bs.tab (on the current active tab)
    2. @@ -1564,114 +664,41 @@
    3. shown.bs.tab (on the newly-active just-shown tab, the same one as for the show.bs.tab event)

    If no tab was already active, then the hide.bs.tab and hidden.bs.tab events will not be fired.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    Event typeDescription
    hide.bs.tabThis event fires when a new tab is to be shown (and thus the previous active tab is to be hidden). Use event.target and event.relatedTarget to target the current active tab and the new soon-to-be-active tab, respectively.
    hidden.bs.tabThis event fires after a new tab is shown (and thus the previous active tab is hidden). Use event.target and event.relatedTarget to target the previous active tab and the new active tab, respectively.
    show.bs.tabThis event fires on tab show, but before the new tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively.
    shown.bs.tabThis event fires on tab show after a tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively.
    - -
    const tabElms = document.querySelectorAll('a[data-bs-toggle="list"]')
    -tabElms.forEach(tabElm => {
    -  tabElm.addEventListener('shown.bs.tab', event => {
    -    event.target // newly activated tab
    -    event.relatedTarget // previous active tab
    -  })
    -})
    -
    -
    -
    -
    +
    - - - - - - - - - + + + + + + + + + + + + + + + + + + +
    Event typeDescription
    hide.bs.tabThis event fires when a new tab is to be shown (and thus the previous active tab is to be hidden). Use event.target and event.relatedTarget to target the current active tab and the new soon-to-be-active tab, respectively.
    hidden.bs.tabThis event fires after a new tab is shown (and thus the previous active tab is hidden). Use event.target and event.relatedTarget to target the previous active tab and the new active tab, respectively.
    show.bs.tabThis event fires on tab show, but before the new tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively.
    shown.bs.tabThis event fires on tab show after a tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively.
    +
    const tabElms = document.querySelectorAll('a[data-bs-toggle="list"]')
    +tabElms.forEach(tabElm => {
    +  tabElm.addEventListener('shown.bs.tab', event => {
    +    event.target // newly activated tab
    +    event.relatedTarget // previous active tab
    +  })
    +})
    +
    \ No newline at end of file diff --git a/docs/5.3/components/modal/index.html b/docs/5.3/components/modal/index.html index 76df0ae759..3a70f4aee2 100644 --- a/docs/5.3/components/modal/index.html +++ b/docs/5.3/components/modal/index.html @@ -1,818 +1,139 @@ - - - - - - - - - - - - - - - - -Modal · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Modal

    -
    -

    Use Bootstrap’s JavaScript modal plugin to add dialogs to your site for lightboxes, user notifications, or completely custom content.

    - - -
    - - - - - -
    - - -

    How it works

    -

    Before getting started with Bootstrap’s modal component, be sure to read the following as our menu options have recently changed.

    + Modal · Bootstrap v5.3

    Use Bootstrap’s JavaScript modal plugin to add dialogs to your site for lightboxes, user notifications, or completely custom content.

    +

    How it works

    +

    Before getting started with Bootstrap’s modal component, be sure to read the following as our menu options have recently changed.

      -
    • Modals are built with HTML, CSS, and JavaScript. They’re positioned over everything else in the document and remove scroll from the <body> so that modal content scrolls instead.
    • -
    • Clicking on the modal “backdrop” will automatically close the modal.
    • -
    • Bootstrap only supports one modal window at a time. Nested modals aren’t supported as we believe them to be poor user experiences.
    • -
    • Modals use position: fixed, which can sometimes be a bit particular about its rendering. Whenever possible, place your modal HTML in a top-level position to avoid potential interference from other elements. You’ll likely run into issues when nesting a .modal within another fixed element.
    • -
    • Once again, due to position: fixed, there are some caveats with using modals on mobile devices. See our browser support docs for details.
    • +
    • Modals are built with HTML, CSS, and JavaScript. They’re positioned over everything else in the document and remove scroll from the <body> so that modal content scrolls instead.
    • +
    • Clicking on the modal “backdrop” will automatically close the modal.
    • +
    • Bootstrap only supports one modal window at a time. Nested modals aren’t supported as we believe them to be poor user experiences.
    • +
    • Modals use position: fixed, which can sometimes be a bit particular about its rendering. Whenever possible, place your modal HTML in a top-level position to avoid potential interference from other elements. You’ll likely run into issues when nesting a .modal within another fixed element.
    • +
    • Once again, due to position: fixed, there are some caveats with using modals on mobile devices. See our browser support docs for details.
    • Due to how HTML5 defines its semantics, the autofocus HTML attribute has no effect in Bootstrap modals. To achieve the same effect, use some custom JavaScript:
    -
    const myModal = document.getElementById('myModal')
    -const myInput = document.getElementById('myInput')
    -
    -myModal.addEventListener('shown.bs.modal', () => {
    -  myInput.focus()
    -})
    -
    -The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation. -
    +
    const myModal = document.getElementById('myModal')
    +const myInput = document.getElementById('myInput')
     
    +myModal.addEventListener('shown.bs.modal', () => {
    +  myInput.focus()
    +})
    +
    +

    The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation.

    Keep reading for demos and usage guidelines.

    -

    Examples

    - +

    Examples

    +

    Below is a static modal example (meaning its position and display have been overridden). Included are the modal header, modal body (required for padding), and modal footer (optional). We ask that you include modal headers with dismiss actions whenever possible, or provide another explicit dismiss action.

    -
    - -
    -
    <div class="modal" tabindex="-1">
    -  <div class="modal-dialog">
    -    <div class="modal-content">
    -      <div class="modal-header">
    -        <h5 class="modal-title">Modal title</h5>
    -        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
    -      </div>
    -      <div class="modal-body">
    -        <p>Modal body text goes here.</p>
    -      </div>
    -      <div class="modal-footer">
    -        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
    -        <button type="button" class="btn btn-primary">Save changes</button>
    -      </div>
    -    </div>
    -  </div>
    -</div>
    -
    -In the above static example, we use <h5>, to avoid issues with the heading hierarchy in the documentation page. Structurally, however, a modal dialog represents its own separate document/context, so the .modal-title should ideally be an <h1>. If necessary, you can use the font size utilities to control the heading’s appearance. All the following live examples use this approach. -
    - -

    Live demo

    +
    +
    <div class="modal" tabindex="-1">
    +  <div class="modal-dialog">
    +    <div class="modal-content">
    +      <div class="modal-header">
    +        <h5 class="modal-title">Modal title</h5>
    +        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
    +      </div>
    +      <div class="modal-body">
    +        <p>Modal body text goes here.</p>
    +      </div>
    +      <div class="modal-footer">
    +        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
    +        <button type="button" class="btn btn-primary">Save changes</button>
    +      </div>
    +    </div>
    +  </div>
    +</div>
    +
    +

    In the above static example, we use <h5>, to avoid issues with the heading hierarchy in the documentation page. Structurally, however, a modal dialog represents its own separate document/context, so the .modal-title should ideally be an <h1>. If necessary, you can use the font size utilities to control the heading’s appearance. All the following live examples use this approach.

    +

    Live demo

    Toggle a working modal demo by clicking the button below. It will slide down and fade in from the top of the page.

    - -
    - -
    -
    <!-- Button trigger modal -->
    -<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
    -  Launch demo modal
    -</button>
    -
    -<!-- Modal -->
    -<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
    -  <div class="modal-dialog">
    -    <div class="modal-content">
    -      <div class="modal-header">
    -        <h1 class="modal-title fs-5" id="exampleModalLabel">Modal title</h1>
    -        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
    -      </div>
    -      <div class="modal-body">
    -        ...
    -      </div>
    -      <div class="modal-footer">
    -        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
    -        <button type="button" class="btn btn-primary">Save changes</button>
    -      </div>
    -    </div>
    -  </div>
    -</div>
    -

    Static backdrop

    + +
    +
    <!-- Button trigger modal -->
    +<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal">
    +  Launch demo modal
    +</button>
    +
    +<!-- Modal -->
    +<div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
    +  <div class="modal-dialog">
    +    <div class="modal-content">
    +      <div class="modal-header">
    +        <h1 class="modal-title fs-5" id="exampleModalLabel">Modal title</h1>
    +        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
    +      </div>
    +      <div class="modal-body">
    +        ...
    +      </div>
    +      <div class="modal-footer">
    +        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
    +        <button type="button" class="btn btn-primary">Save changes</button>
    +      </div>
    +    </div>
    +  </div>
    +</div>
    +
    +

    Static backdrop

    When backdrop is set to static, the modal will not close when clicking outside of it. Click the button below to try it.

    - -
    - -
    -
    <!-- Button trigger modal -->
    -<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#staticBackdrop">
    -  Launch static backdrop modal
    -</button>
    -
    -<!-- Modal -->
    -<div class="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
    -  <div class="modal-dialog">
    -    <div class="modal-content">
    -      <div class="modal-header">
    -        <h1 class="modal-title fs-5" id="staticBackdropLabel">Modal title</h1>
    -        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
    -      </div>
    -      <div class="modal-body">
    -        ...
    -      </div>
    -      <div class="modal-footer">
    -        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
    -        <button type="button" class="btn btn-primary">Understood</button>
    -      </div>
    -    </div>
    -  </div>
    -</div>
    -

    Scrolling long content

    -

    When modals become too long for the user’s viewport or device, they scroll independent of the page itself. Try the demo below to see what we mean.

    - -
    - -
    + +
    +
    <!-- Button trigger modal -->
    +<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#staticBackdrop">
    +  Launch static backdrop modal
    +</button>
    +
    +<!-- Modal -->
    +<div class="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
    +  <div class="modal-dialog">
    +    <div class="modal-content">
    +      <div class="modal-header">
    +        <h1 class="modal-title fs-5" id="staticBackdropLabel">Modal title</h1>
    +        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
    +      </div>
    +      <div class="modal-body">
    +        ...
    +      </div>
    +      <div class="modal-footer">
    +        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
    +        <button type="button" class="btn btn-primary">Understood</button>
    +      </div>
    +    </div>
    +  </div>
    +</div>
    +
    +

    Scrolling long content

    +

    When modals become too long for the user’s viewport or device, they scroll independent of the page itself. Try the demo below to see what we mean.

    + +

    You can also create a scrollable modal that allows scrolling the modal body by adding .modal-dialog-scrollable to .modal-dialog.

    - -
    - -
    -
    <!-- Scrollable modal -->
    -<div class="modal-dialog modal-dialog-scrollable">
    -  ...
    -</div>
    -

    Vertically centered

    + +
    +
    <!-- Scrollable modal -->
    +<div class="modal-dialog modal-dialog-scrollable">
    +  ...
    +</div>
    +
    +

    Vertically centered

    Add .modal-dialog-centered to .modal-dialog to vertically center the modal.

    -
    +
    const exampleModal = document.getElementById('exampleModal')
    +if (exampleModal) {
    +  exampleModal.addEventListener('show.bs.modal', event => {
    +    // Button that triggered the modal
    +    const button = event.relatedTarget
    +    // Extract info from data-bs-* attributes
    +    const recipient = button.getAttribute('data-bs-whatever')
    +    // If necessary, you could initiate an Ajax request here
    +    // and then do the updating in a callback.
     
    -
    -
    const exampleModal = document.getElementById('exampleModal')
    -if (exampleModal) {
    -  exampleModal.addEventListener('show.bs.modal', event => {
    -    // Button that triggered the modal
    -    const button = event.relatedTarget
    -    // Extract info from data-bs-* attributes
    -    const recipient = button.getAttribute('data-bs-whatever')
    -    // If necessary, you could initiate an Ajax request here
    -    // and then do the updating in a callback.
    -
    -    // Update the modal's content.
    -    const modalTitle = exampleModal.querySelector('.modal-title')
    -    const modalBodyInput = exampleModal.querySelector('.modal-body input')
    -
    -    modalTitle.textContent = `New message to ${recipient}`
    -    modalBodyInput.value = recipient
    -  })
    -}
    -

    Toggle between modals

    + // Update the modal's content. + const modalTitle = exampleModal.querySelector('.modal-title') + const modalBodyInput = exampleModal.querySelector('.modal-body input') + + modalTitle.textContent = `New message to ${recipient}` + modalBodyInput.value = recipient + }) +} +
    +

    Toggle between modals

    Toggle between multiple modals with some clever placement of the data-bs-target and data-bs-toggle attributes. For example, you could toggle a password reset modal from within an already open sign in modal. Please note multiple modals cannot be open at the same time—this method simply toggles between two separate modals.

    -
    -
    - - +

    Change animation

    The $modal-fade-transform variable determines the transform state of .modal-dialog before the modal fade-in animation, the $modal-show-transform variable determines the transform of .modal-dialog at the end of the modal fade-in animation.

    If you want for example a zoom-in animation, you can set $modal-fade-transform: scale(.8).

    -

    Remove animation

    +

    Remove animation

    For modals that simply appear rather than fade in to view, remove the .fade class from your modal markup.

    -
    <div class="modal" tabindex="-1" aria-labelledby="..." aria-hidden="true">
    -  ...
    -</div>
    -

    Dynamic heights

    -

    If the height of a modal changes while it is open, you should call myModal.handleUpdate() to readjust the modal’s position in case a scrollbar appears.

    -

    Accessibility

    -

    Be sure to add aria-labelledby="...", referencing the modal title, to .modal. Additionally, you may give a description of your modal dialog with aria-describedby on .modal. Note that you don’t need to add role="dialog" since we already add it via JavaScript.

    -

    Embedding YouTube videos

    +
    <div class="modal" tabindex="-1" aria-labelledby="..." aria-hidden="true">
    +  ...
    +</div>
    +
    +

    Dynamic heights

    +

    If the height of a modal changes while it is open, you should call myModal.handleUpdate() to readjust the modal’s position in case a scrollbar appears.

    +

    Accessibility

    +

    Be sure to add aria-labelledby="...", referencing the modal title, to .modal. Additionally, you may give a description of your modal dialog with aria-describedby on .modal. Note that you don’t need to add role="dialog" since we already add it via JavaScript.

    +

    Embedding YouTube videos

    Embedding YouTube videos in modals requires additional JavaScript not in Bootstrap to automatically stop playback and more. See this helpful Stack Overflow post for more information.

    -

    Optional sizes

    +

    Optional sizes

    Modals have three optional sizes, available via modifier classes to be placed on a .modal-dialog. These sizes kick in at certain breakpoints to avoid horizontal scrollbars on narrower viewports.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    SizeClassModal max-width
    Small.modal-sm300px
    DefaultNone500px
    Large.modal-lg800px
    Extra large.modal-xl1140px
    +
    -

    Our default modal without modifier class constitutes the “medium” size modal.

    -
    - - - -
    -
    <div class="modal-dialog modal-xl">...</div>
    -<div class="modal-dialog modal-lg">...</div>
    -<div class="modal-dialog modal-sm">...</div>
    -
    - - -

    Fullscreen Modal

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    SizeClassModal max-width
    Small.modal-sm300px
    DefaultNone500px
    Large.modal-lg800px
    Extra large.modal-xl1140px
    +

    Our default modal without modifier class constitutes the “medium” size modal.

    +
    + +
    +
    <div class="modal-dialog modal-xl">...</div>
    +<div class="modal-dialog modal-lg">...</div>
    +<div class="modal-dialog modal-sm">...</div>
    +
    + + + +

    Fullscreen Modal

    Another override is the option to pop up a modal that covers the user viewport, available via modifier classes that are placed on a .modal-dialog.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ClassAvailability
    .modal-fullscreenAlways
    .modal-fullscreen-sm-down576px
    .modal-fullscreen-md-down768px
    .modal-fullscreen-lg-down992px
    .modal-fullscreen-xl-down1200px
    .modal-fullscreen-xxl-down1400px
    +
    -
    - - - - - - -
    -
    <!-- Full screen modal -->
    -<div class="modal-dialog modal-fullscreen-sm-down">
    -  ...
    -</div>
    -
    - - - - - -

    CSS

    -

    Variables

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ClassAvailability
    .modal-fullscreenAlways
    .modal-fullscreen-sm-down576px
    .modal-fullscreen-md-down768px
    .modal-fullscreen-lg-down992px
    .modal-fullscreen-xl-down1200px
    .modal-fullscreen-xxl-down1400px
    +
    + + + + +
    +
    <!-- Full screen modal -->
    +<div class="modal-dialog modal-fullscreen-sm-down">
    +  ...
    +</div>
    +
    + + + + + + +

    CSS

    +

    Variables

    Added in v5.2.0 +

    As part of Bootstrap’s evolving CSS variables approach, modals now use local CSS variables on .modal and .modal-backdrop for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    +
    --#{$prefix}modal-zindex: #{$zindex-modal};
    +--#{$prefix}modal-width: #{$modal-md};
    +--#{$prefix}modal-padding: #{$modal-inner-padding};
    +--#{$prefix}modal-margin: #{$modal-dialog-margin};
    +--#{$prefix}modal-color: #{$modal-content-color};
    +--#{$prefix}modal-bg: #{$modal-content-bg};
    +--#{$prefix}modal-border-color: #{$modal-content-border-color};
    +--#{$prefix}modal-border-width: #{$modal-content-border-width};
    +--#{$prefix}modal-border-radius: #{$modal-content-border-radius};
    +--#{$prefix}modal-box-shadow: #{$modal-content-box-shadow-xs};
    +--#{$prefix}modal-inner-border-radius: #{$modal-content-inner-border-radius};
    +--#{$prefix}modal-header-padding-x: #{$modal-header-padding-x};
    +--#{$prefix}modal-header-padding-y: #{$modal-header-padding-y};
    +--#{$prefix}modal-header-padding: #{$modal-header-padding}; // Todo in v6: Split this padding into x and y
    +--#{$prefix}modal-header-border-color: #{$modal-header-border-color};
    +--#{$prefix}modal-header-border-width: #{$modal-header-border-width};
    +--#{$prefix}modal-title-line-height: #{$modal-title-line-height};
    +--#{$prefix}modal-footer-gap: #{$modal-footer-margin-between};
    +--#{$prefix}modal-footer-bg: #{$modal-footer-bg};
    +--#{$prefix}modal-footer-border-color: #{$modal-footer-border-color};
    +--#{$prefix}modal-footer-border-width: #{$modal-footer-border-width};
    +
    +
    --#{$prefix}backdrop-zindex: #{$zindex-modal-backdrop};
    +--#{$prefix}backdrop-bg: #{$modal-backdrop-bg};
    +--#{$prefix}backdrop-opacity: #{$modal-backdrop-opacity};
    +
    +

    Sass variables

    +
    $modal-inner-padding:               $spacer;
     
    -

    As part of Bootstrap’s evolving CSS variables approach, modals now use local CSS variables on .modal and .modal-backdrop for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    -
    -
    - scss/_modal.scss -
    - -
    -
    --#{$prefix}modal-zindex: #{$zindex-modal};
    ---#{$prefix}modal-width: #{$modal-md};
    ---#{$prefix}modal-padding: #{$modal-inner-padding};
    ---#{$prefix}modal-margin: #{$modal-dialog-margin};
    ---#{$prefix}modal-color: #{$modal-content-color};
    ---#{$prefix}modal-bg: #{$modal-content-bg};
    ---#{$prefix}modal-border-color: #{$modal-content-border-color};
    ---#{$prefix}modal-border-width: #{$modal-content-border-width};
    ---#{$prefix}modal-border-radius: #{$modal-content-border-radius};
    ---#{$prefix}modal-box-shadow: #{$modal-content-box-shadow-xs};
    ---#{$prefix}modal-inner-border-radius: #{$modal-content-inner-border-radius};
    ---#{$prefix}modal-header-padding-x: #{$modal-header-padding-x};
    ---#{$prefix}modal-header-padding-y: #{$modal-header-padding-y};
    ---#{$prefix}modal-header-padding: #{$modal-header-padding}; // Todo in v6: Split this padding into x and y
    ---#{$prefix}modal-header-border-color: #{$modal-header-border-color};
    ---#{$prefix}modal-header-border-width: #{$modal-header-border-width};
    ---#{$prefix}modal-title-line-height: #{$modal-title-line-height};
    ---#{$prefix}modal-footer-gap: #{$modal-footer-margin-between};
    ---#{$prefix}modal-footer-bg: #{$modal-footer-bg};
    ---#{$prefix}modal-footer-border-color: #{$modal-footer-border-color};
    ---#{$prefix}modal-footer-border-width: #{$modal-footer-border-width};
    -
    -
    - scss/_modal.scss -
    - -
    -
    --#{$prefix}backdrop-zindex: #{$zindex-modal-backdrop};
    ---#{$prefix}backdrop-bg: #{$modal-backdrop-bg};
    ---#{$prefix}backdrop-opacity: #{$modal-backdrop-opacity};
    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $modal-inner-padding:               $spacer;
    -
    -$modal-footer-margin-between:       .5rem;
    -
    -$modal-dialog-margin:               .5rem;
    -$modal-dialog-margin-y-sm-up:       1.75rem;
    -
    -$modal-title-line-height:           $line-height-base;
    -
    -$modal-content-color:               var(--#{$prefix}body-color);
    -$modal-content-bg:                  var(--#{$prefix}body-bg);
    -$modal-content-border-color:        var(--#{$prefix}border-color-translucent);
    -$modal-content-border-width:        var(--#{$prefix}border-width);
    -$modal-content-border-radius:       var(--#{$prefix}border-radius-lg);
    -$modal-content-inner-border-radius: subtract($modal-content-border-radius, $modal-content-border-width);
    -$modal-content-box-shadow-xs:       var(--#{$prefix}box-shadow-sm);
    -$modal-content-box-shadow-sm-up:    var(--#{$prefix}box-shadow);
    -
    -$modal-backdrop-bg:                 $black;
    -$modal-backdrop-opacity:            .5;
    -
    -$modal-header-border-color:         var(--#{$prefix}border-color);
    -$modal-header-border-width:         $modal-content-border-width;
    -$modal-header-padding-y:            $modal-inner-padding;
    -$modal-header-padding-x:            $modal-inner-padding;
    -$modal-header-padding:              $modal-header-padding-y $modal-header-padding-x; // Keep this for backwards compatibility
    -
    -$modal-footer-bg:                   null;
    -$modal-footer-border-color:         $modal-header-border-color;
    -$modal-footer-border-width:         $modal-header-border-width;
    -
    -$modal-sm:                          300px;
    -$modal-md:                          500px;
    -$modal-lg:                          800px;
    -$modal-xl:                          1140px;
    -
    -$modal-fade-transform:              translate(0, -50px);
    -$modal-show-transform:              none;
    -$modal-transition:                  transform .3s ease-out;
    -$modal-scale-transform:             scale(1.02);
    -
    -

    Sass loops

    +$modal-footer-margin-between: .5rem; + +$modal-dialog-margin: .5rem; +$modal-dialog-margin-y-sm-up: 1.75rem; + +$modal-title-line-height: $line-height-base; + +$modal-content-color: var(--#{$prefix}body-color); +$modal-content-bg: var(--#{$prefix}body-bg); +$modal-content-border-color: var(--#{$prefix}border-color-translucent); +$modal-content-border-width: var(--#{$prefix}border-width); +$modal-content-border-radius: var(--#{$prefix}border-radius-lg); +$modal-content-inner-border-radius: subtract($modal-content-border-radius, $modal-content-border-width); +$modal-content-box-shadow-xs: var(--#{$prefix}box-shadow-sm); +$modal-content-box-shadow-sm-up: var(--#{$prefix}box-shadow); + +$modal-backdrop-bg: $black; +$modal-backdrop-opacity: .5; + +$modal-header-border-color: var(--#{$prefix}border-color); +$modal-header-border-width: $modal-content-border-width; +$modal-header-padding-y: $modal-inner-padding; +$modal-header-padding-x: $modal-inner-padding; +$modal-header-padding: $modal-header-padding-y $modal-header-padding-x; // Keep this for backwards compatibility + +$modal-footer-bg: null; +$modal-footer-border-color: $modal-header-border-color; +$modal-footer-border-width: $modal-header-border-width; + +$modal-sm: 300px; +$modal-md: 500px; +$modal-lg: 800px; +$modal-xl: 1140px; + +$modal-fade-transform: translate(0, -50px); +$modal-show-transform: none; +$modal-transition: transform .3s ease-out; +$modal-scale-transform: scale(1.02); +
    +

    Sass loops

    Responsive fullscreen modals are generated via the $breakpoints map and a loop in scss/_modal.scss.

    -
    -
    - scss/_modal.scss -
    - -
    -
    @each $breakpoint in map-keys($grid-breakpoints) {
    -  $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
    -  $postfix: if($infix != "", $infix + "-down", "");
    -
    -  @include media-breakpoint-down($breakpoint) {
    -    .modal-fullscreen#{$postfix} {
    -      width: 100vw;
    -      max-width: none;
    -      height: 100%;
    -      margin: 0;
    -
    -      .modal-content {
    -        height: 100%;
    -        border: 0;
    -        @include border-radius(0);
    -      }
    -
    -      .modal-header,
    -      .modal-footer {
    -        @include border-radius(0);
    -      }
    -
    -      .modal-body {
    -        overflow-y: auto;
    -      }
    -    }
    -  }
    -}
    -
    -

    Usage

    +
    @each $breakpoint in map-keys($grid-breakpoints) {
    +  $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
    +  $postfix: if($infix != "", $infix + "-down", "");
    +
    +  @include media-breakpoint-down($breakpoint) {
    +    .modal-fullscreen#{$postfix} {
    +      width: 100vw;
    +      max-width: none;
    +      height: 100%;
    +      margin: 0;
    +
    +      .modal-content {
    +        height: 100%;
    +        border: 0;
    +        @include border-radius(0);
    +      }
    +
    +      .modal-header,
    +      .modal-footer {
    +        @include border-radius(0);
    +      }
    +
    +      .modal-body {
    +        overflow-y: auto;
    +      }
    +    }
    +  }
    +}
    +
    +

    Usage

    The modal plugin toggles your hidden content on demand, via data attributes or JavaScript. It also overrides default scrolling behavior and generates a .modal-backdrop to provide a click area for dismissing shown modals when clicking outside the modal.

    -

    Via data attributes

    -

    Toggle

    +

    Via data attributes

    +

    Toggle

    Activate a modal without writing JavaScript. Set data-bs-toggle="modal" on a controller element, like a button, along with a data-bs-target="#foo" or href="#foo" to target a specific modal to toggle.

    -
    <button type="button" data-bs-toggle="modal" data-bs-target="#myModal">Launch modal</button>
    -

    Dismiss

    -

    Dismissal can be achieved with the data-bs-dismiss attribute on a button within the modal as demonstrated below:

    -
    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
    -

    or on a button outside the modal using the additional data-bs-target as demonstrated below:

    -
    <button type="button" class="btn-close" data-bs-dismiss="modal" data-bs-target="#my-modal" aria-label="Close"></button>
    -
    -While both ways to dismiss a modal are supported, keep in mind that dismissing from outside a modal does not match the ARIA Authoring Practices Guide dialog (modal) pattern. Do this at your own risk. -
    - -

    Via JavaScript

    +
    <button type="button" data-bs-toggle="modal" data-bs-target="#myModal">Launch modal</button>
    +
    +

    Dismiss

    +

    +Dismissal can be achieved with the data-bs-dismiss attribute on a button within the modal as demonstrated below: +

    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>

    +or on a button outside the modal using the additional data-bs-target as demonstrated below: +

    <button type="button" class="btn-close" data-bs-dismiss="modal" data-bs-target="#my-modal" aria-label="Close"></button>
    +

    While both ways to dismiss a modal are supported, keep in mind that dismissing from outside a modal does not match the ARIA Authoring Practices Guide dialog (modal) pattern. Do this at your own risk.

    +

    Via JavaScript

    Create a modal with a single line of JavaScript:

    -
    const myModal = new bootstrap.Modal(document.getElementById('myModal'), options)
    -// or
    -const myModalAlternative = new bootstrap.Modal('#myModal', options)
    -

    Options

    -

    As options can be passed via data attributes or JavaScript, you can append an option name to data-bs-, as in data-bs-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-bs-custom-class="beautifier" instead of data-bs-customClass="beautifier".

    -

    As of Bootstrap 5.2.0, all components support an experimental reserved data attribute data-bs-config that can house simple component configuration as a JSON string. When an element has data-bs-config='{"delay":0, "title":123}' and data-bs-title="456" attributes, the final title value will be 456 and the separate data attributes will override values given on data-bs-config. In addition, existing data attributes are able to house JSON values like data-bs-delay='{"show":0,"hide":150}'.

    +
    const myModal = new bootstrap.Modal(document.getElementById('myModal'), options)
    +// or
    +const myModalAlternative = new bootstrap.Modal('#myModal', options)
    +
    +

    Options

    +

    As options can be passed via data attributes or JavaScript, you can append an option name to data-bs-, as in data-bs-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-bs-custom-class="beautifier" instead of data-bs-customClass="beautifier".

    +

    As of Bootstrap 5.2.0, all components support an experimental reserved data attribute data-bs-config that can house simple component configuration as a JSON string. When an element has data-bs-config='{"delay":0, "title":123}' and data-bs-title="456" attributes, the final title value will be 456 and the separate data attributes will override values given on data-bs-config. In addition, existing data attributes are able to house JSON values like data-bs-delay='{"show":0,"hide":150}'.

    The final configuration object is the merged result of data-bs-config, data-bs-, and js object where the latest given key-value overrides the others.

    +
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDefaultDescription
    backdropboolean, 'static'trueIncludes a modal-backdrop element. Alternatively, specify static for a backdrop which doesn’t close the modal when clicked.
    focusbooleantruePuts the focus on the modal when initialized.
    keyboardbooleantrueCloses the modal when escape key is pressed.
    -

    Methods

    -
    -All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started, but before it ends. In addition, a method call on a transitioning component will be ignored. Learn more in our JavaScript docs. -
    -

    Passing options

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDefaultDescription
    backdropboolean, ’static'trueIncludes a modal-backdrop element. Alternatively, specify static for a backdrop which doesn’t close the modal when clicked.
    focusbooleantruePuts the focus on the modal when initialized.
    keyboardbooleantrueCloses the modal when escape key is pressed.
    +

    Methods

    +

    All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started, but before it ends. In addition, a method call on a transitioning component will be ignored. Learn more in our JavaScript docs.

    +

    Passing options

    Activates your content as a modal. Accepts an optional options object.

    -
    const myModal = new bootstrap.Modal('#myModal', {
    -  keyboard: false
    -})
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    MethodDescription
    disposeDestroys an element’s modal. (Removes stored data on the DOM element)
    getInstanceStatic method which allows you to get the modal instance associated with a DOM element.
    getOrCreateInstanceStatic method which allows you to get the modal instance associated with a DOM element, or create a new one in case it wasn’t initialized.
    handleUpdateManually readjust the modal’s position if the height of a modal changes while it is open (i.e. in case a scrollbar appears).
    hideManually hides a modal. Returns to the caller before the modal has actually been hidden (i.e. before the hidden.bs.modal event occurs).
    showManually opens a modal. Returns to the caller before the modal has actually been shown (i.e. before the shown.bs.modal event occurs). Also, you can pass a DOM element as an argument that can be received in the modal events (as the relatedTarget property). (i.e. const modalToggle = document.getElementById('toggleMyModal'); myModal.show(modalToggle).
    toggleManually toggles a modal. Returns to the caller before the modal has actually been shown or hidden (i.e. before the shown.bs.modal or hidden.bs.modal event occurs).
    - -

    Events

    -

    Bootstrap’s modal class exposes a few events for hooking into modal functionality. All modal events are fired at the modal itself (i.e. at the <div class="modal">).

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    EventDescription
    hide.bs.modalThis event is fired immediately when the hide instance method has been called. Can be prevented by calling event.preventDefault(). See JavaScript events documentation for more details on event prevention.
    hidden.bs.modalThis event is fired when the modal has finished being hidden from the user (will wait for CSS transitions to complete).
    hidePrevented.bs.modalThis event is fired when the modal is shown, its backdrop is static and a click outside of the modal is performed. The event is also fired when the escape key is pressed and the keyboard option is set to false.
    show.bs.modalThis event fires immediately when the show instance method is called. If caused by a click, the clicked element is available as the relatedTarget property of the event.
    shown.bs.modalThis event is fired when the modal has been made visible to the user (will wait for CSS transitions to complete). If caused by a click, the clicked element is available as the relatedTarget property of the event.
    - -
    const myModalEl = document.getElementById('myModal')
    -myModalEl.addEventListener('hidden.bs.modal', event => {
    -  // do something...
    -})
    -
    -
    -
    -
    +
    const myModal = new bootstrap.Modal('#myModal', {
    +  keyboard: false
    +})
    +
    +
    - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MethodDescription
    disposeDestroys an element’s modal. (Removes stored data on the DOM element)
    getInstanceStatic method which allows you to get the modal instance associated with a DOM element.
    getOrCreateInstanceStatic method which allows you to get the modal instance associated with a DOM element, or create a new one in case it wasn’t initialized.
    handleUpdateManually readjust the modal’s position if the height of a modal changes while it is open (i.e. in case a scrollbar appears).
    hideManually hides a modal. Returns to the caller before the modal has actually been hidden (i.e. before the hidden.bs.modal event occurs).
    showManually opens a modal. Returns to the caller before the modal has actually been shown (i.e. before the shown.bs.modal event occurs). Also, you can pass a DOM element as an argument that can be received in the modal events (as the relatedTarget property). (i.e. const modalToggle = document.getElementById('toggleMyModal'); myModal.show(modalToggle).
    toggleManually toggles a modal. Returns to the caller before the modal has actually been shown or hidden (i.e. before the shown.bs.modal or hidden.bs.modal event occurs).
    +

    Events

    +

    Bootstrap’s modal class exposes a few events for hooking into modal functionality. All modal events are fired at the modal itself (i.e. at the <div class="modal">).

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    EventDescription
    hide.bs.modalThis event is fired immediately when the hide instance method has been called. Can be prevented by calling event.preventDefault(). See JavaScript events documentation for more details on event prevention.
    hidden.bs.modalThis event is fired when the modal has finished being hidden from the user (will wait for CSS transitions to complete).
    hidePrevented.bs.modalThis event is fired when the modal is shown, its backdrop is static and a click outside of the modal is performed. The event is also fired when the escape key is pressed and the keyboard option is set to false.
    show.bs.modalThis event fires immediately when the show instance method is called. If caused by a click, the clicked element is available as the relatedTarget property of the event.
    shown.bs.modalThis event is fired when the modal has been made visible to the user (will wait for CSS transitions to complete). If caused by a click, the clicked element is available as the relatedTarget property of the event.
    +
    const myModalEl = document.getElementById('myModal')
    +myModalEl.addEventListener('hidden.bs.modal', event => {
    +  // do something...
    +})
    +
    \ No newline at end of file diff --git a/docs/5.3/components/navbar/index.html b/docs/5.3/components/navbar/index.html index fa7952ac84..e1eba7b6a5 100644 --- a/docs/5.3/components/navbar/index.html +++ b/docs/5.3/components/navbar/index.html @@ -1,607 +1,39 @@ - - - - - - - - - - - - - - - - -Navbar · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Navbar

    -
    -

    Documentation and examples for Bootstrap’s powerful, responsive navigation header, the navbar. Includes support for branding, navigation, and more, including support for our collapse plugin.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    How it works

    -

    Here’s what you need to know before getting started with the navbar:

    + Navbar · Bootstrap v5.3

    Documentation and examples for Bootstrap’s powerful, responsive navigation header, the navbar. Includes support for branding, navigation, and more, including support for our collapse plugin.

    +

    How it works

    +

    Here’s what you need to know before getting started with the navbar:

    • Navbars require a wrapping .navbar with .navbar-expand{-sm|-md|-lg|-xl|-xxl} for responsive collapsing and color scheme classes.
    • Navbars and their contents are fluid by default. Change the container to limit their horizontal width in different ways.
    • -
    • Use our spacing and flex utility classes for controlling spacing and alignment within navbars.
    • +
    • Use our spacing and flex utility classes for controlling spacing and alignment within navbars.
    • Navbars are responsive by default, but you can easily modify them to change that. Responsive behavior depends on our Collapse JavaScript plugin.
    • Ensure accessibility by using a <nav> element or, if using a more generic element such as a <div>, add a role="navigation" to every navbar to explicitly identify it as a landmark region for users of assistive technologies.
    • Indicate the current item by using aria-current="page" for the current page or aria-current="true" for the current item in a set.
    • New in v5.2.0: Navbars can be themed with CSS variables that are scoped to the .navbar base class. .navbar-light has been deprecated and .navbar-dark has been rewritten to override CSS variables instead of adding additional styles.
    -
    -The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation. -
    - -

    Supported content

    +

    The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation.

    +

    Supported content

    Navbars come with built-in support for a handful of sub-components. Choose from the following as needed:

    • .navbar-brand for your company, product, or project name.
    • @@ -612,11 +44,8 @@ The animation effect of this component is dependent on the prefers-reduced
    • .collapse.navbar-collapse for grouping and hiding navbar contents by a parent breakpoint.
    • Add an optional .navbar-nav-scroll to set a max-height and scroll expanded navbar content.
    -

    Here’s an example of all the sub-components included in a responsive light-themed navbar that automatically collapses at the lg (large) breakpoint.

    -
    -
    - - - -
    - html -
    - - -
    -
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    -  <div class="container-fluid">
    -    <a class="navbar-brand" href="#">Navbar</a>
    -    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
    -      <span class="navbar-toggler-icon"></span>
    -    </button>
    -    <div class="collapse navbar-collapse" id="navbarSupportedContent">
    -      <ul class="navbar-nav me-auto mb-2 mb-lg-0">
    -        <li class="nav-item">
    -          <a class="nav-link active" aria-current="page" href="#">Home</a>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link" href="#">Link</a>
    -        </li>
    -        <li class="nav-item dropdown">
    -          <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
    -            Dropdown
    -          </a>
    -          <ul class="dropdown-menu">
    -            <li><a class="dropdown-item" href="#">Action</a></li>
    -            <li><a class="dropdown-item" href="#">Another action</a></li>
    -            <li><hr class="dropdown-divider"></li>
    -            <li><a class="dropdown-item" href="#">Something else here</a></li>
    -          </ul>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    -        </li>
    -      </ul>
    -      <form class="d-flex" role="search">
    -        <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
    -        <button class="btn btn-outline-success" type="submit">Search</button>
    -      </form>
    -    </div>
    -  </div>
    -</nav>
    -
    - -

    This example uses background (bg-body-tertiary) and spacing (me-auto, mb-2, mb-lg-0, me-2) utility classes.

    -

    Brand

    +
    html
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    +  <div class="container-fluid">
    +    <a class="navbar-brand" href="#">Navbar</a>
    +    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
    +      <span class="navbar-toggler-icon"></span>
    +    </button>
    +    <div class="collapse navbar-collapse" id="navbarSupportedContent">
    +      <ul class="navbar-nav me-auto mb-2 mb-lg-0">
    +        <li class="nav-item">
    +          <a class="nav-link active" aria-current="page" href="#">Home</a>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link" href="#">Link</a>
    +        </li>
    +        <li class="nav-item dropdown">
    +          <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
    +            Dropdown
    +          </a>
    +          <ul class="dropdown-menu">
    +            <li><a class="dropdown-item" href="#">Action</a></li>
    +            <li><a class="dropdown-item" href="#">Another action</a></li>
    +            <li><hr class="dropdown-divider"></li>
    +            <li><a class="dropdown-item" href="#">Something else here</a></li>
    +          </ul>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +        </li>
    +      </ul>
    +      <form class="d-flex" role="search">
    +        <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"/>
    +        <button class="btn btn-outline-success" type="submit">Search</button>
    +      </form>
    +    </div>
    +  </div>
    +</nav>
    +

    This example uses background (bg-body-tertiary) and spacing (me-auto, mb-2, mb-lg-0, me-2) utility classes.

    +

    Brand

    The .navbar-brand can be applied to most elements, but an anchor works best, as some elements might require utility classes or custom styles.

    -

    Text

    +

    Text

    Add your text within an element with the .navbar-brand class.

    -
    -
    - - +
    +
    html
    <!-- As a link -->
    +<nav class="navbar bg-body-tertiary">
    +  <div class="container-fluid">
    +    <a class="navbar-brand" href="#">Navbar</a>
    +  </div>
    +</nav>
     
    -  
    - html -
    - - -
    -
    <!-- As a link -->
    -<nav class="navbar bg-body-tertiary">
    -  <div class="container-fluid">
    -    <a class="navbar-brand" href="#">Navbar</a>
    -  </div>
    -</nav>
    -
    -<!-- As a heading -->
    -<nav class="navbar bg-body-tertiary">
    -  <div class="container-fluid">
    -    <span class="navbar-brand mb-0 h1">Navbar</span>
    -  </div>
    -</nav>
    -
    - -

    Image

    +<!-- As a heading --> +<nav class="navbar bg-body-tertiary"> + <div class="container-fluid"> + <span class="navbar-brand mb-0 h1">Navbar</span> + </div> +</nav>
    +

    Image

    You can replace the text within the .navbar-brand with an <img>.

    -
    -
    - -
    html
    <nav class="navbar bg-body-tertiary">
    +  <div class="container">
    +    <a class="navbar-brand" href="#">
    +      <img src="/docs/5.3/assets/brand/bootstrap-logo.svg" alt="Bootstrap" width="30" height="24">
    +    </a>
    +  </div>
    +</nav>
    +

    Image and text

    You can also make use of some additional utilities to add an image and text at the same time. Note the addition of .d-inline-block and .align-text-top on the <img>.

    -
    -
    - -
    html
    <nav class="navbar bg-body-tertiary">
    +  <div class="container-fluid">
    +    <a class="navbar-brand" href="#">
    +      <img src="/docs/5.3/assets/brand/bootstrap-logo.svg" alt="Logo" width="30" height="24" class="d-inline-block align-text-top">
    +      Bootstrap
    +    </a>
    +  </div>
    +</nav>
    +

    Navbar navigation links build on our .nav options with their own modifier class and require the use of toggler classes for proper responsive styling. Navigation in navbars will also grow to occupy as much horizontal space as possible to keep your navbar contents securely aligned.

    Add the .active class on .nav-link to indicate the current page.

    Please note that you should also add the aria-current attribute on the active .nav-link.

    -
    -
    - - - -
    - html -
    - - -
    -
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    -  <div class="container-fluid">
    -    <a class="navbar-brand" href="#">Navbar</a>
    -    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    -      <span class="navbar-toggler-icon"></span>
    -    </button>
    -    <div class="collapse navbar-collapse" id="navbarNav">
    -      <ul class="navbar-nav">
    -        <li class="nav-item">
    -          <a class="nav-link active" aria-current="page" href="#">Home</a>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link" href="#">Features</a>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link" href="#">Pricing</a>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    -        </li>
    -      </ul>
    -    </div>
    -  </div>
    -</nav>
    -
    - +
    html
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    +  <div class="container-fluid">
    +    <a class="navbar-brand" href="#">Navbar</a>
    +    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    +      <span class="navbar-toggler-icon"></span>
    +    </button>
    +    <div class="collapse navbar-collapse" id="navbarNav">
    +      <ul class="navbar-nav">
    +        <li class="nav-item">
    +          <a class="nav-link active" aria-current="page" href="#">Home</a>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link" href="#">Features</a>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link" href="#">Pricing</a>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +        </li>
    +      </ul>
    +    </div>
    +  </div>
    +</nav>

    And because we use classes for our navs, you can avoid the list-based approach entirely if you like.

    -
    -
    - - - -
    - html -
    - - -
    -
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    -  <div class="container-fluid">
    -    <a class="navbar-brand" href="#">Navbar</a>
    -    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
    -      <span class="navbar-toggler-icon"></span>
    -    </button>
    -    <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
    -      <div class="navbar-nav">
    -        <a class="nav-link active" aria-current="page" href="#">Home</a>
    -        <a class="nav-link" href="#">Features</a>
    -        <a class="nav-link" href="#">Pricing</a>
    -        <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    -      </div>
    -    </div>
    -  </div>
    -</nav>
    -
    - +
    html
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    +  <div class="container-fluid">
    +    <a class="navbar-brand" href="#">Navbar</a>
    +    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
    +      <span class="navbar-toggler-icon"></span>
    +    </button>
    +    <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
    +      <div class="navbar-nav">
    +        <a class="nav-link active" aria-current="page" href="#">Home</a>
    +        <a class="nav-link" href="#">Features</a>
    +        <a class="nav-link" href="#">Pricing</a>
    +        <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +      </div>
    +    </div>
    +  </div>
    +</nav>

    You can also use dropdowns in your navbar. Dropdown menus require a wrapping element for positioning, so be sure to use separate and nested elements for .nav-item and .nav-link as shown below.

    -
    -
    - - - -
    - html -
    - - -
    -
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    -  <div class="container-fluid">
    -    <a class="navbar-brand" href="#">Navbar</a>
    -    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
    -      <span class="navbar-toggler-icon"></span>
    -    </button>
    -    <div class="collapse navbar-collapse" id="navbarNavDropdown">
    -      <ul class="navbar-nav">
    -        <li class="nav-item">
    -          <a class="nav-link active" aria-current="page" href="#">Home</a>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link" href="#">Features</a>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link" href="#">Pricing</a>
    -        </li>
    -        <li class="nav-item dropdown">
    -          <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
    -            Dropdown link
    -          </a>
    -          <ul class="dropdown-menu">
    -            <li><a class="dropdown-item" href="#">Action</a></li>
    -            <li><a class="dropdown-item" href="#">Another action</a></li>
    -            <li><a class="dropdown-item" href="#">Something else here</a></li>
    -          </ul>
    -        </li>
    -      </ul>
    -    </div>
    -  </div>
    -</nav>
    -
    - -

    Forms

    +
    html
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    +  <div class="container-fluid">
    +    <a class="navbar-brand" href="#">Navbar</a>
    +    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
    +      <span class="navbar-toggler-icon"></span>
    +    </button>
    +    <div class="collapse navbar-collapse" id="navbarNavDropdown">
    +      <ul class="navbar-nav">
    +        <li class="nav-item">
    +          <a class="nav-link active" aria-current="page" href="#">Home</a>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link" href="#">Features</a>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link" href="#">Pricing</a>
    +        </li>
    +        <li class="nav-item dropdown">
    +          <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
    +            Dropdown link
    +          </a>
    +          <ul class="dropdown-menu">
    +            <li><a class="dropdown-item" href="#">Action</a></li>
    +            <li><a class="dropdown-item" href="#">Another action</a></li>
    +            <li><a class="dropdown-item" href="#">Something else here</a></li>
    +          </ul>
    +        </li>
    +      </ul>
    +    </div>
    +  </div>
    +</nav>
    +

    Forms

    Place various form controls and components within a navbar:

    -
    -
    - -
    html
    <nav class="navbar bg-body-tertiary">
    +  <div class="container-fluid">
    +    <a class="navbar-brand">Navbar</a>
    +    <form class="d-flex" role="search">
    +      <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"/>
    +      <button class="btn btn-outline-success" type="submit">Search</button>
    +    </form>
    +  </div>
    +</nav>

    Input groups work, too. If your navbar is an entire form, or mostly a form, you can use the <form> element as the container and save some HTML.

    -
    -
    - -
    html
    <nav class="navbar bg-body-tertiary">
    +  <form class="container-fluid">
    +    <div class="input-group">
    +      <span class="input-group-text" id="basic-addon1">@</span>
    +      <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1"/>
    +    </div>
    +  </form>
    +</nav>

    Various buttons are supported as part of these navbar forms, too. This is also a great reminder that vertical alignment utilities can be used to align different sized elements.

    -
    -
    - -
    html
    <nav class="navbar bg-body-tertiary">
    +  <form class="container-fluid justify-content-start">
    +    <button class="btn btn-outline-success me-2" type="button">Main button</button>
    +    <button class="btn btn-sm btn-outline-secondary" type="button">Smaller button</button>
    +  </form>
    +</nav>
    +

    Text

    Navbars may contain bits of text with the help of .navbar-text. This class adjusts vertical alignment and horizontal spacing for strings of text.

    -
    -
    - -
    html
    <nav class="navbar bg-body-tertiary">
    +  <div class="container-fluid">
    +    <span class="navbar-text">
    +      Navbar text with an inline element
    +    </span>
    +  </div>
    +</nav>

    Mix and match with other components and utilities as needed.

    -
    -
    - - +
    html
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    +  <div class="container-fluid">
    +    <a class="navbar-brand" href="#">Navbar w/ text</a>
    +    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
    +      <span class="navbar-toggler-icon"></span>
    +    </button>
    +    <div class="collapse navbar-collapse" id="navbarText">
    +      <ul class="navbar-nav me-auto mb-2 mb-lg-0">
    +        <li class="nav-item">
    +          <a class="nav-link active" aria-current="page" href="#">Home</a>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link" href="#">Features</a>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link" href="#">Pricing</a>
    +        </li>
    +      </ul>
    +      <span class="navbar-text">
    +        Navbar text with an inline element
    +      </span>
    +    </div>
    +  </div>
    +</nav>
    +

    Color schemes

    +

    New dark navbars in v5.3.0 — We’ve deprecated .navbar-dark in favor of the new data-bs-theme="dark". Add data-bs-theme="dark" to the .navbar to enable a component-specific color mode. Learn more about our color modes.


    New in v5.2.0 — Navbar theming is now powered by CSS variables and .navbar-light has been deprecated. CSS variables are applied to .navbar, defaulting to the “light” appearance, and can be overridden with .navbar-dark.

    +

    Navbar themes are easier than ever thanks to Bootstrap’s combination of Sass and CSS variables. The default is our “light navbar” for use with light background colors, but you can also apply data-bs-theme="dark" to the .navbar parent for dark background colors. Then, customize with .bg-* and additional utilities.

    + +
    <nav class="navbar bg-dark border-bottom border-body" data-bs-theme="dark">
    +  <!-- Navbar content -->
    +</nav>
     
    -  
    - html -
    - - -
    -
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    -  <div class="container-fluid">
    -    <a class="navbar-brand" href="#">Navbar w/ text</a>
    -    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
    -      <span class="navbar-toggler-icon"></span>
    -    </button>
    -    <div class="collapse navbar-collapse" id="navbarText">
    -      <ul class="navbar-nav me-auto mb-2 mb-lg-0">
    -        <li class="nav-item">
    -          <a class="nav-link active" aria-current="page" href="#">Home</a>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link" href="#">Features</a>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link" href="#">Pricing</a>
    -        </li>
    -      </ul>
    -      <span class="navbar-text">
    -        Navbar text with an inline element
    -      </span>
    -    </div>
    -  </div>
    -</nav>
    -
    +<nav class="navbar bg-primary" data-bs-theme="dark"> + <!-- Navbar content --> +</nav> -

    Color schemes

    -
    -

    New dark navbars in v5.3.0 — We’ve deprecated .navbar-dark in favor of the new data-bs-theme="dark". Add data-bs-theme="dark" to the .navbar to enable a component-specific color mode. Learn more about our color modes.

    -
    -

    New in v5.2.0 — Navbar theming is now powered by CSS variables and .navbar-light has been deprecated. CSS variables are applied to .navbar, defaulting to the “light” appearance, and can be overridden with .navbar-dark.

    - -
    - -

    Navbar themes are easier than ever thanks to Bootstrap’s combination of Sass and CSS variables. The default is our “light navbar” for use with light background colors, but you can also apply data-bs-theme="dark" to the .navbar parent for dark background colors. Then, customize with .bg-* and additional utilities.

    -
    - - - -
    -
    <nav class="navbar bg-dark border-bottom border-body" data-bs-theme="dark">
    -  <!-- Navbar content -->
    -</nav>
    -
    -<nav class="navbar bg-primary" data-bs-theme="dark">
    -  <!-- Navbar content -->
    -</nav>
    -
    -<nav class="navbar" style="background-color: #e3f2fd;" data-bs-theme="light">
    -  <!-- Navbar content -->
    -</nav>
    -

    Containers

    -

    Although it’s not required, you can wrap a navbar in a .container to center it on a page–though note that an inner container is still required. Or you can add a container inside the .navbar to only center the contents of a fixed or static top navbar.

    -
    -
    - -
    +<nav class="navbar" style="background-color: #e3f2fd;" data-bs-theme="light"> + <!-- Navbar content --> +</nav> +
    +

    Containers

    +

    Although it’s not required, you can wrap a navbar in a .container to center it on a page–though note that an inner container is still required. Or you can add a container inside the .navbar to only center the contents of a fixed or static top navbar.

    +
    - -
    - html -
    - - -
    -
    <div class="container">
    -  <nav class="navbar navbar-expand-lg bg-body-tertiary">
    -    <div class="container-fluid">
    -      <a class="navbar-brand" href="#">Navbar</a>
    -    </div>
    -  </nav>
    -</div>
    -
    - +
    html
    <div class="container">
    +  <nav class="navbar navbar-expand-lg bg-body-tertiary">
    +    <div class="container-fluid">
    +      <a class="navbar-brand" href="#">Navbar</a>
    +    </div>
    +  </nav>
    +</div>

    Use any of the responsive containers to change how wide the content in your navbar is presented.

    -
    -
    - -
    html
    <nav class="navbar sticky-bottom bg-body-tertiary">
    +  <div class="container-fluid">
    +    <a class="navbar-brand" href="#">Sticky bottom</a>
    +  </div>
    +</nav>
    +

    Scrolling

    Add .navbar-nav-scroll to a .navbar-nav (or other navbar sub-component) to enable vertical scrolling within the toggleable contents of a collapsed navbar. By default, scrolling kicks in at 75vh (or 75% of the viewport height), but you can override that with the local CSS custom property --bs-navbar-height or custom styles. At larger viewports when the navbar is expanded, content will appear as it does in a default navbar.

    Please note that this behavior comes with a potential drawback of overflow—when setting overflow-y: auto (required to scroll the content here), overflow-x is the equivalent of auto, which will crop some horizontal content.

    -

    Here’s an example navbar using .navbar-nav-scroll with style="--bs-scroll-height: 100px;", with some extra margin utilities for optimum spacing.

    -
    -
    - - - -
    - html -
    - - -
    -
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    -  <div class="container-fluid">
    -    <a class="navbar-brand" href="#">Navbar scroll</a>
    -    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarScroll" aria-controls="navbarScroll" aria-expanded="false" aria-label="Toggle navigation">
    -      <span class="navbar-toggler-icon"></span>
    -    </button>
    -    <div class="collapse navbar-collapse" id="navbarScroll">
    -      <ul class="navbar-nav me-auto my-2 my-lg-0 navbar-nav-scroll" style="--bs-scroll-height: 100px;">
    -        <li class="nav-item">
    -          <a class="nav-link active" aria-current="page" href="#">Home</a>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link" href="#">Link</a>
    -        </li>
    -        <li class="nav-item dropdown">
    -          <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
    -            Link
    -          </a>
    -          <ul class="dropdown-menu">
    -            <li><a class="dropdown-item" href="#">Action</a></li>
    -            <li><a class="dropdown-item" href="#">Another action</a></li>
    -            <li><hr class="dropdown-divider"></li>
    -            <li><a class="dropdown-item" href="#">Something else here</a></li>
    -          </ul>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link disabled" aria-disabled="true">Link</a>
    -        </li>
    -      </ul>
    -      <form class="d-flex" role="search">
    -        <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
    -        <button class="btn btn-outline-success" type="submit">Search</button>
    -      </form>
    -    </div>
    -  </div>
    -</nav>
    -
    - -

    Responsive behaviors

    +
    html
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    +  <div class="container-fluid">
    +    <a class="navbar-brand" href="#">Navbar scroll</a>
    +    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarScroll" aria-controls="navbarScroll" aria-expanded="false" aria-label="Toggle navigation">
    +      <span class="navbar-toggler-icon"></span>
    +    </button>
    +    <div class="collapse navbar-collapse" id="navbarScroll">
    +      <ul class="navbar-nav me-auto my-2 my-lg-0 navbar-nav-scroll" style="--bs-scroll-height: 100px;">
    +        <li class="nav-item">
    +          <a class="nav-link active" aria-current="page" href="#">Home</a>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link" href="#">Link</a>
    +        </li>
    +        <li class="nav-item dropdown">
    +          <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
    +            Link
    +          </a>
    +          <ul class="dropdown-menu">
    +            <li><a class="dropdown-item" href="#">Action</a></li>
    +            <li><a class="dropdown-item" href="#">Another action</a></li>
    +            <li><hr class="dropdown-divider"></li>
    +            <li><a class="dropdown-item" href="#">Something else here</a></li>
    +          </ul>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link disabled" aria-disabled="true">Link</a>
    +        </li>
    +      </ul>
    +      <form class="d-flex" role="search">
    +        <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"/>
    +        <button class="btn btn-outline-success" type="submit">Search</button>
    +      </form>
    +    </div>
    +  </div>
    +</nav>
    +

    Responsive behaviors

    Navbars can use .navbar-toggler, .navbar-collapse, and .navbar-expand{-sm|-md|-lg|-xl|-xxl} classes to determine when their content collapses behind a button. In combination with other utilities, you can easily choose when to show or hide particular elements.

    -

    For navbars that never collapse, add the .navbar-expand class on the navbar. For navbars that always collapse, don’t add any .navbar-expand class.

    -

    Toggler

    -

    Navbar togglers are left-aligned by default, but should they follow a sibling element like a .navbar-brand, they’ll automatically be aligned to the far right. Reversing your markup will reverse the placement of the toggler. Below are examples of different toggle styles.

    +

    For navbars that never collapse, add the .navbar-expand class on the navbar. For navbars that always collapse, don’t add any .navbar-expand class.

    +

    Toggler

    +

    Navbar togglers are left-aligned by default, but should they follow a sibling element like a .navbar-brand, they’ll automatically be aligned to the far right. Reversing your markup will reverse the placement of the toggler. Below are examples of different toggle styles.

    With no .navbar-brand shown at the smallest breakpoint:

    -
    -
    - - - -
    - html -
    - - -
    -
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    -  <div class="container-fluid">
    -    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
    -      <span class="navbar-toggler-icon"></span>
    -    </button>
    -    <div class="collapse navbar-collapse" id="navbarTogglerDemo01">
    -      <a class="navbar-brand" href="#">Hidden brand</a>
    -      <ul class="navbar-nav me-auto mb-2 mb-lg-0">
    -        <li class="nav-item">
    -          <a class="nav-link active" aria-current="page" href="#">Home</a>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link" href="#">Link</a>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    -        </li>
    -      </ul>
    -      <form class="d-flex" role="search">
    -        <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
    -        <button class="btn btn-outline-success" type="submit">Search</button>
    -      </form>
    -    </div>
    -  </div>
    -</nav>
    -
    - +
    html
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    +  <div class="container-fluid">
    +    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
    +      <span class="navbar-toggler-icon"></span>
    +    </button>
    +    <div class="collapse navbar-collapse" id="navbarTogglerDemo01">
    +      <a class="navbar-brand" href="#">Hidden brand</a>
    +      <ul class="navbar-nav me-auto mb-2 mb-lg-0">
    +        <li class="nav-item">
    +          <a class="nav-link active" aria-current="page" href="#">Home</a>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link" href="#">Link</a>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +        </li>
    +      </ul>
    +      <form class="d-flex" role="search">
    +        <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"/>
    +        <button class="btn btn-outline-success" type="submit">Search</button>
    +      </form>
    +    </div>
    +  </div>
    +</nav>

    With a brand name shown on the left and toggler on the right:

    -
    -
    - - - -
    - html -
    - - -
    -
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    -  <div class="container-fluid">
    -    <a class="navbar-brand" href="#">Navbar</a>
    -    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
    -      <span class="navbar-toggler-icon"></span>
    -    </button>
    -    <div class="collapse navbar-collapse" id="navbarTogglerDemo02">
    -      <ul class="navbar-nav me-auto mb-2 mb-lg-0">
    -        <li class="nav-item">
    -          <a class="nav-link active" aria-current="page" href="#">Home</a>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link" href="#">Link</a>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    -        </li>
    -      </ul>
    -      <form class="d-flex" role="search">
    -        <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
    -        <button class="btn btn-outline-success" type="submit">Search</button>
    -      </form>
    -    </div>
    -  </div>
    -</nav>
    -
    - +
    html
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    +  <div class="container-fluid">
    +    <a class="navbar-brand" href="#">Navbar</a>
    +    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo02" aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
    +      <span class="navbar-toggler-icon"></span>
    +    </button>
    +    <div class="collapse navbar-collapse" id="navbarTogglerDemo02">
    +      <ul class="navbar-nav me-auto mb-2 mb-lg-0">
    +        <li class="nav-item">
    +          <a class="nav-link active" aria-current="page" href="#">Home</a>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link" href="#">Link</a>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +        </li>
    +      </ul>
    +      <form class="d-flex" role="search">
    +        <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"/>
    +        <button class="btn btn-outline-success" type="submit">Search</button>
    +      </form>
    +    </div>
    +  </div>
    +</nav>

    With a toggler on the left and brand name on the right:

    -
    -
    - - - -
    - html -
    - - -
    -
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    -  <div class="container-fluid">
    -    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo03" aria-controls="navbarTogglerDemo03" aria-expanded="false" aria-label="Toggle navigation">
    -      <span class="navbar-toggler-icon"></span>
    -    </button>
    -    <a class="navbar-brand" href="#">Navbar</a>
    -    <div class="collapse navbar-collapse" id="navbarTogglerDemo03">
    -      <ul class="navbar-nav me-auto mb-2 mb-lg-0">
    -        <li class="nav-item">
    -          <a class="nav-link active" aria-current="page" href="#">Home</a>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link" href="#">Link</a>
    -        </li>
    -        <li class="nav-item">
    -          <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    -        </li>
    -      </ul>
    -      <form class="d-flex" role="search">
    -        <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
    -        <button class="btn btn-outline-success" type="submit">Search</button>
    -      </form>
    -    </div>
    -  </div>
    -</nav>
    -
    - -

    External content

    -

    Sometimes you want to use the collapse plugin to trigger a container element for content that structurally sits outside of the .navbar . Because our plugin works on the id and data-bs-target matching, that’s easily done!

    -
    -
    - -
    html
    <nav class="navbar navbar-expand-lg bg-body-tertiary">
    +  <div class="container-fluid">
    +    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerDemo03" aria-controls="navbarTogglerDemo03" aria-expanded="false" aria-label="Toggle navigation">
    +      <span class="navbar-toggler-icon"></span>
    +    </button>
    +    <a class="navbar-brand" href="#">Navbar</a>
    +    <div class="collapse navbar-collapse" id="navbarTogglerDemo03">
    +      <ul class="navbar-nav me-auto mb-2 mb-lg-0">
    +        <li class="nav-item">
    +          <a class="nav-link active" aria-current="page" href="#">Home</a>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link" href="#">Link</a>
    +        </li>
    +        <li class="nav-item">
    +          <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +        </li>
    +      </ul>
    +      <form class="d-flex" role="search">
    +        <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"/>
    +        <button class="btn btn-outline-success" type="submit">Search</button>
    +      </form>
    +    </div>
    +  </div>
    +</nav>
    +

    External content

    +

    Sometimes you want to use the collapse plugin to trigger a container element for content that structurally sits outside of the .navbar . Because our plugin works on the id and data-bs-target matching, that’s easily done!

    +
    - html -
    - - -
    -
    <div class="collapse" id="navbarToggleExternalContent" data-bs-theme="dark">
    -  <div class="bg-dark p-4">
    -    <h5 class="text-body-emphasis h4">Collapsed content</h5>
    -    <span class="text-body-secondary">Toggleable via the navbar brand.</span>
    -  </div>
    -</div>
    -<nav class="navbar navbar-dark bg-dark">
    -  <div class="container-fluid">
    -    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
    -      <span class="navbar-toggler-icon"></span>
    -    </button>
    -  </div>
    -</nav>
    -
    - -

    When you do this, we recommend including additional JavaScript to move the focus programmatically to the container when it is opened. Otherwise, keyboard users and users of assistive technologies will likely have a hard time finding the newly revealed content - particularly if the container that was opened comes before the toggler in the document’s structure. We also recommend making sure that the toggler has the aria-controls attribute, pointing to the id of the content container. In theory, this allows assistive technology users to jump directly from the toggler to the container it controls–but support for this is currently quite patchy.

    -

    Offcanvas

    -

    Transform your expanding and collapsing navbar into an offcanvas drawer with the offcanvas component. We extend both the offcanvas default styles and use our .navbar-expand-* classes to create a dynamic and flexible navigation sidebar.

    +
    html
    <div class="collapse" id="navbarToggleExternalContent" data-bs-theme="dark">
    +  <div class="bg-dark p-4">
    +    <h5 class="text-body-emphasis h4">Collapsed content</h5>
    +    <span class="text-body-secondary">Toggleable via the navbar brand.</span>
    +  </div>
    +</div>
    +<nav class="navbar navbar-dark bg-dark">
    +  <div class="container-fluid">
    +    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation">
    +      <span class="navbar-toggler-icon"></span>
    +    </button>
    +  </div>
    +</nav>
    +

    When you do this, we recommend including additional JavaScript to move the focus programmatically to the container when it is opened. Otherwise, keyboard users and users of assistive technologies will likely have a hard time finding the newly revealed content - particularly if the container that was opened comes before the toggler in the document’s structure. We also recommend making sure that the toggler has the aria-controls attribute, pointing to the id of the content container. In theory, this allows assistive technology users to jump directly from the toggler to the container it controls–but support for this is currently quite patchy.

    +

    Offcanvas

    +

    Transform your expanding and collapsing navbar into an offcanvas drawer with the offcanvas component. We extend both the offcanvas default styles and use our .navbar-expand-* classes to create a dynamic and flexible navigation sidebar.

    In the example below, to create an offcanvas navbar that is always collapsed across all breakpoints, omit the .navbar-expand-* class entirely.

    -
    -
    - - - -
    - html -
    - - -
    -
    <nav class="navbar bg-body-tertiary fixed-top">
    -  <div class="container-fluid">
    -    <a class="navbar-brand" href="#">Offcanvas navbar</a>
    -    <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasNavbar" aria-controls="offcanvasNavbar" aria-label="Toggle navigation">
    -      <span class="navbar-toggler-icon"></span>
    -    </button>
    -    <div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasNavbar" aria-labelledby="offcanvasNavbarLabel">
    -      <div class="offcanvas-header">
    -        <h5 class="offcanvas-title" id="offcanvasNavbarLabel">Offcanvas</h5>
    -        <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    -      </div>
    -      <div class="offcanvas-body">
    -        <ul class="navbar-nav justify-content-end flex-grow-1 pe-3">
    -          <li class="nav-item">
    -            <a class="nav-link active" aria-current="page" href="#">Home</a>
    -          </li>
    -          <li class="nav-item">
    -            <a class="nav-link" href="#">Link</a>
    -          </li>
    -          <li class="nav-item dropdown">
    -            <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
    -              Dropdown
    -            </a>
    -            <ul class="dropdown-menu">
    -              <li><a class="dropdown-item" href="#">Action</a></li>
    -              <li><a class="dropdown-item" href="#">Another action</a></li>
    -              <li>
    -                <hr class="dropdown-divider">
    -              </li>
    -              <li><a class="dropdown-item" href="#">Something else here</a></li>
    -            </ul>
    -          </li>
    -        </ul>
    -        <form class="d-flex mt-3" role="search">
    -          <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
    -          <button class="btn btn-outline-success" type="submit">Search</button>
    -        </form>
    -      </div>
    -    </div>
    -  </div>
    -</nav>
    -
    - +
    html
    <nav class="navbar bg-body-tertiary fixed-top">
    +  <div class="container-fluid">
    +    <a class="navbar-brand" href="#">Offcanvas navbar</a>
    +    <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasNavbar" aria-controls="offcanvasNavbar" aria-label="Toggle navigation">
    +      <span class="navbar-toggler-icon"></span>
    +    </button>
    +    <div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasNavbar" aria-labelledby="offcanvasNavbarLabel">
    +      <div class="offcanvas-header">
    +        <h5 class="offcanvas-title" id="offcanvasNavbarLabel">Offcanvas</h5>
    +        <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    +      </div>
    +      <div class="offcanvas-body">
    +        <ul class="navbar-nav justify-content-end flex-grow-1 pe-3">
    +          <li class="nav-item">
    +            <a class="nav-link active" aria-current="page" href="#">Home</a>
    +          </li>
    +          <li class="nav-item">
    +            <a class="nav-link" href="#">Link</a>
    +          </li>
    +          <li class="nav-item dropdown">
    +            <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
    +              Dropdown
    +            </a>
    +            <ul class="dropdown-menu">
    +              <li><a class="dropdown-item" href="#">Action</a></li>
    +              <li><a class="dropdown-item" href="#">Another action</a></li>
    +              <li>
    +                <hr class="dropdown-divider">
    +              </li>
    +              <li><a class="dropdown-item" href="#">Something else here</a></li>
    +            </ul>
    +          </li>
    +        </ul>
    +        <form class="d-flex mt-3" role="search">
    +          <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"/>
    +          <button class="btn btn-outline-success" type="submit">Search</button>
    +        </form>
    +      </div>
    +    </div>
    +  </div>
    +</nav>

    To create an offcanvas navbar that expands into a normal navbar at a specific breakpoint like lg, use .navbar-expand-lg.

    -
    <nav class="navbar navbar-expand-lg bg-body-tertiary fixed-top">
    -  <a class="navbar-brand" href="#">Offcanvas navbar</a>
    -  <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#navbarOffcanvasLg" aria-controls="navbarOffcanvasLg" aria-label="Toggle navigation">
    -    <span class="navbar-toggler-icon"></span>
    -  </button>
    -  <div class="offcanvas offcanvas-end" tabindex="-1" id="navbarOffcanvasLg" aria-labelledby="navbarOffcanvasLgLabel">
    -    ...
    -  </div>
    -</nav>
    -

    When using offcanvas in a dark navbar, be aware that you may need to have a dark background on the offcanvas content to avoid the text becoming illegible. In the example below, we add .navbar-dark and .bg-dark to the .navbar, .text-bg-dark to the .offcanvas, .dropdown-menu-dark to .dropdown-menu, and .btn-close-white to .btn-close for proper styling with a dark offcanvas.

    -
    -
    - - - -
    - html -
    - - -
    -
    <nav class="navbar navbar-dark bg-dark fixed-top">
    -  <div class="container-fluid">
    -    <a class="navbar-brand" href="#">Offcanvas dark navbar</a>
    -    <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasDarkNavbar" aria-controls="offcanvasDarkNavbar" aria-label="Toggle navigation">
    -      <span class="navbar-toggler-icon"></span>
    -    </button>
    -    <div class="offcanvas offcanvas-end text-bg-dark" tabindex="-1" id="offcanvasDarkNavbar" aria-labelledby="offcanvasDarkNavbarLabel">
    -      <div class="offcanvas-header">
    -        <h5 class="offcanvas-title" id="offcanvasDarkNavbarLabel">Dark offcanvas</h5>
    -        <button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    -      </div>
    -      <div class="offcanvas-body">
    -        <ul class="navbar-nav justify-content-end flex-grow-1 pe-3">
    -          <li class="nav-item">
    -            <a class="nav-link active" aria-current="page" href="#">Home</a>
    -          </li>
    -          <li class="nav-item">
    -            <a class="nav-link" href="#">Link</a>
    -          </li>
    -          <li class="nav-item dropdown">
    -            <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
    -              Dropdown
    -            </a>
    -            <ul class="dropdown-menu dropdown-menu-dark">
    -              <li><a class="dropdown-item" href="#">Action</a></li>
    -              <li><a class="dropdown-item" href="#">Another action</a></li>
    -              <li>
    -                <hr class="dropdown-divider">
    -              </li>
    -              <li><a class="dropdown-item" href="#">Something else here</a></li>
    -            </ul>
    -          </li>
    -        </ul>
    -        <form class="d-flex mt-3" role="search">
    -          <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search">
    -          <button class="btn btn-success" type="submit">Search</button>
    -        </form>
    -      </div>
    -    </div>
    -  </div>
    -</nav>
    -
    - -

    CSS

    -

    Variables

    +
    html
    <nav class="navbar navbar-dark bg-dark fixed-top">
    +  <div class="container-fluid">
    +    <a class="navbar-brand" href="#">Offcanvas dark navbar</a>
    +    <button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasDarkNavbar" aria-controls="offcanvasDarkNavbar" aria-label="Toggle navigation">
    +      <span class="navbar-toggler-icon"></span>
    +    </button>
    +    <div class="offcanvas offcanvas-end text-bg-dark" tabindex="-1" id="offcanvasDarkNavbar" aria-labelledby="offcanvasDarkNavbarLabel">
    +      <div class="offcanvas-header">
    +        <h5 class="offcanvas-title" id="offcanvasDarkNavbarLabel">Dark offcanvas</h5>
    +        <button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    +      </div>
    +      <div class="offcanvas-body">
    +        <ul class="navbar-nav justify-content-end flex-grow-1 pe-3">
    +          <li class="nav-item">
    +            <a class="nav-link active" aria-current="page" href="#">Home</a>
    +          </li>
    +          <li class="nav-item">
    +            <a class="nav-link" href="#">Link</a>
    +          </li>
    +          <li class="nav-item dropdown">
    +            <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
    +              Dropdown
    +            </a>
    +            <ul class="dropdown-menu dropdown-menu-dark">
    +              <li><a class="dropdown-item" href="#">Action</a></li>
    +              <li><a class="dropdown-item" href="#">Another action</a></li>
    +              <li>
    +                <hr class="dropdown-divider">
    +              </li>
    +              <li><a class="dropdown-item" href="#">Something else here</a></li>
    +            </ul>
    +          </li>
    +        </ul>
    +        <form class="d-flex mt-3" role="search">
    +          <input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"/>
    +          <button class="btn btn-success" type="submit">Search</button>
    +        </form>
    +      </div>
    +    </div>
    +  </div>
    +</nav>
    +

    CSS

    +

    Variables

    Added in v5.2.0 - -

    As part of Bootstrap’s evolving CSS variables approach, navbars now use local CSS variables on .navbar for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    -
    -
    - scss/_navbar.scss -
    - -
    -
    --#{$prefix}navbar-padding-x: #{if($navbar-padding-x == null, 0, $navbar-padding-x)};
    ---#{$prefix}navbar-padding-y: #{$navbar-padding-y};
    ---#{$prefix}navbar-color: #{$navbar-light-color};
    ---#{$prefix}navbar-hover-color: #{$navbar-light-hover-color};
    ---#{$prefix}navbar-disabled-color: #{$navbar-light-disabled-color};
    ---#{$prefix}navbar-active-color: #{$navbar-light-active-color};
    ---#{$prefix}navbar-brand-padding-y: #{$navbar-brand-padding-y};
    ---#{$prefix}navbar-brand-margin-end: #{$navbar-brand-margin-end};
    ---#{$prefix}navbar-brand-font-size: #{$navbar-brand-font-size};
    ---#{$prefix}navbar-brand-color: #{$navbar-light-brand-color};
    ---#{$prefix}navbar-brand-hover-color: #{$navbar-light-brand-hover-color};
    ---#{$prefix}navbar-nav-link-padding-x: #{$navbar-nav-link-padding-x};
    ---#{$prefix}navbar-toggler-padding-y: #{$navbar-toggler-padding-y};
    ---#{$prefix}navbar-toggler-padding-x: #{$navbar-toggler-padding-x};
    ---#{$prefix}navbar-toggler-font-size: #{$navbar-toggler-font-size};
    ---#{$prefix}navbar-toggler-icon-bg: #{escape-svg($navbar-light-toggler-icon-bg)};
    ---#{$prefix}navbar-toggler-border-color: #{$navbar-light-toggler-border-color};
    ---#{$prefix}navbar-toggler-border-radius: #{$navbar-toggler-border-radius};
    ---#{$prefix}navbar-toggler-focus-width: #{$navbar-toggler-focus-width};
    ---#{$prefix}navbar-toggler-transition: #{$navbar-toggler-transition};
    +

    As part of Bootstrap’s evolving CSS variables approach, navbars now use local CSS variables on .navbar for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    +
    --#{$prefix}navbar-padding-x: #{if($navbar-padding-x == null, 0, $navbar-padding-x)};
    +--#{$prefix}navbar-padding-y: #{$navbar-padding-y};
    +--#{$prefix}navbar-color: #{$navbar-light-color};
    +--#{$prefix}navbar-hover-color: #{$navbar-light-hover-color};
    +--#{$prefix}navbar-disabled-color: #{$navbar-light-disabled-color};
    +--#{$prefix}navbar-active-color: #{$navbar-light-active-color};
    +--#{$prefix}navbar-brand-padding-y: #{$navbar-brand-padding-y};
    +--#{$prefix}navbar-brand-margin-end: #{$navbar-brand-margin-end};
    +--#{$prefix}navbar-brand-font-size: #{$navbar-brand-font-size};
    +--#{$prefix}navbar-brand-color: #{$navbar-light-brand-color};
    +--#{$prefix}navbar-brand-hover-color: #{$navbar-light-brand-hover-color};
    +--#{$prefix}navbar-nav-link-padding-x: #{$navbar-nav-link-padding-x};
    +--#{$prefix}navbar-toggler-padding-y: #{$navbar-toggler-padding-y};
    +--#{$prefix}navbar-toggler-padding-x: #{$navbar-toggler-padding-x};
    +--#{$prefix}navbar-toggler-font-size: #{$navbar-toggler-font-size};
    +--#{$prefix}navbar-toggler-icon-bg: #{escape-svg($navbar-light-toggler-icon-bg)};
    +--#{$prefix}navbar-toggler-border-color: #{$navbar-light-toggler-border-color};
    +--#{$prefix}navbar-toggler-border-radius: #{$navbar-toggler-border-radius};
    +--#{$prefix}navbar-toggler-focus-width: #{$navbar-toggler-focus-width};
    +--#{$prefix}navbar-toggler-transition: #{$navbar-toggler-transition};
    +

    Some additional CSS variables are also present on .navbar-nav:

    -
    -
    - scss/_navbar.scss -
    - -
    -
    --#{$prefix}nav-link-padding-x: 0;
    ---#{$prefix}nav-link-padding-y: #{$nav-link-padding-y};
    -@include rfs($nav-link-font-size, --#{$prefix}nav-link-font-size);
    ---#{$prefix}nav-link-font-weight: #{$nav-link-font-weight};
    ---#{$prefix}nav-link-color: var(--#{$prefix}navbar-color);
    ---#{$prefix}nav-link-hover-color: var(--#{$prefix}navbar-hover-color);
    ---#{$prefix}nav-link-disabled-color: var(--#{$prefix}navbar-disabled-color);
    +
    --#{$prefix}nav-link-padding-x: 0;
    +--#{$prefix}nav-link-padding-y: #{$nav-link-padding-y};
    +@include rfs($nav-link-font-size, --#{$prefix}nav-link-font-size);
    +--#{$prefix}nav-link-font-weight: #{$nav-link-font-weight};
    +--#{$prefix}nav-link-color: var(--#{$prefix}navbar-color);
    +--#{$prefix}nav-link-hover-color: var(--#{$prefix}navbar-hover-color);
    +--#{$prefix}nav-link-disabled-color: var(--#{$prefix}navbar-disabled-color);
    +

    Customization through CSS variables can be seen on the .navbar-dark class where we override specific values without adding duplicate CSS selectors.

    -
    -
    - scss/_navbar.scss -
    - -
    -
    --#{$prefix}navbar-color: #{$navbar-dark-color};
    ---#{$prefix}navbar-hover-color: #{$navbar-dark-hover-color};
    ---#{$prefix}navbar-disabled-color: #{$navbar-dark-disabled-color};
    ---#{$prefix}navbar-active-color: #{$navbar-dark-active-color};
    ---#{$prefix}navbar-brand-color: #{$navbar-dark-brand-color};
    ---#{$prefix}navbar-brand-hover-color: #{$navbar-dark-brand-hover-color};
    ---#{$prefix}navbar-toggler-border-color: #{$navbar-dark-toggler-border-color};
    ---#{$prefix}navbar-toggler-icon-bg: #{escape-svg($navbar-dark-toggler-icon-bg)};
    -

    Sass variables

    +
    --#{$prefix}navbar-color: #{$navbar-dark-color};
    +--#{$prefix}navbar-hover-color: #{$navbar-dark-hover-color};
    +--#{$prefix}navbar-disabled-color: #{$navbar-dark-disabled-color};
    +--#{$prefix}navbar-active-color: #{$navbar-dark-active-color};
    +--#{$prefix}navbar-brand-color: #{$navbar-dark-brand-color};
    +--#{$prefix}navbar-brand-hover-color: #{$navbar-dark-brand-hover-color};
    +--#{$prefix}navbar-toggler-border-color: #{$navbar-dark-toggler-border-color};
    +--#{$prefix}navbar-toggler-icon-bg: #{escape-svg($navbar-dark-toggler-icon-bg)};
    +
    +

    Sass variables

    Variables for all navbars:

    -
    -
    - scss/_variables.scss -
    - -
    -
    $navbar-padding-y:                  $spacer * .5;
    -$navbar-padding-x:                  null;
    -
    -$navbar-nav-link-padding-x:         .5rem;
    -
    -$navbar-brand-font-size:            $font-size-lg;
    -// Compute the navbar-brand padding-y so the navbar-brand will have the same height as navbar-text and nav-link
    -$nav-link-height:                   $font-size-base * $line-height-base + $nav-link-padding-y * 2;
    -$navbar-brand-height:               $navbar-brand-font-size * $line-height-base;
    -$navbar-brand-padding-y:            ($nav-link-height - $navbar-brand-height) * .5;
    -$navbar-brand-margin-end:           1rem;
    -
    -$navbar-toggler-padding-y:          .25rem;
    -$navbar-toggler-padding-x:          .75rem;
    -$navbar-toggler-font-size:          $font-size-lg;
    -$navbar-toggler-border-radius:      $btn-border-radius;
    -$navbar-toggler-focus-width:        $btn-focus-width;
    -$navbar-toggler-transition:         box-shadow .15s ease-in-out;
    -
    -$navbar-light-color:                rgba(var(--#{$prefix}emphasis-color-rgb), .65);
    -$navbar-light-hover-color:          rgba(var(--#{$prefix}emphasis-color-rgb), .8);
    -$navbar-light-active-color:         rgba(var(--#{$prefix}emphasis-color-rgb), 1);
    -$navbar-light-disabled-color:       rgba(var(--#{$prefix}emphasis-color-rgb), .3);
    -$navbar-light-icon-color:           rgba($body-color, .75);
    -$navbar-light-toggler-icon-bg:      url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke='#{$navbar-light-icon-color}' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg>");
    -$navbar-light-toggler-border-color: rgba(var(--#{$prefix}emphasis-color-rgb), .15);
    -$navbar-light-brand-color:          $navbar-light-active-color;
    -$navbar-light-brand-hover-color:    $navbar-light-active-color;
    -
    +
    $navbar-padding-y:                  $spacer * .5;
    +$navbar-padding-x:                  null;
    +
    +$navbar-nav-link-padding-x:         .5rem;
    +
    +$navbar-brand-font-size:            $font-size-lg;
    +// Compute the navbar-brand padding-y so the navbar-brand will have the same height as navbar-text and nav-link
    +$nav-link-height:                   $font-size-base * $line-height-base + $nav-link-padding-y * 2;
    +$navbar-brand-height:               $navbar-brand-font-size * $line-height-base;
    +$navbar-brand-padding-y:            ($nav-link-height - $navbar-brand-height) * .5;
    +$navbar-brand-margin-end:           1rem;
    +
    +$navbar-toggler-padding-y:          .25rem;
    +$navbar-toggler-padding-x:          .75rem;
    +$navbar-toggler-font-size:          $font-size-lg;
    +$navbar-toggler-border-radius:      $btn-border-radius;
    +$navbar-toggler-focus-width:        $btn-focus-width;
    +$navbar-toggler-transition:         box-shadow .15s ease-in-out;
    +
    +$navbar-light-color:                rgba(var(--#{$prefix}emphasis-color-rgb), .65);
    +$navbar-light-hover-color:          rgba(var(--#{$prefix}emphasis-color-rgb), .8);
    +$navbar-light-active-color:         rgba(var(--#{$prefix}emphasis-color-rgb), 1);
    +$navbar-light-disabled-color:       rgba(var(--#{$prefix}emphasis-color-rgb), .3);
    +$navbar-light-icon-color:           rgba($body-color, .75);
    +$navbar-light-toggler-icon-bg:      url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke='#{$navbar-light-icon-color}' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg>");
    +$navbar-light-toggler-border-color: rgba(var(--#{$prefix}emphasis-color-rgb), .15);
    +$navbar-light-brand-color:          $navbar-light-active-color;
    +$navbar-light-brand-hover-color:    $navbar-light-active-color;
    +

    Variables for the dark navbar:

    -
    -
    - scss/_variables.scss -
    - -
    -
    $navbar-dark-color:                 rgba($white, .55);
    -$navbar-dark-hover-color:           rgba($white, .75);
    -$navbar-dark-active-color:          $white;
    -$navbar-dark-disabled-color:        rgba($white, .25);
    -$navbar-dark-icon-color:            $navbar-dark-color;
    -$navbar-dark-toggler-icon-bg:       url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke='#{$navbar-dark-icon-color}' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg>");
    -$navbar-dark-toggler-border-color:  rgba($white, .1);
    -$navbar-dark-brand-color:           $navbar-dark-active-color;
    -$navbar-dark-brand-hover-color:     $navbar-dark-active-color;
    -
    -

    Sass loops

    +
    $navbar-dark-color:                 rgba($white, .55);
    +$navbar-dark-hover-color:           rgba($white, .75);
    +$navbar-dark-active-color:          $white;
    +$navbar-dark-disabled-color:        rgba($white, .25);
    +$navbar-dark-icon-color:            $navbar-dark-color;
    +$navbar-dark-toggler-icon-bg:       url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke='#{$navbar-dark-icon-color}' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg>");
    +$navbar-dark-toggler-border-color:  rgba($white, .1);
    +$navbar-dark-brand-color:           $navbar-dark-active-color;
    +$navbar-dark-brand-hover-color:     $navbar-dark-active-color;
    +
    +

    Sass loops

    Responsive navbar expand/collapse classes (e.g., .navbar-expand-lg) are combined with the $breakpoints map and generated through a loop in scss/_navbar.scss.

    -
    -
    - scss/_navbar.scss -
    - -
    -
    // Generate series of `.navbar-expand-*` responsive classes for configuring
    -// where your navbar collapses.
    -.navbar-expand {
    -  @each $breakpoint in map-keys($grid-breakpoints) {
    -    $next: breakpoint-next($breakpoint, $grid-breakpoints);
    -    $infix: breakpoint-infix($next, $grid-breakpoints);
    -
    -    // stylelint-disable-next-line scss/selector-no-union-class-name
    -    &#{$infix} {
    -      @include media-breakpoint-up($next) {
    -        flex-wrap: nowrap;
    -        justify-content: flex-start;
    -
    -        .navbar-nav {
    -          flex-direction: row;
    -
    -          .dropdown-menu {
    -            position: absolute;
    -          }
    -
    -          .nav-link {
    -            padding-right: var(--#{$prefix}navbar-nav-link-padding-x);
    -            padding-left: var(--#{$prefix}navbar-nav-link-padding-x);
    -          }
    -        }
    -
    -        .navbar-nav-scroll {
    -          overflow: visible;
    -        }
    -
    -        .navbar-collapse {
    -          display: flex !important; // stylelint-disable-line declaration-no-important
    -          flex-basis: auto;
    -        }
    -
    -        .navbar-toggler {
    -          display: none;
    -        }
    -
    -        .offcanvas {
    -          // stylelint-disable declaration-no-important
    -          position: static;
    -          z-index: auto;
    -          flex-grow: 1;
    -          width: auto !important;
    -          height: auto !important;
    -          visibility: visible !important;
    -          background-color: transparent !important;
    -          border: 0 !important;
    -          transform: none !important;
    -          @include box-shadow(none);
    -          @include transition(none);
    -          // stylelint-enable declaration-no-important
    -
    -          .offcanvas-header {
    -            display: none;
    -          }
    -
    -          .offcanvas-body {
    -            display: flex;
    -            flex-grow: 0;
    -            padding: 0;
    -            overflow-y: visible;
    -          }
    -        }
    -      }
    -    }
    -  }
    -}
    -
    +
    // Generate series of `.navbar-expand-*` responsive classes for configuring
    +// where your navbar collapses.
    +.navbar-expand {
    +  @each $breakpoint in map-keys($grid-breakpoints) {
    +    $next: breakpoint-next($breakpoint, $grid-breakpoints);
    +    $infix: breakpoint-infix($next, $grid-breakpoints);
     
    -      
    - -
    + // stylelint-disable-next-line scss/selector-no-union-class-name + &#{$infix} { + @include media-breakpoint-up($next) { + flex-wrap: nowrap; + justify-content: flex-start; + .navbar-nav { + flex-direction: row; - + .dropdown-menu { + position: absolute; + } - + .nav-link { + padding-right: var(--#{$prefix}navbar-nav-link-padding-x); + padding-left: var(--#{$prefix}navbar-nav-link-padding-x); + } + } - - - + .navbar-nav-scroll { + overflow: visible; + } - - + .navbar-collapse { + display: flex !important; // stylelint-disable-line declaration-no-important + flex-basis: auto; + } - - + .navbar-toggler { + display: none; + } + + .offcanvas { + // stylelint-disable declaration-no-important + position: static; + z-index: auto; + flex-grow: 1; + width: auto !important; + height: auto !important; + visibility: visible !important; + background-color: transparent !important; + border: 0 !important; + transform: none !important; + @include box-shadow(none); + @include transition(none); + // stylelint-enable declaration-no-important + + .offcanvas-header { + display: none; + } + + .offcanvas-body { + display: flex; + flex-grow: 0; + padding: 0; + overflow-y: visible; + } + } + } + } + } +} + \ No newline at end of file diff --git a/docs/5.3/components/navs-tabs/index.html b/docs/5.3/components/navs-tabs/index.html index d607e771c2..18cdd88f80 100644 --- a/docs/5.3/components/navs-tabs/index.html +++ b/docs/5.3/components/navs-tabs/index.html @@ -1,606 +1,31 @@ - - - - - - - - - - - - - - - - -Navs and tabs · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Navs and tabs

    -
    -

    Documentation and examples for how to use Bootstrap’s included navigation components.

    - - -
    - - - - - -
    - - -

    Base nav

    + Navs and tabs · Bootstrap v5.3

    Navs and tabs

    Documentation and examples for how to use Bootstrap’s included navigation components.

    +

    Base nav

    Navigation available in Bootstrap share general markup and styles, from the base .nav class to the active and disabled states. Swap modifier classes to switch between each style.

    The base .nav component is built with flexbox and provide a strong foundation for building all types of navigation components. It includes some style overrides (for working with lists), some link padding for larger hit areas, and basic disabled styling.

    -
    -

    The base .nav component does not include any .active state. The following examples include the class, mainly to demonstrate that this particular class does not trigger any special styling.

    -

    To convey the active state to assistive technologies, use the aria-current attribute — using the page value for current page, or true for the current item in a set.

    - -
    - -
    -
    - -
    html
    <ul class="nav">
    +  <li class="nav-item">
    +    <a class="nav-link active" aria-current="page" href="#">Active</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +  </li>
    +</ul>

    Classes are used throughout, so your markup can be super flexible. Use <ul>s like above, <ol> if the order of your items is important, or roll your own with a <nav> element. Because the .nav uses display: flex, the nav links behave the same as nav items would, but without the extra markup.

    -
    -
    - -
    html
    <nav class="nav">
    +  <a class="nav-link active" aria-current="page" href="#">Active</a>
    +  <a class="nav-link" href="#">Link</a>
    +  <a class="nav-link" href="#">Link</a>
    +  <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +</nav>
    +

    Available styles

    Change the style of .navs component with modifiers and utilities. Mix and match as needed, or build your own.

    -

    Horizontal alignment

    -

    Change the horizontal alignment of your nav with flexbox utilities. By default, navs are left-aligned, but you can easily change them to center or right-aligned.

    +

    Horizontal alignment

    +

    Change the horizontal alignment of your nav with flexbox utilities. By default, navs are left-aligned, but you can easily change them to center or right-aligned.

    Centered with .justify-content-center:

    -
    -
    - -
    html
    <ul class="nav justify-content-center">
    +  <li class="nav-item">
    +    <a class="nav-link active" aria-current="page" href="#">Active</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +  </li>
    +</ul>

    Right-aligned with .justify-content-end:

    -
    -
    - -
    html
    <ul class="nav justify-content-end">
    +  <li class="nav-item">
    +    <a class="nav-link active" aria-current="page" href="#">Active</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +  </li>
    +</ul>
    +

    Vertical

    Stack your navigation by changing the flex item direction with the .flex-column utility. Need to stack them on some viewports but not others? Use the responsive versions (e.g., .flex-sm-column).

    -
    -
    - -
    html
    <ul class="nav flex-column">
    +  <li class="nav-item">
    +    <a class="nav-link active" aria-current="page" href="#">Active</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +  </li>
    +</ul>

    As always, vertical navigation is possible without <ul>s, too.

    -
    -
    - -
    html
    <nav class="nav flex-column">
    +  <a class="nav-link active" aria-current="page" href="#">Active</a>
    +  <a class="nav-link" href="#">Link</a>
    +  <a class="nav-link" href="#">Link</a>
    +  <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +</nav>
    +

    Tabs

    Takes the basic nav from above and adds the .nav-tabs class to generate a tabbed interface. Use them to create tabbable regions with our tab JavaScript plugin.

    -
    -
    - -
    html
    <ul class="nav nav-tabs">
    +  <li class="nav-item">
    +    <a class="nav-link active" aria-current="page" href="#">Active</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +  </li>
    +</ul>
    +

    Pills

    Take that same HTML, but use .nav-pills instead:

    -
    -
    - -
    html
    <ul class="nav nav-pills">
    +  <li class="nav-item">
    +    <a class="nav-link active" aria-current="page" href="#">Active</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +  </li>
    +</ul>
    +

    Underline

    Take that same HTML, but use .nav-underline instead:

    -
    -
    - -
    html
    <ul class="nav nav-pills nav-fill">
    +  <li class="nav-item">
    +    <a class="nav-link active" aria-current="page" href="#">Active</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Much longer nav link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +  </li>
    +</ul>

    When using a <nav>-based navigation, you can safely omit .nav-item as only .nav-link is required for styling <a> elements.

    -
    -
    - -
    html
    <nav class="nav nav-pills nav-fill">
    +  <a class="nav-link active" aria-current="page" href="#">Active</a>
    +  <a class="nav-link" href="#">Much longer nav link</a>
    +  <a class="nav-link" href="#">Link</a>
    +  <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +</nav>

    For equal-width elements, use .nav-justified. All horizontal space will be occupied by nav links, but unlike the .nav-fill above, every nav item will be the same width.

    -
    -
    - -
    html
    <ul class="nav nav-pills nav-justified">
    +  <li class="nav-item">
    +    <a class="nav-link active" aria-current="page" href="#">Active</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Much longer nav link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +  </li>
    +</ul>

    Similar to the .nav-fill example using a <nav>-based navigation.

    -
    -
    - -
    html
    <nav class="nav nav-pills flex-column flex-sm-row">
    +  <a class="flex-sm-fill text-sm-center nav-link active" aria-current="page" href="#">Active</a>
    +  <a class="flex-sm-fill text-sm-center nav-link" href="#">Longer nav link</a>
    +  <a class="flex-sm-fill text-sm-center nav-link" href="#">Link</a>
    +  <a class="flex-sm-fill text-sm-center nav-link disabled" aria-disabled="true">Disabled</a>
    +</nav>
    +

    Regarding accessibility

    +

    If you’re using navs to provide a navigation bar, be sure to add a role="navigation" to the most logical parent container of the <ul>, or wrap a <nav> element around the whole navigation. Do not add the role to the <ul> itself, as this would prevent it from being announced as an actual list by assistive technologies.

    Note that navigation bars, even if visually styled as tabs with the .nav-tabs class, should not be given role="tablist", role="tab" or role="tabpanel" attributes. These are only appropriate for dynamic tabbed interfaces, as described in the ARIA Authoring Practices Guide tabs pattern. See JavaScript behavior for dynamic tabbed interfaces in this section for an example. The aria-current attribute is not necessary on dynamic tabbed interfaces since our JavaScript handles the selected state by adding aria-selected="true" on the active tab.

    -

    Using dropdowns

    -

    Add dropdown menus with a little extra HTML and the dropdowns JavaScript plugin.

    -

    Tabs with dropdowns

    -
    -
    - -
    html
    <ul class="nav nav-pills">
    +  <li class="nav-item">
    +    <a class="nav-link active" aria-current="page" href="#">Active</a>
    +  </li>
    +  <li class="nav-item dropdown">
    +    <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">Dropdown</a>
    +    <ul class="dropdown-menu">
    +      <li><a class="dropdown-item" href="#">Action</a></li>
    +      <li><a class="dropdown-item" href="#">Another action</a></li>
    +      <li><a class="dropdown-item" href="#">Something else here</a></li>
    +      <li><hr class="dropdown-divider"></li>
    +      <li><a class="dropdown-item" href="#">Separated link</a></li>
    +    </ul>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link" href="#">Link</a>
    +  </li>
    +  <li class="nav-item">
    +    <a class="nav-link disabled" aria-disabled="true">Disabled</a>
    +  </li>
    +</ul>
    +

    CSS

    +

    Variables

    Added in v5.2.0 - -

    As part of Bootstrap’s evolving CSS variables approach, navs now use local CSS variables on .nav, .nav-tabs, and .nav-pills for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    +

    As part of Bootstrap’s evolving CSS variables approach, navs now use local CSS variables on .nav, .nav-tabs, and .nav-pills for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    On the .nav base class:

    -
    -
    - scss/_nav.scss -
    - -
    -
    --#{$prefix}nav-link-padding-x: #{$nav-link-padding-x};
    ---#{$prefix}nav-link-padding-y: #{$nav-link-padding-y};
    -@include rfs($nav-link-font-size, --#{$prefix}nav-link-font-size);
    ---#{$prefix}nav-link-font-weight: #{$nav-link-font-weight};
    ---#{$prefix}nav-link-color: #{$nav-link-color};
    ---#{$prefix}nav-link-hover-color: #{$nav-link-hover-color};
    ---#{$prefix}nav-link-disabled-color: #{$nav-link-disabled-color};
    +
    --#{$prefix}nav-link-padding-x: #{$nav-link-padding-x};
    +--#{$prefix}nav-link-padding-y: #{$nav-link-padding-y};
    +@include rfs($nav-link-font-size, --#{$prefix}nav-link-font-size);
    +--#{$prefix}nav-link-font-weight: #{$nav-link-font-weight};
    +--#{$prefix}nav-link-color: #{$nav-link-color};
    +--#{$prefix}nav-link-hover-color: #{$nav-link-hover-color};
    +--#{$prefix}nav-link-disabled-color: #{$nav-link-disabled-color};
    +

    On the .nav-tabs modifier class:

    -
    -
    - scss/_nav.scss -
    - -
    -
    --#{$prefix}nav-tabs-border-width: #{$nav-tabs-border-width};
    ---#{$prefix}nav-tabs-border-color: #{$nav-tabs-border-color};
    ---#{$prefix}nav-tabs-border-radius: #{$nav-tabs-border-radius};
    ---#{$prefix}nav-tabs-link-hover-border-color: #{$nav-tabs-link-hover-border-color};
    ---#{$prefix}nav-tabs-link-active-color: #{$nav-tabs-link-active-color};
    ---#{$prefix}nav-tabs-link-active-bg: #{$nav-tabs-link-active-bg};
    ---#{$prefix}nav-tabs-link-active-border-color: #{$nav-tabs-link-active-border-color};
    +
    --#{$prefix}nav-tabs-border-width: #{$nav-tabs-border-width};
    +--#{$prefix}nav-tabs-border-color: #{$nav-tabs-border-color};
    +--#{$prefix}nav-tabs-border-radius: #{$nav-tabs-border-radius};
    +--#{$prefix}nav-tabs-link-hover-border-color: #{$nav-tabs-link-hover-border-color};
    +--#{$prefix}nav-tabs-link-active-color: #{$nav-tabs-link-active-color};
    +--#{$prefix}nav-tabs-link-active-bg: #{$nav-tabs-link-active-bg};
    +--#{$prefix}nav-tabs-link-active-border-color: #{$nav-tabs-link-active-border-color};
    +

    On the .nav-pills modifier class:

    -
    -
    - scss/_nav.scss -
    - -
    -
    --#{$prefix}nav-pills-border-radius: #{$nav-pills-border-radius};
    ---#{$prefix}nav-pills-link-active-color: #{$nav-pills-link-active-color};
    ---#{$prefix}nav-pills-link-active-bg: #{$nav-pills-link-active-bg};
    +
    --#{$prefix}nav-pills-border-radius: #{$nav-pills-border-radius};
    +--#{$prefix}nav-pills-link-active-color: #{$nav-pills-link-active-color};
    +--#{$prefix}nav-pills-link-active-bg: #{$nav-pills-link-active-bg};
    +
    Added in v5.3.0 -

    On the .nav-underline modifier class:

    -
    -
    - scss/_nav.scss -
    - -
    -
    --#{$prefix}nav-underline-gap: #{$nav-underline-gap};
    ---#{$prefix}nav-underline-border-width: #{$nav-underline-border-width};
    ---#{$prefix}nav-underline-link-active-color: #{$nav-underline-link-active-color};
    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $nav-link-padding-y:                .5rem;
    -$nav-link-padding-x:                1rem;
    -$nav-link-font-size:                null;
    -$nav-link-font-weight:              null;
    -$nav-link-color:                    var(--#{$prefix}link-color);
    -$nav-link-hover-color:              var(--#{$prefix}link-hover-color);
    -$nav-link-transition:               color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out;
    -$nav-link-disabled-color:           var(--#{$prefix}secondary-color);
    -$nav-link-focus-box-shadow:         $focus-ring-box-shadow;
    -
    -$nav-tabs-border-color:             var(--#{$prefix}border-color);
    -$nav-tabs-border-width:             var(--#{$prefix}border-width);
    -$nav-tabs-border-radius:            var(--#{$prefix}border-radius);
    -$nav-tabs-link-hover-border-color:  var(--#{$prefix}secondary-bg) var(--#{$prefix}secondary-bg) $nav-tabs-border-color;
    -$nav-tabs-link-active-color:        var(--#{$prefix}emphasis-color);
    -$nav-tabs-link-active-bg:           var(--#{$prefix}body-bg);
    -$nav-tabs-link-active-border-color: var(--#{$prefix}border-color) var(--#{$prefix}border-color) $nav-tabs-link-active-bg;
    -
    -$nav-pills-border-radius:           var(--#{$prefix}border-radius);
    -$nav-pills-link-active-color:       $component-active-color;
    -$nav-pills-link-active-bg:          $component-active-bg;
    -
    -$nav-underline-gap:                 1rem;
    -$nav-underline-border-width:        .125rem;
    -$nav-underline-link-active-color:   var(--#{$prefix}emphasis-color);
    -
    -

    JavaScript behavior

    +
    --#{$prefix}nav-underline-gap: #{$nav-underline-gap};
    +--#{$prefix}nav-underline-border-width: #{$nav-underline-border-width};
    +--#{$prefix}nav-underline-link-active-color: #{$nav-underline-link-active-color};
    +
    +

    Sass variables

    +
    $nav-link-padding-y:                .5rem;
    +$nav-link-padding-x:                1rem;
    +$nav-link-font-size:                null;
    +$nav-link-font-weight:              null;
    +$nav-link-color:                    var(--#{$prefix}link-color);
    +$nav-link-hover-color:              var(--#{$prefix}link-hover-color);
    +$nav-link-transition:               color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out;
    +$nav-link-disabled-color:           var(--#{$prefix}secondary-color);
    +$nav-link-focus-box-shadow:         $focus-ring-box-shadow;
    +
    +$nav-tabs-border-color:             var(--#{$prefix}border-color);
    +$nav-tabs-border-width:             var(--#{$prefix}border-width);
    +$nav-tabs-border-radius:            var(--#{$prefix}border-radius);
    +$nav-tabs-link-hover-border-color:  var(--#{$prefix}secondary-bg) var(--#{$prefix}secondary-bg) $nav-tabs-border-color;
    +$nav-tabs-link-active-color:        var(--#{$prefix}emphasis-color);
    +$nav-tabs-link-active-bg:           var(--#{$prefix}body-bg);
    +$nav-tabs-link-active-border-color: var(--#{$prefix}border-color) var(--#{$prefix}border-color) $nav-tabs-link-active-bg;
    +
    +$nav-pills-border-radius:           var(--#{$prefix}border-radius);
    +$nav-pills-link-active-color:       $component-active-color;
    +$nav-pills-link-active-bg:          $component-active-bg;
    +
    +$nav-underline-gap:                 1rem;
    +$nav-underline-border-width:        .125rem;
    +$nav-underline-link-active-color:   var(--#{$prefix}emphasis-color);
    +
    +

    JavaScript behavior

    Use the tab JavaScript plugin—include it individually or through the compiled bootstrap.js file—to extend our navigational tabs and pills to create tabbable panes of local content.

    -
    - -
    -
    -

    This is some placeholder content the Home tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    -
    -
    -

    This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    -
    -
    -

    This is some placeholder content the Contact tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    -
    -
    -

    This is some placeholder content the Disabled tab's associated content.

    -
    -
    -
    -
    <ul class="nav nav-tabs" id="myTab" role="tablist">
    -  <li class="nav-item" role="presentation">
    -    <button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home-tab-pane" type="button" role="tab" aria-controls="home-tab-pane" aria-selected="true">Home</button>
    -  </li>
    -  <li class="nav-item" role="presentation">
    -    <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile-tab-pane" type="button" role="tab" aria-controls="profile-tab-pane" aria-selected="false">Profile</button>
    -  </li>
    -  <li class="nav-item" role="presentation">
    -    <button class="nav-link" id="contact-tab" data-bs-toggle="tab" data-bs-target="#contact-tab-pane" type="button" role="tab" aria-controls="contact-tab-pane" aria-selected="false">Contact</button>
    -  </li>
    -  <li class="nav-item" role="presentation">
    -    <button class="nav-link" id="disabled-tab" data-bs-toggle="tab" data-bs-target="#disabled-tab-pane" type="button" role="tab" aria-controls="disabled-tab-pane" aria-selected="false" disabled>Disabled</button>
    -  </li>
    -</ul>
    -<div class="tab-content" id="myTabContent">
    -  <div class="tab-pane fade show active" id="home-tab-pane" role="tabpanel" aria-labelledby="home-tab" tabindex="0">...</div>
    -  <div class="tab-pane fade" id="profile-tab-pane" role="tabpanel" aria-labelledby="profile-tab" tabindex="0">...</div>
    -  <div class="tab-pane fade" id="contact-tab-pane" role="tabpanel" aria-labelledby="contact-tab" tabindex="0">...</div>
    -  <div class="tab-pane fade" id="disabled-tab-pane" role="tabpanel" aria-labelledby="disabled-tab" tabindex="0">...</div>
    -</div>
    -

    To help fit your needs, this works with <ul>-based markup, as shown above, or with any arbitrary “roll your own” markup. Note that if you’re using <nav>, you shouldn’t add role="tablist" directly to it, as this would override the element’s native role as a navigation landmark. Instead, switch to an alternative element (in the example below, a simple <div>) and wrap the <nav> around it.

    -
    - - -
    -
    <nav>
    -  <div class="nav nav-tabs" id="nav-tab" role="tablist">
    -    <button class="nav-link active" id="nav-home-tab" data-bs-toggle="tab" data-bs-target="#nav-home" type="button" role="tab" aria-controls="nav-home" aria-selected="true">Home</button>
    -    <button class="nav-link" id="nav-profile-tab" data-bs-toggle="tab" data-bs-target="#nav-profile" type="button" role="tab" aria-controls="nav-profile" aria-selected="false">Profile</button>
    -    <button class="nav-link" id="nav-contact-tab" data-bs-toggle="tab" data-bs-target="#nav-contact" type="button" role="tab" aria-controls="nav-contact" aria-selected="false">Contact</button>
    -    <button class="nav-link" id="nav-disabled-tab" data-bs-toggle="tab" data-bs-target="#nav-disabled" type="button" role="tab" aria-controls="nav-disabled" aria-selected="false" disabled>Disabled</button>
    -  </div>
    -</nav>
    -<div class="tab-content" id="nav-tabContent">
    -  <div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-home-tab" tabindex="0">...</div>
    -  <div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-profile-tab" tabindex="0">...</div>
    -  <div class="tab-pane fade" id="nav-contact" role="tabpanel" aria-labelledby="nav-contact-tab" tabindex="0">...</div>
    -  <div class="tab-pane fade" id="nav-disabled" role="tabpanel" aria-labelledby="nav-disabled-tab" tabindex="0">...</div>
    -</div>
    -

    The tabs plugin also works with pills.

    -
    - -
    -
    -

    This is some placeholder content the Home tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    -
    -
    -

    This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    -
    -
    -

    This is some placeholder content the Contact tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    -
    -
    -

    This is some placeholder content the Disabled tab's associated content.

    -
    -
    -
    -
    <ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">
    -  <li class="nav-item" role="presentation">
    -    <button class="nav-link active" id="pills-home-tab" data-bs-toggle="pill" data-bs-target="#pills-home" type="button" role="tab" aria-controls="pills-home" aria-selected="true">Home</button>
    -  </li>
    -  <li class="nav-item" role="presentation">
    -    <button class="nav-link" id="pills-profile-tab" data-bs-toggle="pill" data-bs-target="#pills-profile" type="button" role="tab" aria-controls="pills-profile" aria-selected="false">Profile</button>
    -  </li>
    -  <li class="nav-item" role="presentation">
    -    <button class="nav-link" id="pills-contact-tab" data-bs-toggle="pill" data-bs-target="#pills-contact" type="button" role="tab" aria-controls="pills-contact" aria-selected="false">Contact</button>
    -  </li>
    -  <li class="nav-item" role="presentation">
    -    <button class="nav-link" id="pills-disabled-tab" data-bs-toggle="pill" data-bs-target="#pills-disabled" type="button" role="tab" aria-controls="pills-disabled" aria-selected="false" disabled>Disabled</button>
    -  </li>
    -</ul>
    -<div class="tab-content" id="pills-tabContent">
    -  <div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab" tabindex="0">...</div>
    -  <div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab" tabindex="0">...</div>
    -  <div class="tab-pane fade" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab" tabindex="0">...</div>
    -  <div class="tab-pane fade" id="pills-disabled" role="tabpanel" aria-labelledby="pills-disabled-tab" tabindex="0">...</div>
    -</div>
    -

    And with vertical pills. Ideally, for vertical tabs, you should also add aria-orientation="vertical" to the tab list container.

    -
    -
    - -
    -
    -

    This is some placeholder content the Home tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    -
    -
    -

    This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    -
    -
    -

    This is some placeholder content the Disabled tab's associated content.

    -
    -
    -

    This is some placeholder content the Messages tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    -
    -
    -

    This is some placeholder content the Settings tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    -
    -
    -
    -
    -
    <div class="d-flex align-items-start">
    -  <div class="nav flex-column nav-pills me-3" id="v-pills-tab" role="tablist" aria-orientation="vertical">
    -    <button class="nav-link active" id="v-pills-home-tab" data-bs-toggle="pill" data-bs-target="#v-pills-home" type="button" role="tab" aria-controls="v-pills-home" aria-selected="true">Home</button>
    -    <button class="nav-link" id="v-pills-profile-tab" data-bs-toggle="pill" data-bs-target="#v-pills-profile" type="button" role="tab" aria-controls="v-pills-profile" aria-selected="false">Profile</button>
    -    <button class="nav-link" id="v-pills-disabled-tab" data-bs-toggle="pill" data-bs-target="#v-pills-disabled" type="button" role="tab" aria-controls="v-pills-disabled" aria-selected="false" disabled>Disabled</button>
    -    <button class="nav-link" id="v-pills-messages-tab" data-bs-toggle="pill" data-bs-target="#v-pills-messages" type="button" role="tab" aria-controls="v-pills-messages" aria-selected="false">Messages</button>
    -    <button class="nav-link" id="v-pills-settings-tab" data-bs-toggle="pill" data-bs-target="#v-pills-settings" type="button" role="tab" aria-controls="v-pills-settings" aria-selected="false">Settings</button>
    -  </div>
    -  <div class="tab-content" id="v-pills-tabContent">
    -    <div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab" tabindex="0">...</div>
    -    <div class="tab-pane fade" id="v-pills-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab" tabindex="0">...</div>
    -    <div class="tab-pane fade" id="v-pills-disabled" role="tabpanel" aria-labelledby="v-pills-disabled-tab" tabindex="0">...</div>
    -    <div class="tab-pane fade" id="v-pills-messages" role="tabpanel" aria-labelledby="v-pills-messages-tab" tabindex="0">...</div>
    -    <div class="tab-pane fade" id="v-pills-settings" role="tabpanel" aria-labelledby="v-pills-settings-tab" tabindex="0">...</div>
    -  </div>
    -</div>
    -

    Accessibility

    +

    This is some placeholder content the Home tab’s associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    This is some placeholder content the Profile tab’s associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    This is some placeholder content the Contact tab’s associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    This is some placeholder content the Disabled tab’s associated content.

    +
    <ul class="nav nav-tabs" id="myTab" role="tablist">
    +  <li class="nav-item" role="presentation">
    +    <button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home-tab-pane" type="button" role="tab" aria-controls="home-tab-pane" aria-selected="true">Home</button>
    +  </li>
    +  <li class="nav-item" role="presentation">
    +    <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile-tab-pane" type="button" role="tab" aria-controls="profile-tab-pane" aria-selected="false">Profile</button>
    +  </li>
    +  <li class="nav-item" role="presentation">
    +    <button class="nav-link" id="contact-tab" data-bs-toggle="tab" data-bs-target="#contact-tab-pane" type="button" role="tab" aria-controls="contact-tab-pane" aria-selected="false">Contact</button>
    +  </li>
    +  <li class="nav-item" role="presentation">
    +    <button class="nav-link" id="disabled-tab" data-bs-toggle="tab" data-bs-target="#disabled-tab-pane" type="button" role="tab" aria-controls="disabled-tab-pane" aria-selected="false" disabled>Disabled</button>
    +  </li>
    +</ul>
    +<div class="tab-content" id="myTabContent">
    +  <div class="tab-pane fade show active" id="home-tab-pane" role="tabpanel" aria-labelledby="home-tab" tabindex="0">...</div>
    +  <div class="tab-pane fade" id="profile-tab-pane" role="tabpanel" aria-labelledby="profile-tab" tabindex="0">...</div>
    +  <div class="tab-pane fade" id="contact-tab-pane" role="tabpanel" aria-labelledby="contact-tab" tabindex="0">...</div>
    +  <div class="tab-pane fade" id="disabled-tab-pane" role="tabpanel" aria-labelledby="disabled-tab" tabindex="0">...</div>
    +</div>
    +
    +

    To help fit your needs, this works with <ul>-based markup, as shown above, or with any arbitrary “roll your own” markup. Note that if you’re using <nav>, you shouldn’t add role="tablist" directly to it, as this would override the element’s native role as a navigation landmark. Instead, switch to an alternative element (in the example below, a simple <div>) and wrap the <nav> around it.

    +
    +
    <nav>
    +  <div class="nav nav-tabs" id="nav-tab" role="tablist">
    +    <button class="nav-link active" id="nav-home-tab" data-bs-toggle="tab" data-bs-target="#nav-home" type="button" role="tab" aria-controls="nav-home" aria-selected="true">Home</button>
    +    <button class="nav-link" id="nav-profile-tab" data-bs-toggle="tab" data-bs-target="#nav-profile" type="button" role="tab" aria-controls="nav-profile" aria-selected="false">Profile</button>
    +    <button class="nav-link" id="nav-contact-tab" data-bs-toggle="tab" data-bs-target="#nav-contact" type="button" role="tab" aria-controls="nav-contact" aria-selected="false">Contact</button>
    +    <button class="nav-link" id="nav-disabled-tab" data-bs-toggle="tab" data-bs-target="#nav-disabled" type="button" role="tab" aria-controls="nav-disabled" aria-selected="false" disabled>Disabled</button>
    +  </div>
    +</nav>
    +<div class="tab-content" id="nav-tabContent">
    +  <div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-home-tab" tabindex="0">...</div>
    +  <div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-profile-tab" tabindex="0">...</div>
    +  <div class="tab-pane fade" id="nav-contact" role="tabpanel" aria-labelledby="nav-contact-tab" tabindex="0">...</div>
    +  <div class="tab-pane fade" id="nav-disabled" role="tabpanel" aria-labelledby="nav-disabled-tab" tabindex="0">...</div>
    +</div>
    +
    +

    The tabs plugin also works with pills.

    +

    This is some placeholder content the Home tab’s associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    This is some placeholder content the Profile tab’s associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    This is some placeholder content the Contact tab’s associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    This is some placeholder content the Disabled tab’s associated content.

    +
    <ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">
    +  <li class="nav-item" role="presentation">
    +    <button class="nav-link active" id="pills-home-tab" data-bs-toggle="pill" data-bs-target="#pills-home" type="button" role="tab" aria-controls="pills-home" aria-selected="true">Home</button>
    +  </li>
    +  <li class="nav-item" role="presentation">
    +    <button class="nav-link" id="pills-profile-tab" data-bs-toggle="pill" data-bs-target="#pills-profile" type="button" role="tab" aria-controls="pills-profile" aria-selected="false">Profile</button>
    +  </li>
    +  <li class="nav-item" role="presentation">
    +    <button class="nav-link" id="pills-contact-tab" data-bs-toggle="pill" data-bs-target="#pills-contact" type="button" role="tab" aria-controls="pills-contact" aria-selected="false">Contact</button>
    +  </li>
    +  <li class="nav-item" role="presentation">
    +    <button class="nav-link" id="pills-disabled-tab" data-bs-toggle="pill" data-bs-target="#pills-disabled" type="button" role="tab" aria-controls="pills-disabled" aria-selected="false" disabled>Disabled</button>
    +  </li>
    +</ul>
    +<div class="tab-content" id="pills-tabContent">
    +  <div class="tab-pane fade show active" id="pills-home" role="tabpanel" aria-labelledby="pills-home-tab" tabindex="0">...</div>
    +  <div class="tab-pane fade" id="pills-profile" role="tabpanel" aria-labelledby="pills-profile-tab" tabindex="0">...</div>
    +  <div class="tab-pane fade" id="pills-contact" role="tabpanel" aria-labelledby="pills-contact-tab" tabindex="0">...</div>
    +  <div class="tab-pane fade" id="pills-disabled" role="tabpanel" aria-labelledby="pills-disabled-tab" tabindex="0">...</div>
    +</div>
    +
    +

    And with vertical pills. Ideally, for vertical tabs, you should also add aria-orientation="vertical" to the tab list container.

    +

    This is some placeholder content the Home tab’s associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    This is some placeholder content the Profile tab’s associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    This is some placeholder content the Disabled tab’s associated content.

    This is some placeholder content the Messages tab’s associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    This is some placeholder content the Settings tab’s associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

    +
    <div class="d-flex align-items-start">
    +  <div class="nav flex-column nav-pills me-3" id="v-pills-tab" role="tablist" aria-orientation="vertical">
    +    <button class="nav-link active" id="v-pills-home-tab" data-bs-toggle="pill" data-bs-target="#v-pills-home" type="button" role="tab" aria-controls="v-pills-home" aria-selected="true">Home</button>
    +    <button class="nav-link" id="v-pills-profile-tab" data-bs-toggle="pill" data-bs-target="#v-pills-profile" type="button" role="tab" aria-controls="v-pills-profile" aria-selected="false">Profile</button>
    +    <button class="nav-link" id="v-pills-disabled-tab" data-bs-toggle="pill" data-bs-target="#v-pills-disabled" type="button" role="tab" aria-controls="v-pills-disabled" aria-selected="false" disabled>Disabled</button>
    +    <button class="nav-link" id="v-pills-messages-tab" data-bs-toggle="pill" data-bs-target="#v-pills-messages" type="button" role="tab" aria-controls="v-pills-messages" aria-selected="false">Messages</button>
    +    <button class="nav-link" id="v-pills-settings-tab" data-bs-toggle="pill" data-bs-target="#v-pills-settings" type="button" role="tab" aria-controls="v-pills-settings" aria-selected="false">Settings</button>
    +  </div>
    +  <div class="tab-content" id="v-pills-tabContent">
    +    <div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab" tabindex="0">...</div>
    +    <div class="tab-pane fade" id="v-pills-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab" tabindex="0">...</div>
    +    <div class="tab-pane fade" id="v-pills-disabled" role="tabpanel" aria-labelledby="v-pills-disabled-tab" tabindex="0">...</div>
    +    <div class="tab-pane fade" id="v-pills-messages" role="tabpanel" aria-labelledby="v-pills-messages-tab" tabindex="0">...</div>
    +    <div class="tab-pane fade" id="v-pills-settings" role="tabpanel" aria-labelledby="v-pills-settings-tab" tabindex="0">...</div>
    +  </div>
    +</div>
    +
    +

    Accessibility

    Dynamic tabbed interfaces, as described in the ARIA Authoring Practices Guide tabs pattern, require role="tablist", role="tab", role="tabpanel", and additional aria- attributes in order to convey their structure, functionality, and current state to users of assistive technologies (such as screen readers). As a best practice, we recommend using <button> elements for the tabs, as these are controls that trigger a dynamic change, rather than links that navigate to a new page or location.

    -

    In line with the ARIA Authoring Practices pattern, only the currently active tab receives keyboard focus. When the JavaScript plugin is initialized, it will set tabindex="-1" on all inactive tab controls. Once the currently active tab has focus, the cursor keys activate the previous/next tab. The Home and End keys activate the first and last tabs, respectively. The plugin will change the roving tabindex accordingly. However, note that the JavaScript plugin does not distinguish between horizontal and vertical tab lists when it comes to cursor key interactions: regardless of the tab list’s orientation, both the up and left cursor go to the previous tab, and down and right cursor go to the next tab.

    -
    -In general, to facilitate keyboard navigation, it’s recommended to make the tab panels themselves focusable as well, unless the first element containing meaningful content inside the tab panel is already focusable. The JavaScript plugin does not try to handle this aspect—where appropriate, you’ll need to explicitly make your tab panels focusable by adding tabindex="0" in your markup. -
    - -
    -The tab JavaScript plugin does not support tabbed interfaces that contain dropdown menus, as these cause both usability and accessibility issues. From a usability perspective, the fact that the currently displayed tab’s trigger element is not immediately visible (as it’s inside the closed dropdown menu) can cause confusion. From an accessibility point of view, there is currently no sensible way to map this sort of construct to a standard WAI ARIA pattern, meaning that it cannot be easily made understandable to users of assistive technologies. -
    - -

    Using data attributes

    +

    In line with the ARIA Authoring Practices pattern, only the currently active tab receives keyboard focus. When the JavaScript plugin is initialized, it will set tabindex="-1" on all inactive tab controls. Once the currently active tab has focus, the cursor keys activate the previous/next tab. The Home and End keys activate the first and last tabs, respectively. The plugin will change the roving tabindex accordingly. However, note that the JavaScript plugin does not distinguish between horizontal and vertical tab lists when it comes to cursor key interactions: regardless of the tab list’s orientation, both the up and left cursor go to the previous tab, and down and right cursor go to the next tab.

    +

    In general, to facilitate keyboard navigation, it’s recommended to make the tab panels themselves focusable as well, unless the first element containing meaningful content inside the tab panel is already focusable. The JavaScript plugin does not try to handle this aspect—where appropriate, you’ll need to explicitly make your tab panels focusable by adding tabindex="0" in your markup.

    +

    The tab JavaScript plugin does not support tabbed interfaces that contain dropdown menus, as these cause both usability and accessibility issues. From a usability perspective, the fact that the currently displayed tab’s trigger element is not immediately visible (as it’s inside the closed dropdown menu) can cause confusion. From an accessibility point of view, there is currently no sensible way to map this sort of construct to a standard WAI ARIA pattern, meaning that it cannot be easily made understandable to users of assistive technologies.

    +

    Using data attributes

    You can activate a tab or pill navigation without writing any JavaScript by simply specifying data-bs-toggle="tab" or data-bs-toggle="pill" on an element. Use these data attributes on .nav-tabs or .nav-pills.

    -
    <!-- Nav tabs -->
    -<ul class="nav nav-tabs" id="myTab" role="tablist">
    -  <li class="nav-item" role="presentation">
    -    <button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button" role="tab" aria-controls="home" aria-selected="true">Home</button>
    -  </li>
    -  <li class="nav-item" role="presentation">
    -    <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile" type="button" role="tab" aria-controls="profile" aria-selected="false">Profile</button>
    -  </li>
    -  <li class="nav-item" role="presentation">
    -    <button class="nav-link" id="messages-tab" data-bs-toggle="tab" data-bs-target="#messages" type="button" role="tab" aria-controls="messages" aria-selected="false">Messages</button>
    -  </li>
    -  <li class="nav-item" role="presentation">
    -    <button class="nav-link" id="settings-tab" data-bs-toggle="tab" data-bs-target="#settings" type="button" role="tab" aria-controls="settings" aria-selected="false">Settings</button>
    -  </li>
    -</ul>
    -
    -<!-- Tab panes -->
    -<div class="tab-content">
    -  <div class="tab-pane active" id="home" role="tabpanel" aria-labelledby="home-tab" tabindex="0">...</div>
    -  <div class="tab-pane" id="profile" role="tabpanel" aria-labelledby="profile-tab" tabindex="0">...</div>
    -  <div class="tab-pane" id="messages" role="tabpanel" aria-labelledby="messages-tab" tabindex="0">...</div>
    -  <div class="tab-pane" id="settings" role="tabpanel" aria-labelledby="settings-tab" tabindex="0">...</div>
    -</div>
    -

    Via JavaScript

    -

    Enable tabbable tabs via JavaScript (each tab needs to be activated individually):

    -
    const triggerTabList = document.querySelectorAll('#myTab button')
    -triggerTabList.forEach(triggerEl => {
    -  const tabTrigger = new bootstrap.Tab(triggerEl)
    -
    -  triggerEl.addEventListener('click', event => {
    -    event.preventDefault()
    -    tabTrigger.show()
    -  })
    -})
    -

    You can activate individual tabs in several ways:

    -
    const triggerEl = document.querySelector('#myTab button[data-bs-target="#profile"]')
    -bootstrap.Tab.getInstance(triggerEl).show() // Select tab by name
    -
    -const triggerFirstTabEl = document.querySelector('#myTab li:first-child button')
    -bootstrap.Tab.getInstance(triggerFirstTabEl).show() // Select first tab
    -

    Fade effect

    -

    To make tabs fade in, add .fade to each .tab-pane. The first tab pane must also have .show to make the initial content visible.

    -
    <div class="tab-content">
    -  <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab" tabindex="0">...</div>
    -  <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab" tabindex="0">...</div>
    -  <div class="tab-pane fade" id="messages" role="tabpanel" aria-labelledby="messages-tab" tabindex="0">...</div>
    -  <div class="tab-pane fade" id="settings" role="tabpanel" aria-labelledby="settings-tab" tabindex="0">...</div>
    -</div>
    -

    Methods

    -
    -All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started, but before it ends. In addition, a method call on a transitioning component will be ignored. Learn more in our JavaScript docs. -
    +
    <!-- Nav tabs -->
    +<ul class="nav nav-tabs" id="myTab" role="tablist">
    +  <li class="nav-item" role="presentation">
    +    <button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button" role="tab" aria-controls="home" aria-selected="true">Home</button>
    +  </li>
    +  <li class="nav-item" role="presentation">
    +    <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile" type="button" role="tab" aria-controls="profile" aria-selected="false">Profile</button>
    +  </li>
    +  <li class="nav-item" role="presentation">
    +    <button class="nav-link" id="messages-tab" data-bs-toggle="tab" data-bs-target="#messages" type="button" role="tab" aria-controls="messages" aria-selected="false">Messages</button>
    +  </li>
    +  <li class="nav-item" role="presentation">
    +    <button class="nav-link" id="settings-tab" data-bs-toggle="tab" data-bs-target="#settings" type="button" role="tab" aria-controls="settings" aria-selected="false">Settings</button>
    +  </li>
    +</ul>
     
    +<!-- Tab panes -->
    +<div class="tab-content">
    +  <div class="tab-pane active" id="home" role="tabpanel" aria-labelledby="home-tab" tabindex="0">...</div>
    +  <div class="tab-pane" id="profile" role="tabpanel" aria-labelledby="profile-tab" tabindex="0">...</div>
    +  <div class="tab-pane" id="messages" role="tabpanel" aria-labelledby="messages-tab" tabindex="0">...</div>
    +  <div class="tab-pane" id="settings" role="tabpanel" aria-labelledby="settings-tab" tabindex="0">...</div>
    +</div>
    +
    +

    Via JavaScript

    +

    Enable tabbable tabs via JavaScript (each tab needs to be activated individually):

    +
    const triggerTabList = document.querySelectorAll('#myTab button')
    +triggerTabList.forEach(triggerEl => {
    +  const tabTrigger = new bootstrap.Tab(triggerEl)
    +
    +  triggerEl.addEventListener('click', event => {
    +    event.preventDefault()
    +    tabTrigger.show()
    +  })
    +})
    +
    +

    You can activate individual tabs in several ways:

    +
    const triggerEl = document.querySelector('#myTab button[data-bs-target="#profile"]')
    +bootstrap.Tab.getInstance(triggerEl).show() // Select tab by name
    +
    +const triggerFirstTabEl = document.querySelector('#myTab li:first-child button')
    +bootstrap.Tab.getInstance(triggerFirstTabEl).show() // Select first tab
    +
    +

    Fade effect

    +

    To make tabs fade in, add .fade to each .tab-pane. The first tab pane must also have .show to make the initial content visible.

    +
    <div class="tab-content">
    +  <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab" tabindex="0">...</div>
    +  <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab" tabindex="0">...</div>
    +  <div class="tab-pane fade" id="messages" role="tabpanel" aria-labelledby="messages-tab" tabindex="0">...</div>
    +  <div class="tab-pane fade" id="settings" role="tabpanel" aria-labelledby="settings-tab" tabindex="0">...</div>
    +</div>
    +
    +

    Methods

    +

    All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started, but before it ends. In addition, a method call on a transitioning component will be ignored. Learn more in our JavaScript docs.

    Activates your content as a tab element.

    You can create a tab instance with the constructor, for example:

    -
    const bsTab = new bootstrap.Tab('#myTab')
    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    MethodDescription
    disposeDestroys an element’s tab.
    getInstanceStatic method which allows you to get the tab instance associated with a DOM element, you can use it like this: bootstrap.Tab.getInstance(element).
    getOrCreateInstanceStatic method which returns a tab instance associated to a DOM element or create a new one in case it wasn’t initialized. You can use it like this: bootstrap.Tab.getOrCreateInstance(element).
    showSelects the given tab and shows its associated pane. Any other tab that was previously selected becomes unselected and its associated pane is hidden. Returns to the caller before the tab pane has actually been shown (i.e. before the shown.bs.tab event occurs).
    +
    const bsTab = new bootstrap.Tab('#myTab')
    +
    +
    -

    Events

    + + + + + + + + + + + + + + + + + + + + + + + +
    MethodDescription
    disposeDestroys an element’s tab.
    getInstanceStatic method which allows you to get the tab instance associated with a DOM element, you can use it like this: bootstrap.Tab.getInstance(element).
    getOrCreateInstanceStatic method which returns a tab instance associated to a DOM element or create a new one in case it wasn’t initialized. You can use it like this: bootstrap.Tab.getOrCreateInstance(element).
    showSelects the given tab and shows its associated pane. Any other tab that was previously selected becomes unselected and its associated pane is hidden. Returns to the caller before the tab pane has actually been shown (i.e. before the shown.bs.tab event occurs).
    +

    Events

    When showing a new tab, the events fire in the following order:

    1. hide.bs.tab (on the current active tab)
    2. @@ -1670,112 +678,39 @@ The tab JavaScript plugin does not support tabbed interfaces th
    3. shown.bs.tab (on the newly-active just-shown tab, the same one as for the show.bs.tab event)

    If no tab was already active, then the hide.bs.tab and hidden.bs.tab events will not be fired.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    Event typeDescription
    hide.bs.tabThis event fires when a new tab is to be shown (and thus the previous active tab is to be hidden). Use event.target and event.relatedTarget to target the current active tab and the new soon-to-be-active tab, respectively.
    hidden.bs.tabThis event fires after a new tab is shown (and thus the previous active tab is hidden). Use event.target and event.relatedTarget to target the previous active tab and the new active tab, respectively.
    show.bs.tabThis event fires on tab show, but before the new tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively.
    shown.bs.tabThis event fires on tab show after a tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively.
    - -
    const tabEl = document.querySelector('button[data-bs-toggle="tab"]')
    -tabEl.addEventListener('shown.bs.tab', event => {
    -  event.target // newly activated tab
    -  event.relatedTarget // previous active tab
    -})
    -
    -
    -
    -
    +
    - - - - - - - - - + + + + + + + + + + + + + + + + + + +
    Event typeDescription
    hide.bs.tabThis event fires when a new tab is to be shown (and thus the previous active tab is to be hidden). Use event.target and event.relatedTarget to target the current active tab and the new soon-to-be-active tab, respectively.
    hidden.bs.tabThis event fires after a new tab is shown (and thus the previous active tab is hidden). Use event.target and event.relatedTarget to target the previous active tab and the new active tab, respectively.
    show.bs.tabThis event fires on tab show, but before the new tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively.
    shown.bs.tabThis event fires on tab show after a tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively.
    +
    const tabEl = document.querySelector('button[data-bs-toggle="tab"]')
    +tabEl.addEventListener('shown.bs.tab', event => {
    +  event.target // newly activated tab
    +  event.relatedTarget // previous active tab
    +})
    +
    \ No newline at end of file diff --git a/docs/5.3/components/navs/index.html b/docs/5.3/components/navs/index.html index d470eecadd..8bd8fa4562 100644 --- a/docs/5.3/components/navs/index.html +++ b/docs/5.3/components/navs/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/components/navs-tabs/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/components/offcanvas/index.html b/docs/5.3/components/offcanvas/index.html index e8ca55f80c..3169144db1 100644 --- a/docs/5.3/components/offcanvas/index.html +++ b/docs/5.3/components/offcanvas/index.html @@ -1,612 +1,40 @@ - - - - - - - - - - - - - - - - -Offcanvas · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Offcanvas

    -
    -

    Build hidden sidebars into your project for navigation, shopping carts, and more with a few classes and our JavaScript plugin.

    - - -
    - - - - - -
    - - -

    How it works

    + Offcanvas · Bootstrap v5.3

    Build hidden sidebars into your project for navigation, shopping carts, and more with a few classes and our JavaScript plugin.

    +

    How it works

    Offcanvas is a sidebar component that can be toggled via JavaScript to appear from the left, right, top, or bottom edge of the viewport. Buttons or anchors are used as triggers that are attached to specific elements you toggle, and data attributes are used to invoke our JavaScript.

    • Offcanvas shares some of the same JavaScript code as modals. Conceptually, they are quite similar, but they are separate plugins.
    • -
    • Similarly, some source Sass variables for offcanvas’s styles and dimensions are inherited from the modal’s variables.
    • +
    • Similarly, some source Sass variables for offcanvas’s styles and dimensions are inherited from the modal’s variables.
    • When shown, offcanvas includes a default backdrop that can be clicked to hide the offcanvas.
    • Similar to modals, only one offcanvas can be shown at a time.

    Heads up! Given how CSS handles animations, you cannot use margin or translate on an .offcanvas element. Instead, use the class as an independent wrapping element.

    -
    -The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation. -
    - -

    Examples

    -

    Offcanvas components

    +

    The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation.

    +

    Examples

    +

    Offcanvas components

    Below is an offcanvas example that is shown by default (via .show on .offcanvas). Offcanvas includes support for a header with a close button and an optional body class for some initial padding. We suggest that you include offcanvas headers with dismiss actions whenever possible, or provide an explicit dismiss action.

    -
    -
    - -
    +
    Offcanvas
    @@ -614,40 +42,23 @@ The animation effect of this component is dependent on the prefers-reduced
    Content for the offcanvas goes here. You can place just about any Bootstrap component or custom elements here.
    -
    - -
    - html -
    - - -
    -
    <div class="offcanvas offcanvas-start show" tabindex="-1" id="offcanvas" aria-labelledby="offcanvasLabel">
    -  <div class="offcanvas-header">
    -    <h5 class="offcanvas-title" id="offcanvasLabel">Offcanvas</h5>
    -    <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    -  </div>
    -  <div class="offcanvas-body">
    -    Content for the offcanvas goes here. You can place just about any Bootstrap component or custom elements here.
    -  </div>
    -</div>
    -
    - -

    Live demo

    +
    html
    <div class="offcanvas offcanvas-start show" tabindex="-1" id="offcanvas" aria-labelledby="offcanvasLabel">
    +  <div class="offcanvas-header">
    +    <h5 class="offcanvas-title" id="offcanvasLabel">Offcanvas</h5>
    +    <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    +  </div>
    +  <div class="offcanvas-body">
    +    Content for the offcanvas goes here. You can place just about any Bootstrap component or custom elements here.
    +  </div>
    +</div>
    +

    Live demo

    Use the buttons below to show and hide an offcanvas element via JavaScript that toggles the .show class on an element with the .offcanvas class.

    • .offcanvas hides content (default)
    • .offcanvas.show shows content

    You can use a link with the href attribute, or a button with the data-bs-target attribute. In both cases, the data-bs-toggle="offcanvas" is required.

    -
    -
    - - +
    Link with href
    -
    +
    Some text as placeholder. In real life you can have the elements you have chosen. Like, text, images, lists, etc.
    -
    +
    html
    <a class="btn btn-primary" data-bs-toggle="offcanvas" href="#offcanvasExample" role="button" aria-controls="offcanvasExample">
    +  Link with href
    +</a>
    +<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasExample" aria-controls="offcanvasExample">
    +  Button with data-bs-target
    +</button>
     
    -  
    - html -
    - - -
    -
    <a class="btn btn-primary" data-bs-toggle="offcanvas" href="#offcanvasExample" role="button" aria-controls="offcanvasExample">
    -  Link with href
    -</a>
    -<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasExample" aria-controls="offcanvasExample">
    -  Button with data-bs-target
    -</button>
    -
    -<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvasExample" aria-labelledby="offcanvasExampleLabel">
    -  <div class="offcanvas-header">
    -    <h5 class="offcanvas-title" id="offcanvasExampleLabel">Offcanvas</h5>
    -    <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    -  </div>
    -  <div class="offcanvas-body">
    -    <div>
    -      Some text as placeholder. In real life you can have the elements you have chosen. Like, text, images, lists, etc.
    -    </div>
    -    <div class="dropdown mt-3">
    -      <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown">
    -        Dropdown button
    -      </button>
    -      <ul class="dropdown-menu">
    -        <li><a class="dropdown-item" href="#">Action</a></li>
    -        <li><a class="dropdown-item" href="#">Another action</a></li>
    -        <li><a class="dropdown-item" href="#">Something else here</a></li>
    -      </ul>
    -    </div>
    -  </div>
    -</div>
    -
    - -

    Body scrolling

    +<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvasExample" aria-labelledby="offcanvasExampleLabel"> + <div class="offcanvas-header"> + <h5 class="offcanvas-title" id="offcanvasExampleLabel">Offcanvas</h5> + <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button> + </div> + <div class="offcanvas-body"> + <div> + Some text as placeholder. In real life you can have the elements you have chosen. Like, text, images, lists, etc. + </div> + <div class="dropdown mt-3"> + <button class="btn btn-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown"> + Dropdown button + </button> + <ul class="dropdown-menu"> + <li><a class="dropdown-item" href="#">Action</a></li> + <li><a class="dropdown-item" href="#">Another action</a></li> + <li><a class="dropdown-item" href="#">Something else here</a></li> + </ul> + </div> + </div> +</div>
    +

    Body scrolling

    Scrolling the <body> element is disabled when an offcanvas and its backdrop are visible. Use the data-bs-scroll attribute to enable <body> scrolling.

    -
    -
    - - +
    @@ -731,37 +125,20 @@ The animation effect of this component is dependent on the prefers-reduced

    Try scrolling the rest of the page to see this option in action.

    -
    +
    html
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasScrolling" aria-controls="offcanvasScrolling">Enable body scrolling</button>
     
    -  
    - html -
    - - -
    -
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasScrolling" aria-controls="offcanvasScrolling">Enable body scrolling</button>
    -
    -<div class="offcanvas offcanvas-start" data-bs-scroll="true" data-bs-backdrop="false" tabindex="-1" id="offcanvasScrolling" aria-labelledby="offcanvasScrollingLabel">
    -  <div class="offcanvas-header">
    -    <h5 class="offcanvas-title" id="offcanvasScrollingLabel">Offcanvas with body scrolling</h5>
    -    <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    -  </div>
    -  <div class="offcanvas-body">
    -    <p>Try scrolling the rest of the page to see this option in action.</p>
    -  </div>
    -</div>
    -
    - -

    Body scrolling and backdrop

    +<div class="offcanvas offcanvas-start" data-bs-scroll="true" data-bs-backdrop="false" tabindex="-1" id="offcanvasScrolling" aria-labelledby="offcanvasScrollingLabel"> + <div class="offcanvas-header"> + <h5 class="offcanvas-title" id="offcanvasScrollingLabel">Offcanvas with body scrolling</h5> + <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button> + </div> + <div class="offcanvas-body"> + <p>Try scrolling the rest of the page to see this option in action.</p> + </div> +</div>
    +

    Body scrolling and backdrop

    You can also enable <body> scrolling with a visible backdrop.

    -
    -
    - - +
    @@ -771,37 +148,20 @@ The animation effect of this component is dependent on the prefers-reduced

    Try scrolling the rest of the page to see this option in action.

    -
    +
    html
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasWithBothOptions" aria-controls="offcanvasWithBothOptions">Enable both scrolling & backdrop</button>
     
    -  
    - html -
    - - -
    -
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasWithBothOptions" aria-controls="offcanvasWithBothOptions">Enable both scrolling & backdrop</button>
    -
    -<div class="offcanvas offcanvas-start" data-bs-scroll="true" tabindex="-1" id="offcanvasWithBothOptions" aria-labelledby="offcanvasWithBothOptionsLabel">
    -  <div class="offcanvas-header">
    -    <h5 class="offcanvas-title" id="offcanvasWithBothOptionsLabel">Backdrop with scrolling</h5>
    -    <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    -  </div>
    -  <div class="offcanvas-body">
    -    <p>Try scrolling the rest of the page to see this option in action.</p>
    -  </div>
    -</div>
    -
    - -

    Static backdrop

    +<div class="offcanvas offcanvas-start" data-bs-scroll="true" tabindex="-1" id="offcanvasWithBothOptions" aria-labelledby="offcanvasWithBothOptionsLabel"> + <div class="offcanvas-header"> + <h5 class="offcanvas-title" id="offcanvasWithBothOptionsLabel">Backdrop with scrolling</h5> + <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button> + </div> + <div class="offcanvas-body"> + <p>Try scrolling the rest of the page to see this option in action.</p> + </div> +</div>
    +

    Static backdrop

    When backdrop is set to static, the offcanvas will not close when clicking outside of it.

    -
    -
    - - @@ -815,48 +175,28 @@ The animation effect of this component is dependent on the prefers-reduced I will not close if you click outside of me.
    -
    +
    html
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#staticBackdrop" aria-controls="staticBackdrop">
    +  Toggle static offcanvas
    +</button>
     
    -  
    - html -
    - - -
    -
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#staticBackdrop" aria-controls="staticBackdrop">
    -  Toggle static offcanvas
    -</button>
    -
    -<div class="offcanvas offcanvas-start" data-bs-backdrop="static" tabindex="-1" id="staticBackdrop" aria-labelledby="staticBackdropLabel">
    -  <div class="offcanvas-header">
    -    <h5 class="offcanvas-title" id="staticBackdropLabel">Offcanvas</h5>
    -    <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    -  </div>
    -  <div class="offcanvas-body">
    -    <div>
    -      I will not close if you click outside of me.
    -    </div>
    -  </div>
    -</div>
    - - -

    Dark offcanvas

    -

    Deprecated in v5.3.0 - Added in v5.2.0 -

    +<div class="offcanvas offcanvas-start" data-bs-backdrop="static" tabindex="-1" id="staticBackdrop" aria-labelledby="staticBackdropLabel"> + <div class="offcanvas-header"> + <h5 class="offcanvas-title" id="staticBackdropLabel">Offcanvas</h5> + <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button> + </div> + <div class="offcanvas-body"> + <div> + I will not close if you click outside of me. + </div> + </div> +</div>
    +

    Dark offcanvas

    + +Deprecated in v5.3.0 +Added in v5.2.0

    Change the appearance of offcanvases with utilities to better match them to different contexts like dark navbars. Here we add .text-bg-dark to the .offcanvas and .btn-close-white to .btn-close for proper styling with a dark offcanvas. If you have dropdowns within, consider also adding .dropdown-menu-dark to .dropdown-menu.

    -
    -Heads up! Dark variants for components were deprecated in v5.3.0 with the introduction of color modes. Instead of manually adding classes mentioned above, set data-bs-theme="dark" on the root element, a parent wrapper, or the component itself. -
    - -
    -
    - -
    +

    Heads up! Dark variants for components were deprecated in v5.3.0 with the introduction of color modes. Instead of manually adding classes mentioned above, set data-bs-theme="dark" on the root element, a parent wrapper, or the component itself.

    +
    Offcanvas
    @@ -864,37 +204,28 @@ The animation effect of this component is dependent on the prefers-reduced

    Place offcanvas content here.

    -
    - -
    - html -
    - - -
    -
    <div class="offcanvas offcanvas-start show text-bg-dark" tabindex="-1" id="offcanvasDark" aria-labelledby="offcanvasDarkLabel">
    -  <div class="offcanvas-header">
    -    <h5 class="offcanvas-title" id="offcanvasDarkLabel">Offcanvas</h5>
    -    <button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvasDark" aria-label="Close"></button>
    -  </div>
    -  <div class="offcanvas-body">
    -    <p>Place offcanvas content here.</p>
    -  </div>
    -</div>
    -
    - -

    Responsive

    +
    html
    <div class="offcanvas offcanvas-start show text-bg-dark" tabindex="-1" id="offcanvasDark" aria-labelledby="offcanvasDarkLabel">
    +  <div class="offcanvas-header">
    +    <h5 class="offcanvas-title" id="offcanvasDarkLabel">Offcanvas</h5>
    +    <button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvasDark" aria-label="Close"></button>
    +  </div>
    +  <div class="offcanvas-body">
    +    <p>Place offcanvas content here.</p>
    +  </div>
    +</div>
    +

    Responsive

    Added in v5.2.0 - -

    Responsive offcanvas classes hide content outside the viewport from a specified breakpoint and down. Above that breakpoint, the contents within will behave as usual. For example, .offcanvas-lg hides content in an offcanvas below the lg breakpoint, but shows the content above the lg breakpoint.

    -
    -
    - - +

    Responsive offcanvas classes hide content outside the viewport from a specified breakpoint and down. Above that breakpoint, the contents within will behave as usual. For example, .offcanvas-lg hides content in an offcanvas below the lg breakpoint, but shows the content above the lg breakpoint. Responsive offcanvas classes are available for each breakpoint.

    +
      +
    • .offcanvas
    • +
    • .offcanvas-sm
    • +
    • .offcanvas-md
    • +
    • .offcanvas-lg
    • +
    • .offcanvas-xl
    • +
    • .offcanvas-xxl
    • +
    +

    To make a responsive offcanvas, replace the .offcanvas base class with a responsive variant and ensure your close button has an explicit data-bs-target.

    +
    Resize your browser to show the responsive offcanvas toggle.
    @@ -906,44 +237,21 @@ The animation effect of this component is dependent on the prefers-reduced

    This is content within an .offcanvas-lg.

    -
    +
    html
    <button class="btn btn-primary d-lg-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasResponsive" aria-controls="offcanvasResponsive">Toggle offcanvas</button>
     
    -  
    - html -
    - - -
    -
    <button class="btn btn-primary d-lg-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasResponsive" aria-controls="offcanvasResponsive">Toggle offcanvas</button>
    -
    -<div class="alert alert-info d-none d-lg-block">Resize your browser to show the responsive offcanvas toggle.</div>
    -
    -<div class="offcanvas-lg offcanvas-end" tabindex="-1" id="offcanvasResponsive" aria-labelledby="offcanvasResponsiveLabel">
    -  <div class="offcanvas-header">
    -    <h5 class="offcanvas-title" id="offcanvasResponsiveLabel">Responsive offcanvas</h5>
    -    <button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#offcanvasResponsive" aria-label="Close"></button>
    -  </div>
    -  <div class="offcanvas-body">
    -    <p class="mb-0">This is content within an <code>.offcanvas-lg</code>.</p>
    -  </div>
    -</div>
    -
    +<div class="alert alert-info d-none d-lg-block">Resize your browser to show the responsive offcanvas toggle.</div> -

    Responsive offcanvas classes are available across for each breakpoint.

    -
      -
    • .offcanvas
    • -
    • .offcanvas-sm
    • -
    • .offcanvas-md
    • -
    • .offcanvas-lg
    • -
    • .offcanvas-xl
    • -
    • .offcanvas-xxl
    • -
    -

    Placement

    -

    There’s no default placement for offcanvas components, so you must add one of the modifier classes below.

    +<div class="offcanvas-lg offcanvas-end" tabindex="-1" id="offcanvasResponsive" aria-labelledby="offcanvasResponsiveLabel"> + <div class="offcanvas-header"> + <h5 class="offcanvas-title" id="offcanvasResponsiveLabel">Responsive offcanvas</h5> + <button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#offcanvasResponsive" aria-label="Close"></button> + </div> + <div class="offcanvas-body"> + <p class="mb-0">This is content within an <code>.offcanvas-lg</code>.</p> + </div> +</div>
    +

    Placement

    +

    There’s no default placement for offcanvas components, so you must add one of the modifier classes below.

    • .offcanvas-start places offcanvas on the left of the viewport (shown above)
    • .offcanvas-end places offcanvas on the right of the viewport
    • @@ -951,10 +259,7 @@ The animation effect of this component is dependent on the prefers-reduced
    • .offcanvas-bottom places offcanvas on the bottom of the viewport

    Try the top, right, and bottom examples out below.

    -
    -
    - - +
    @@ -964,35 +269,18 @@ The animation effect of this component is dependent on the prefers-reduced
    ...
    -
    +
    html
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasTop" aria-controls="offcanvasTop">Toggle top offcanvas</button>
     
    -  
    - html -
    - - -
    -
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasTop" aria-controls="offcanvasTop">Toggle top offcanvas</button>
    -
    -<div class="offcanvas offcanvas-top" tabindex="-1" id="offcanvasTop" aria-labelledby="offcanvasTopLabel">
    -  <div class="offcanvas-header">
    -    <h5 class="offcanvas-title" id="offcanvasTopLabel">Offcanvas top</h5>
    -    <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    -  </div>
    -  <div class="offcanvas-body">
    -    ...
    -  </div>
    -</div>
    -
    - -
    -
    - - +<div class="offcanvas offcanvas-top" tabindex="-1" id="offcanvasTop" aria-labelledby="offcanvasTopLabel"> + <div class="offcanvas-header"> + <h5 class="offcanvas-title" id="offcanvasTopLabel">Offcanvas top</h5> + <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button> + </div> + <div class="offcanvas-body"> + ... + </div> +</div>
    +
    @@ -1002,35 +290,18 @@ The animation effect of this component is dependent on the prefers-reduced
    ...
    -
    +
    html
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasRight" aria-controls="offcanvasRight">Toggle right offcanvas</button>
     
    -  
    - html -
    - - -
    -
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasRight" aria-controls="offcanvasRight">Toggle right offcanvas</button>
    -
    -<div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasRight" aria-labelledby="offcanvasRightLabel">
    -  <div class="offcanvas-header">
    -    <h5 class="offcanvas-title" id="offcanvasRightLabel">Offcanvas right</h5>
    -    <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    -  </div>
    -  <div class="offcanvas-body">
    -    ...
    -  </div>
    -</div>
    -
    - -
    -
    - - +<div class="offcanvas offcanvas-end" tabindex="-1" id="offcanvasRight" aria-labelledby="offcanvasRightLabel"> + <div class="offcanvas-header"> + <h5 class="offcanvas-title" id="offcanvasRightLabel">Offcanvas right</h5> + <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button> + </div> + <div class="offcanvas-body"> + ... + </div> +</div>
    +
    @@ -1040,82 +311,52 @@ The animation effect of this component is dependent on the prefers-reduced
    ...
    -
    +
    html
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasBottom" aria-controls="offcanvasBottom">Toggle bottom offcanvas</button>
     
    -  
    - html -
    - - -
    -
    <button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasBottom" aria-controls="offcanvasBottom">Toggle bottom offcanvas</button>
    -
    -<div class="offcanvas offcanvas-bottom" tabindex="-1" id="offcanvasBottom" aria-labelledby="offcanvasBottomLabel">
    -  <div class="offcanvas-header">
    -    <h5 class="offcanvas-title" id="offcanvasBottomLabel">Offcanvas bottom</h5>
    -    <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    -  </div>
    -  <div class="offcanvas-body small">
    -    ...
    -  </div>
    -</div>
    -
    - -

    Accessibility

    +<div class="offcanvas offcanvas-bottom" tabindex="-1" id="offcanvasBottom" aria-labelledby="offcanvasBottomLabel"> + <div class="offcanvas-header"> + <h5 class="offcanvas-title" id="offcanvasBottomLabel">Offcanvas bottom</h5> + <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button> + </div> + <div class="offcanvas-body small"> + ... + </div> +</div>
    +

    Accessibility

    Since the offcanvas panel is conceptually a modal dialog, be sure to add aria-labelledby="..."—referencing the offcanvas title—to .offcanvas. Note that you don’t need to add role="dialog" since we already add it via JavaScript.

    -

    CSS

    -

    Variables

    +

    CSS

    +

    Variables

    Added in v5.2.0 - -

    As part of Bootstrap’s evolving CSS variables approach, offcanvas now uses local CSS variables on .offcanvas for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    -
    -
    - scss/_offcanvas.scss -
    - -
    -
    --#{$prefix}offcanvas-zindex: #{$zindex-offcanvas};
    ---#{$prefix}offcanvas-width: #{$offcanvas-horizontal-width};
    ---#{$prefix}offcanvas-height: #{$offcanvas-vertical-height};
    ---#{$prefix}offcanvas-padding-x: #{$offcanvas-padding-x};
    ---#{$prefix}offcanvas-padding-y: #{$offcanvas-padding-y};
    ---#{$prefix}offcanvas-color: #{$offcanvas-color};
    ---#{$prefix}offcanvas-bg: #{$offcanvas-bg-color};
    ---#{$prefix}offcanvas-border-width: #{$offcanvas-border-width};
    ---#{$prefix}offcanvas-border-color: #{$offcanvas-border-color};
    ---#{$prefix}offcanvas-box-shadow: #{$offcanvas-box-shadow};
    ---#{$prefix}offcanvas-transition: #{transform $offcanvas-transition-duration ease-in-out};
    ---#{$prefix}offcanvas-title-line-height: #{$offcanvas-title-line-height};
    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $offcanvas-padding-y:               $modal-inner-padding;
    -$offcanvas-padding-x:               $modal-inner-padding;
    -$offcanvas-horizontal-width:        400px;
    -$offcanvas-vertical-height:         30vh;
    -$offcanvas-transition-duration:     .3s;
    -$offcanvas-border-color:            $modal-content-border-color;
    -$offcanvas-border-width:            $modal-content-border-width;
    -$offcanvas-title-line-height:       $modal-title-line-height;
    -$offcanvas-bg-color:                var(--#{$prefix}body-bg);
    -$offcanvas-color:                   var(--#{$prefix}body-color);
    -$offcanvas-box-shadow:              $modal-content-box-shadow-xs;
    -$offcanvas-backdrop-bg:             $modal-backdrop-bg;
    -$offcanvas-backdrop-opacity:        $modal-backdrop-opacity;
    -
    -

    Usage

    +

    As part of Bootstrap’s evolving CSS variables approach, offcanvas now uses local CSS variables on .offcanvas for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    +
    --#{$prefix}offcanvas-zindex: #{$zindex-offcanvas};
    +--#{$prefix}offcanvas-width: #{$offcanvas-horizontal-width};
    +--#{$prefix}offcanvas-height: #{$offcanvas-vertical-height};
    +--#{$prefix}offcanvas-padding-x: #{$offcanvas-padding-x};
    +--#{$prefix}offcanvas-padding-y: #{$offcanvas-padding-y};
    +--#{$prefix}offcanvas-color: #{$offcanvas-color};
    +--#{$prefix}offcanvas-bg: #{$offcanvas-bg-color};
    +--#{$prefix}offcanvas-border-width: #{$offcanvas-border-width};
    +--#{$prefix}offcanvas-border-color: #{$offcanvas-border-color};
    +--#{$prefix}offcanvas-box-shadow: #{$offcanvas-box-shadow};
    +--#{$prefix}offcanvas-transition: #{transform $offcanvas-transition-duration ease-in-out};
    +--#{$prefix}offcanvas-title-line-height: #{$offcanvas-title-line-height};
    +
    +

    Sass variables

    +
    $offcanvas-padding-y:               $modal-inner-padding;
    +$offcanvas-padding-x:               $modal-inner-padding;
    +$offcanvas-horizontal-width:        400px;
    +$offcanvas-vertical-height:         30vh;
    +$offcanvas-transition-duration:     .3s;
    +$offcanvas-border-color:            $modal-content-border-color;
    +$offcanvas-border-width:            $modal-content-border-width;
    +$offcanvas-title-line-height:       $modal-title-line-height;
    +$offcanvas-bg-color:                var(--#{$prefix}body-bg);
    +$offcanvas-color:                   var(--#{$prefix}body-color);
    +$offcanvas-box-shadow:              $modal-content-box-shadow-xs;
    +$offcanvas-backdrop-bg:             $modal-backdrop-bg;
    +$offcanvas-backdrop-opacity:        $modal-backdrop-opacity;
    +
    +

    Usage

    The offcanvas plugin utilizes a few classes and attributes to handle the heavy lifting:

    • .offcanvas hides the content
    • @@ -1126,212 +367,133 @@ The animation effect of this component is dependent on the prefers-reduced
    • .offcanvas-bottom hides the offcanvas on the bottom

    Add a dismiss button with the data-bs-dismiss="offcanvas" attribute, which triggers the JavaScript functionality. Be sure to use the <button> element with it for proper behavior across all devices.

    -

    Via data attributes

    -

    Toggle

    -

    Add data-bs-toggle="offcanvas" and a data-bs-target or href to the element to automatically assign control of one offcanvas element. The data-bs-target attribute accepts a CSS selector to apply the offcanvas to. Be sure to add the class offcanvas to the offcanvas element. If you’d like it to default open, add the additional class show.

    -

    Dismiss

    -

    Dismissal can be achieved with the data-bs-dismiss attribute on a button within the offcanvas as demonstrated below:

    -
    <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
    -

    or on a button outside the offcanvas using the additional data-bs-target as demonstrated below:

    -
    <button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#my-offcanvas" aria-label="Close"></button>
    -
    -While both ways to dismiss an offcanvas are supported, keep in mind that dismissing from outside an offcanvas does not match the ARIA Authoring Practices Guide dialog (modal) pattern. Do this at your own risk. -
    - -

    Via JavaScript

    +

    Via data attributes

    +

    Toggle

    +

    Add data-bs-toggle="offcanvas" and a data-bs-target or href to the element to automatically assign control of one offcanvas element. The data-bs-target attribute accepts a CSS selector to apply the offcanvas to. Be sure to add the class offcanvas to the offcanvas element. If you’d like it to default open, add the additional class show.

    +

    Dismiss

    +

    +Dismissal can be achieved with the data-bs-dismiss attribute on a button within the offcanvas as demonstrated below: +

    <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>

    +or on a button outside the offcanvas using the additional data-bs-target as demonstrated below: +

    <button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#my-offcanvas" aria-label="Close"></button>
    +

    While both ways to dismiss an offcanvas are supported, keep in mind that dismissing from outside an offcanvas does not match the ARIA Authoring Practices Guide dialog (modal) pattern. Do this at your own risk.

    +

    Via JavaScript

    Enable manually with:

    -
    const offcanvasElementList = document.querySelectorAll('.offcanvas')
    -const offcanvasList = [...offcanvasElementList].map(offcanvasEl => new bootstrap.Offcanvas(offcanvasEl))
    -

    Options

    -

    As options can be passed via data attributes or JavaScript, you can append an option name to data-bs-, as in data-bs-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-bs-custom-class="beautifier" instead of data-bs-customClass="beautifier".

    -

    As of Bootstrap 5.2.0, all components support an experimental reserved data attribute data-bs-config that can house simple component configuration as a JSON string. When an element has data-bs-config='{"delay":0, "title":123}' and data-bs-title="456" attributes, the final title value will be 456 and the separate data attributes will override values given on data-bs-config. In addition, existing data attributes are able to house JSON values like data-bs-delay='{"show":0,"hide":150}'.

    +
    const offcanvasElementList = document.querySelectorAll('.offcanvas')
    +const offcanvasList = [...offcanvasElementList].map(offcanvasEl => new bootstrap.Offcanvas(offcanvasEl))
    +
    +

    Options

    +

    As options can be passed via data attributes or JavaScript, you can append an option name to data-bs-, as in data-bs-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-bs-custom-class="beautifier" instead of data-bs-customClass="beautifier".

    +

    As of Bootstrap 5.2.0, all components support an experimental reserved data attribute data-bs-config that can house simple component configuration as a JSON string. When an element has data-bs-config='{"delay":0, "title":123}' and data-bs-title="456" attributes, the final title value will be 456 and the separate data attributes will override values given on data-bs-config. In addition, existing data attributes are able to house JSON values like data-bs-delay='{"show":0,"hide":150}'.

    The final configuration object is the merged result of data-bs-config, data-bs-, and js object where the latest given key-value overrides the others.

    +
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDefaultDescription
    backdropboolean or the string statictrueApply a backdrop on body while offcanvas is open. Alternatively, specify static for a backdrop which doesn’t close the offcanvas when clicked.
    keyboardbooleantrueCloses the offcanvas when escape key is pressed.
    scrollbooleanfalseAllow body scrolling while offcanvas is open.
    -

    Methods

    -
    -All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started, but before it ends. In addition, a method call on a transitioning component will be ignored. Learn more in our JavaScript docs. -
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDefaultDescription
    backdropboolean or the string statictrueApply a backdrop on body while offcanvas is open. Alternatively, specify static for a backdrop which doesn’t close the offcanvas when clicked.
    keyboardbooleantrueCloses the offcanvas when escape key is pressed.
    scrollbooleanfalseAllow body scrolling while offcanvas is open.
    +

    Methods

    +

    All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started, but before it ends. In addition, a method call on a transitioning component will be ignored. Learn more in our JavaScript docs.

    Activates your content as an offcanvas element. Accepts an optional options object.

    You can create an offcanvas instance with the constructor, for example:

    -
    const bsOffcanvas = new bootstrap.Offcanvas('#myOffcanvas')
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    MethodDescription
    disposeDestroys an element’s offcanvas.
    getInstanceStatic method which allows you to get the offcanvas instance associated with a DOM element.
    getOrCreateInstanceStatic method which allows you to get the offcanvas instance associated with a DOM element, or create a new one in case it wasn’t initialized.
    hideHides an offcanvas element. Returns to the caller before the offcanvas element has actually been hidden (i.e. before the hidden.bs.offcanvas event occurs).
    showShows an offcanvas element. Returns to the caller before the offcanvas element has actually been shown (i.e. before the shown.bs.offcanvas event occurs).
    toggleToggles an offcanvas element to shown or hidden. Returns to the caller before the offcanvas element has actually been shown or hidden (i.e. before the shown.bs.offcanvas or hidden.bs.offcanvas event occurs).
    - -

    Events

    -

    Bootstrap’s offcanvas class exposes a few events for hooking into offcanvas functionality.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Event typeDescription
    hide.bs.offcanvasThis event is fired immediately when the hide method has been called.
    hidden.bs.offcanvasThis event is fired when an offcanvas element has been hidden from the user (will wait for CSS transitions to complete).
    hidePrevented.bs.offcanvasThis event is fired when the offcanvas is shown, its backdrop is static and a click outside of the offcanvas is performed. The event is also fired when the escape key is pressed and the keyboard option is set to false.
    show.bs.offcanvasThis event fires immediately when the show instance method is called.
    shown.bs.offcanvasThis event is fired when an offcanvas element has been made visible to the user (will wait for CSS transitions to complete).
    - -
    const myOffcanvas = document.getElementById('myOffcanvas')
    -myOffcanvas.addEventListener('hidden.bs.offcanvas', event => {
    -  // do something...
    -})
    -
    - - - +
    const bsOffcanvas = new bootstrap.Offcanvas('#myOffcanvas')
    +
    +
    - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MethodDescription
    disposeDestroys an element’s offcanvas.
    getInstanceStatic method which allows you to get the offcanvas instance associated with a DOM element.
    getOrCreateInstanceStatic method which allows you to get the offcanvas instance associated with a DOM element, or create a new one in case it wasn’t initialized.
    hideHides an offcanvas element. Returns to the caller before the offcanvas element has actually been hidden (i.e. before the hidden.bs.offcanvas event occurs).
    showShows an offcanvas element. Returns to the caller before the offcanvas element has actually been shown (i.e. before the shown.bs.offcanvas event occurs).
    toggleToggles an offcanvas element to shown or hidden. Returns to the caller before the offcanvas element has actually been shown or hidden (i.e. before the shown.bs.offcanvas or hidden.bs.offcanvas event occurs).
    +

    Events

    +

    Bootstrap’s offcanvas class exposes a few events for hooking into offcanvas functionality.

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Event typeDescription
    hide.bs.offcanvasThis event is fired immediately when the hide method has been called.
    hidden.bs.offcanvasThis event is fired when an offcanvas element has been hidden from the user (will wait for CSS transitions to complete).
    hidePrevented.bs.offcanvasThis event is fired when the offcanvas is shown, its backdrop is static and a click outside of the offcanvas is performed. The event is also fired when the escape key is pressed and the keyboard option is set to false.
    show.bs.offcanvasThis event fires immediately when the show instance method is called.
    shown.bs.offcanvasThis event is fired when an offcanvas element has been made visible to the user (will wait for CSS transitions to complete).
    +
    const myOffcanvas = document.getElementById('myOffcanvas')
    +myOffcanvas.addEventListener('hidden.bs.offcanvas', event => {
    +  // do something...
    +})
    +
    \ No newline at end of file diff --git a/docs/5.3/components/pagination/index.html b/docs/5.3/components/pagination/index.html index 308149f8d7..c9f0793823 100644 --- a/docs/5.3/components/pagination/index.html +++ b/docs/5.3/components/pagination/index.html @@ -1,577 +1,30 @@ - - - - - - - - - - - - - - - - -Pagination · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Pagination

    -
    -

    Documentation and examples for showing pagination to indicate a series of related content exists across multiple pages.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Overview

    + Pagination · Bootstrap v5.3

    Pagination

    Documentation and examples for showing pagination to indicate a series of related content exists across multiple pages.

    +

    Overview

    We use a large block of connected links for our pagination, making links hard to miss and easily scalable—all while providing large hit areas. Pagination is built with list HTML elements so screen readers can announce the number of available links. Use a wrapping <nav> element to identify it as a navigation section to screen readers and other assistive technologies.

    -

    In addition, as pages likely have more than one such navigation section, it’s advisable to provide a descriptive aria-label for the <nav> to reflect its purpose. For example, if the pagination component is used to navigate between a set of search results, an appropriate label could be aria-label="Search results pages".

    -
    -
    - -
    html
    <nav aria-label="Page navigation example">
    +  <ul class="pagination">
    +    <li class="page-item"><a class="page-link" href="#">Previous</a></li>
    +    <li class="page-item"><a class="page-link" href="#">1</a></li>
    +    <li class="page-item"><a class="page-link" href="#">2</a></li>
    +    <li class="page-item"><a class="page-link" href="#">3</a></li>
    +    <li class="page-item"><a class="page-link" href="#">Next</a></li>
    +  </ul>
    +</nav>
    +

    Working with icons

    Looking to use an icon or symbol in place of text for some pagination links? Be sure to provide proper screen reader support with aria attributes.

    -
    -
    - -
    html
    <nav aria-label="Page navigation example">
    +  <ul class="pagination">
    +    <li class="page-item">
    +      <a class="page-link" href="#" aria-label="Previous">
    +        <span aria-hidden="true">&laquo;</span>
    +      </a>
    +    </li>
    +    <li class="page-item"><a class="page-link" href="#">1</a></li>
    +    <li class="page-item"><a class="page-link" href="#">2</a></li>
    +    <li class="page-item"><a class="page-link" href="#">3</a></li>
    +    <li class="page-item">
    +      <a class="page-link" href="#" aria-label="Next">
    +        <span aria-hidden="true">&raquo;</span>
    +      </a>
    +    </li>
    +  </ul>
    +</nav>
    +

    Disabled and active states

    Pagination links are customizable for different circumstances. Use .disabled for links that appear un-clickable and .active to indicate the current page.

    -

    While the .disabled class uses pointer-events: none to try to disable the link functionality of <a>s, that CSS property is not yet standardized and doesn’t account for keyboard navigation. As such, you should always add tabindex="-1" on disabled links and use custom JavaScript to fully disable their functionality.

    -
    -
    - -
    html
    <nav aria-label="...">
    +  <ul class="pagination">
    +    <li class="page-item disabled">
    +      <a class="page-link">Previous</a>
    +    </li>
    +    <li class="page-item"><a class="page-link" href="#">1</a></li>
    +    <li class="page-item active" aria-current="page">
    +      <a class="page-link" href="#">2</a>
    +    </li>
    +    <li class="page-item"><a class="page-link" href="#">3</a></li>
    +    <li class="page-item">
    +      <a class="page-link" href="#">Next</a>
    +    </li>
    +  </ul>
    +</nav>

    You can optionally swap out active or disabled anchors for <span>, or omit the anchor in the case of the prev/next arrows, to remove click functionality and prevent keyboard focus while retaining intended styles.

    -
    -
    - -
    html
    <nav aria-label="...">
    +  <ul class="pagination">
    +    <li class="page-item disabled">
    +      <span class="page-link">Previous</span>
    +    </li>
    +    <li class="page-item"><a class="page-link" href="#">1</a></li>
    +    <li class="page-item active" aria-current="page">
    +      <span class="page-link">2</span>
    +    </li>
    +    <li class="page-item"><a class="page-link" href="#">3</a></li>
    +    <li class="page-item">
    +      <a class="page-link" href="#">Next</a>
    +    </li>
    +  </ul>
    +</nav>
    +

    Sizing

    Fancy larger or smaller pagination? Add .pagination-lg or .pagination-sm for additional sizes.

    -
    -
    - -
    html
    <nav aria-label="Page navigation example">
    +  <ul class="pagination justify-content-center">
    +    <li class="page-item disabled">
    +      <a class="page-link">Previous</a>
    +    </li>
    +    <li class="page-item"><a class="page-link" href="#">1</a></li>
    +    <li class="page-item"><a class="page-link" href="#">2</a></li>
    +    <li class="page-item"><a class="page-link" href="#">3</a></li>
    +    <li class="page-item">
    +      <a class="page-link" href="#">Next</a>
    +    </li>
    +  </ul>
    +</nav>

    Or with .justify-content-end:

    -
    -
    - -
    html
    <nav aria-label="Page navigation example">
    +  <ul class="pagination justify-content-end">
    +    <li class="page-item disabled">
    +      <a class="page-link">Previous</a>
    +    </li>
    +    <li class="page-item"><a class="page-link" href="#">1</a></li>
    +    <li class="page-item"><a class="page-link" href="#">2</a></li>
    +    <li class="page-item"><a class="page-link" href="#">3</a></li>
    +    <li class="page-item">
    +      <a class="page-link" href="#">Next</a>
    +    </li>
    +  </ul>
    +</nav>
    +

    CSS

    +

    Variables

    Added in v5.2.0 +

    As part of Bootstrap’s evolving CSS variables approach, pagination now uses local CSS variables on .pagination for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    +
    --#{$prefix}pagination-padding-x: #{$pagination-padding-x};
    +--#{$prefix}pagination-padding-y: #{$pagination-padding-y};
    +@include rfs($pagination-font-size, --#{$prefix}pagination-font-size);
    +--#{$prefix}pagination-color: #{$pagination-color};
    +--#{$prefix}pagination-bg: #{$pagination-bg};
    +--#{$prefix}pagination-border-width: #{$pagination-border-width};
    +--#{$prefix}pagination-border-color: #{$pagination-border-color};
    +--#{$prefix}pagination-border-radius: #{$pagination-border-radius};
    +--#{$prefix}pagination-hover-color: #{$pagination-hover-color};
    +--#{$prefix}pagination-hover-bg: #{$pagination-hover-bg};
    +--#{$prefix}pagination-hover-border-color: #{$pagination-hover-border-color};
    +--#{$prefix}pagination-focus-color: #{$pagination-focus-color};
    +--#{$prefix}pagination-focus-bg: #{$pagination-focus-bg};
    +--#{$prefix}pagination-focus-box-shadow: #{$pagination-focus-box-shadow};
    +--#{$prefix}pagination-active-color: #{$pagination-active-color};
    +--#{$prefix}pagination-active-bg: #{$pagination-active-bg};
    +--#{$prefix}pagination-active-border-color: #{$pagination-active-border-color};
    +--#{$prefix}pagination-disabled-color: #{$pagination-disabled-color};
    +--#{$prefix}pagination-disabled-bg: #{$pagination-disabled-bg};
    +--#{$prefix}pagination-disabled-border-color: #{$pagination-disabled-border-color};
    +
    +

    Sass variables

    +
    $pagination-padding-y:              .375rem;
    +$pagination-padding-x:              .75rem;
    +$pagination-padding-y-sm:           .25rem;
    +$pagination-padding-x-sm:           .5rem;
    +$pagination-padding-y-lg:           .75rem;
    +$pagination-padding-x-lg:           1.5rem;
     
    -

    As part of Bootstrap’s evolving CSS variables approach, pagination now uses local CSS variables on .pagination for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    -
    -
    - scss/_pagination.scss -
    - -
    -
    --#{$prefix}pagination-padding-x: #{$pagination-padding-x};
    ---#{$prefix}pagination-padding-y: #{$pagination-padding-y};
    -@include rfs($pagination-font-size, --#{$prefix}pagination-font-size);
    ---#{$prefix}pagination-color: #{$pagination-color};
    ---#{$prefix}pagination-bg: #{$pagination-bg};
    ---#{$prefix}pagination-border-width: #{$pagination-border-width};
    ---#{$prefix}pagination-border-color: #{$pagination-border-color};
    ---#{$prefix}pagination-border-radius: #{$pagination-border-radius};
    ---#{$prefix}pagination-hover-color: #{$pagination-hover-color};
    ---#{$prefix}pagination-hover-bg: #{$pagination-hover-bg};
    ---#{$prefix}pagination-hover-border-color: #{$pagination-hover-border-color};
    ---#{$prefix}pagination-focus-color: #{$pagination-focus-color};
    ---#{$prefix}pagination-focus-bg: #{$pagination-focus-bg};
    ---#{$prefix}pagination-focus-box-shadow: #{$pagination-focus-box-shadow};
    ---#{$prefix}pagination-active-color: #{$pagination-active-color};
    ---#{$prefix}pagination-active-bg: #{$pagination-active-bg};
    ---#{$prefix}pagination-active-border-color: #{$pagination-active-border-color};
    ---#{$prefix}pagination-disabled-color: #{$pagination-disabled-color};
    ---#{$prefix}pagination-disabled-bg: #{$pagination-disabled-bg};
    ---#{$prefix}pagination-disabled-border-color: #{$pagination-disabled-border-color};
    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $pagination-padding-y:              .375rem;
    -$pagination-padding-x:              .75rem;
    -$pagination-padding-y-sm:           .25rem;
    -$pagination-padding-x-sm:           .5rem;
    -$pagination-padding-y-lg:           .75rem;
    -$pagination-padding-x-lg:           1.5rem;
    -
    -$pagination-font-size:              $font-size-base;
    -
    -$pagination-color:                  var(--#{$prefix}link-color);
    -$pagination-bg:                     var(--#{$prefix}body-bg);
    -$pagination-border-radius:          var(--#{$prefix}border-radius);
    -$pagination-border-width:           var(--#{$prefix}border-width);
    -$pagination-margin-start:           calc(-1 * #{$pagination-border-width}); // stylelint-disable-line function-disallowed-list
    -$pagination-border-color:           var(--#{$prefix}border-color);
    -
    -$pagination-focus-color:            var(--#{$prefix}link-hover-color);
    -$pagination-focus-bg:               var(--#{$prefix}secondary-bg);
    -$pagination-focus-box-shadow:       $focus-ring-box-shadow;
    -$pagination-focus-outline:          0;
    -
    -$pagination-hover-color:            var(--#{$prefix}link-hover-color);
    -$pagination-hover-bg:               var(--#{$prefix}tertiary-bg);
    -$pagination-hover-border-color:     var(--#{$prefix}border-color); // Todo in v6: remove this?
    -
    -$pagination-active-color:           $component-active-color;
    -$pagination-active-bg:              $component-active-bg;
    -$pagination-active-border-color:    $component-active-bg;
    -
    -$pagination-disabled-color:         var(--#{$prefix}secondary-color);
    -$pagination-disabled-bg:            var(--#{$prefix}secondary-bg);
    -$pagination-disabled-border-color:  var(--#{$prefix}border-color);
    -
    -$pagination-transition:              color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    -
    -$pagination-border-radius-sm:       var(--#{$prefix}border-radius-sm);
    -$pagination-border-radius-lg:       var(--#{$prefix}border-radius-lg);
    -
    -

    Sass mixins

    -
    -
    @mixin pagination-size($padding-y, $padding-x, $font-size, $border-radius) {
    -  --#{$prefix}pagination-padding-x: #{$padding-x};
    -  --#{$prefix}pagination-padding-y: #{$padding-y};
    -  @include rfs($font-size, --#{$prefix}pagination-font-size);
    -  --#{$prefix}pagination-border-radius: #{$border-radius};
    -}
    -
    +$pagination-font-size: $font-size-base; -
    -
    -
    +$pagination-color: var(--#{$prefix}link-color); +$pagination-bg: var(--#{$prefix}body-bg); +$pagination-border-radius: var(--#{$prefix}border-radius); +$pagination-border-width: var(--#{$prefix}border-width); +$pagination-margin-start: calc(-1 * #{$pagination-border-width}); // stylelint-disable-line function-disallowed-list +$pagination-border-color: var(--#{$prefix}border-color); +$pagination-focus-color: var(--#{$prefix}link-hover-color); +$pagination-focus-bg: var(--#{$prefix}secondary-bg); +$pagination-focus-box-shadow: $focus-ring-box-shadow; +$pagination-focus-outline: 0; - +$pagination-hover-color: var(--#{$prefix}link-hover-color); +$pagination-hover-bg: var(--#{$prefix}tertiary-bg); +$pagination-hover-border-color: var(--#{$prefix}border-color); // Todo in v6: remove this? - +$pagination-active-color: $component-active-color; +$pagination-active-bg: $component-active-bg; +$pagination-active-border-color: $component-active-bg; - - - +$pagination-disabled-color: var(--#{$prefix}secondary-color); +$pagination-disabled-bg: var(--#{$prefix}secondary-bg); +$pagination-disabled-border-color: var(--#{$prefix}border-color); - - +$pagination-transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out; - - +$pagination-border-radius-sm: var(--#{$prefix}border-radius-sm); +$pagination-border-radius-lg: var(--#{$prefix}border-radius-lg); +
    +

    Sass mixins

    +
    @mixin pagination-size($padding-y, $padding-x, $font-size, $border-radius) {
    +  --#{$prefix}pagination-padding-x: #{$padding-x};
    +  --#{$prefix}pagination-padding-y: #{$padding-y};
    +  @include rfs($font-size, --#{$prefix}pagination-font-size);
    +  --#{$prefix}pagination-border-radius: #{$border-radius};
    +}
    +
    \ No newline at end of file diff --git a/docs/5.3/components/placeholders/index.html b/docs/5.3/components/placeholders/index.html index 4a523ad9fa..980389fffc 100644 --- a/docs/5.3/components/placeholders/index.html +++ b/docs/5.3/components/placeholders/index.html @@ -1,588 +1,40 @@ - - - - - - - - - - - - - - - - -Placeholders · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    -
    Added in v5.1 - View on GitHub - -
    -

    Placeholders

    -
    -

    Use loading placeholders for your components or pages to indicate something may still be loading.

    - - -
    - - -
    - - On this page -
    -
    - -
    -
    - - -
    - - -

    About

    -

    Placeholders can be used to enhance the experience of your application. They’re built only with HTML and CSS, meaning you don’t need any JavaScript to create them. You will, however, need some custom JavaScript to toggle their visibility. Their appearance, color, and sizing can be easily customized with our utility classes.

    -

    Example

    -

    In the example below, we take a typical card component and recreate it with placeholders applied to create a “loading card”. Size and proportions are the same between the two.

    -
    -
    - Placeholder + Placeholders · Bootstrap v5.3
    +Added in v5.1 +View on GitHub +

    Placeholders

    Use loading placeholders (skeleton loaders) for your components or pages to indicate something may still be loading.

    +

    About

    +

    Placeholders can be used to enhance the experience of your application. They’re built only with HTML and CSS, meaning you don’t need any JavaScript to create them. You will, however, need some custom JavaScript to toggle their visibility. Their appearance, color, and sizing can be easily customized with our utility classes.

    +

    Example

    +

    In the example below, we take a typical card component and recreate it with placeholders applied to create a “loading card”. Size and proportions are the same between the two.

    +
    + Placeholder
    Card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Go somewhere
    + -
    <div class="card">
    -  <img src="..." class="card-img-top" alt="...">
    -
    -  <div class="card-body">
    -    <h5 class="card-title">Card title</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -    <a href="#" class="btn btn-primary">Go somewhere</a>
    -  </div>
    -</div>
    -
    -<div class="card" aria-hidden="true">
    -  <img src="..." class="card-img-top" alt="...">
    -  <div class="card-body">
    -    <h5 class="card-title placeholder-glow">
    -      <span class="placeholder col-6"></span>
    -    </h5>
    -    <p class="card-text placeholder-glow">
    -      <span class="placeholder col-7"></span>
    -      <span class="placeholder col-4"></span>
    -      <span class="placeholder col-4"></span>
    -      <span class="placeholder col-6"></span>
    -      <span class="placeholder col-8"></span>
    -    </p>
    -    <a class="btn btn-primary disabled placeholder col-6" aria-disabled="true"></a>
    -  </div>
    -</div>
    -

    How it works

    +
    +
    <div class="card">
    +  <img src="..." class="card-img-top" alt="...">
    +
    +  <div class="card-body">
    +    <h5 class="card-title">Card title</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +    <a href="#" class="btn btn-primary">Go somewhere</a>
    +  </div>
    +</div>
    +
    +<div class="card" aria-hidden="true">
    +  <img src="..." class="card-img-top" alt="...">
    +  <div class="card-body">
    +    <h5 class="card-title placeholder-glow">
    +      <span class="placeholder col-6"></span>
    +    </h5>
    +    <p class="card-text placeholder-glow">
    +      <span class="placeholder col-7"></span>
    +      <span class="placeholder col-4"></span>
    +      <span class="placeholder col-4"></span>
    +      <span class="placeholder col-6"></span>
    +      <span class="placeholder col-8"></span>
    +    </p>
    +    <a class="btn btn-primary disabled placeholder col-6" aria-disabled="true"></a>
    +  </div>
    +</div>
    +
    +

    How it works

    Create placeholders with the .placeholder class and a grid column class (e.g., .col-6) to set the width. They can replace the text inside an element or be added as a modifier class to an existing component.

    We apply additional styling to .btns via ::before to ensure the height is respected. You may extend this pattern for other situations as needed, or add a &nbsp; within the element to reflect the height when actual text is rendered in its place.

    -
    -
    - -
    - +
    html
    <p aria-hidden="true">
    +  <span class="placeholder col-6"></span>
    +</p>
     
    -  
    - html -
    - - -
    -
    <p aria-hidden="true">
    -  <span class="placeholder col-6"></span>
    -</p>
    -
    -<a class="btn btn-primary disabled placeholder col-4" aria-disabled="true"></a>
    -
    - -
    -The use of aria-hidden="true" only indicates that the element should be hidden to screen readers. The loading behavior of the placeholder depends on how authors will actually use the placeholder styles, how they plan to update things, etc. Some JavaScript code may be needed to swap the state of the placeholder and inform AT users of the update. -
    - -

    Width

    +<a class="btn btn-primary disabled placeholder col-4" aria-disabled="true"></a>
    +

    The use of aria-hidden="true" only indicates that the element should be hidden to screen readers. The loading behavior of the placeholder depends on how authors will actually use the placeholder styles, how they plan to update things, etc. Some JavaScript code may be needed to swap the state of the placeholder and inform AT users of the update.

    +

    Width

    You can change the width through grid column classes, width utilities, or inline styles.

    -
    -
    - - +
    - - -
    - html -
    - - -
    -
    <span class="placeholder col-6"></span>
    -<span class="placeholder w-75"></span>
    -<span class="placeholder" style="width: 25%;"></span>
    -
    - -

    Color

    +
    html
    <span class="placeholder col-6"></span>
    +<span class="placeholder w-75"></span>
    +<span class="placeholder" style="width: 25%;"></span>
    +

    Color

    By default, the placeholder uses currentColor. This can be overridden with a custom color or utility class.

    -
    -
    - - +
    @@ -695,175 +107,46 @@ The use of aria-hidden="true" only indicates that the ele - +
    html
    <span class="placeholder col-12"></span>
     
    -  
    - html -
    - - -
    -
    <span class="placeholder col-12"></span>
    -
    -<span class="placeholder col-12 bg-primary"></span>
    -<span class="placeholder col-12 bg-secondary"></span>
    -<span class="placeholder col-12 bg-success"></span>
    -<span class="placeholder col-12 bg-danger"></span>
    -<span class="placeholder col-12 bg-warning"></span>
    -<span class="placeholder col-12 bg-info"></span>
    -<span class="placeholder col-12 bg-light"></span>
    -<span class="placeholder col-12 bg-dark"></span>
    -
    - -

    Sizing

    +<span class="placeholder col-12 bg-primary"></span> +<span class="placeholder col-12 bg-secondary"></span> +<span class="placeholder col-12 bg-success"></span> +<span class="placeholder col-12 bg-danger"></span> +<span class="placeholder col-12 bg-warning"></span> +<span class="placeholder col-12 bg-info"></span> +<span class="placeholder col-12 bg-light"></span> +<span class="placeholder col-12 bg-dark"></span>
    +

    Sizing

    The size of .placeholders are based on the typographic style of the parent element. Customize them with sizing modifiers: .placeholder-lg, .placeholder-sm, or .placeholder-xs.

    -
    -
    - - +
    - - -
    - html -
    - - -
    -
    <span class="placeholder col-12 placeholder-lg"></span>
    -<span class="placeholder col-12"></span>
    -<span class="placeholder col-12 placeholder-sm"></span>
    -<span class="placeholder col-12 placeholder-xs"></span>
    -
    - -

    Animation

    +
    html
    <span class="placeholder col-12 placeholder-lg"></span>
    +<span class="placeholder col-12"></span>
    +<span class="placeholder col-12 placeholder-sm"></span>
    +<span class="placeholder col-12 placeholder-xs"></span>
    +

    Animation

    Animate placeholders with .placeholder-glow or .placeholder-wave to better convey the perception of something being actively loaded.

    -
    -
    - -

    +

    -

    +

    html
    <p class="placeholder-glow">
    +  <span class="placeholder col-12"></span>
    +</p>
     
    -  
    - html -
    - - -
    -
    <p class="placeholder-glow">
    -  <span class="placeholder col-12"></span>
    -</p>
    -
    -<p class="placeholder-wave">
    -  <span class="placeholder col-12"></span>
    -</p>
    -
    - -

    CSS

    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $placeholder-opacity-max:           .5;
    -$placeholder-opacity-min:           .2;
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - +<p class="placeholder-wave"> + <span class="placeholder col-12"></span> +</p>
    +

    CSS

    +

    Sass variables

    +
    $placeholder-opacity-max:           .5;
    +$placeholder-opacity-min:           .2;
    +
    \ No newline at end of file diff --git a/docs/5.3/components/popovers/index.html b/docs/5.3/components/popovers/index.html index 22d4c00026..44b973801d 100644 --- a/docs/5.3/components/popovers/index.html +++ b/docs/5.3/components/popovers/index.html @@ -1,645 +1,56 @@ - - - - - - - - - - - - - - - - -Popovers · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Popovers

    -
    -

    Documentation and examples for adding Bootstrap popovers, like those found in iOS, to any element on your site.

    - - -
    - - - - - -
    - - -

    Overview

    + Popovers · Bootstrap v5.3

    Documentation and examples for adding Bootstrap popovers, like those found in iOS, to any element on your site.

    +

    Overview

    Things to know when using the popover plugin:

    • Popovers rely on the third party library Popper for positioning. You must include popper.min.js before bootstrap.js, or use one bootstrap.bundle.min.js which contains Popper.
    • -
    • Popovers require the popover plugin as a dependency.
    • +
    • Popovers require the popover plugin as a dependency.
    • Popovers are opt-in for performance reasons, so you must initialize them yourself.
    • Zero-length title and content values will never show a popover.
    • -
    • Specify container: 'body' to avoid rendering problems in more complex components (like our input groups, button groups, etc).
    • +
    • Specify container: 'body' to avoid rendering problems in more complex components (like our input groups, button groups, etc).
    • Triggering popovers on hidden elements will not work.
    • Popovers for .disabled or disabled elements must be triggered on a wrapper element.
    • -
    • When triggered from anchors that wrap across multiple lines, popovers will be centered between the anchors’ overall width. Use .text-nowrap on your <a>s to avoid this behavior.
    • +
    • When triggered from anchors that wrap across multiple lines, popovers will be centered between the anchors’ overall width. Use .text-nowrap on your <a>s to avoid this behavior.
    • Popovers must be hidden before their corresponding elements have been removed from the DOM.
    • Popovers can be triggered thanks to an element inside a shadow DOM.
    -
    -By default, this component uses the built-in content sanitizer, which strips out any HTML elements that are not explicitly allowed. See the sanitizer section in our JavaScript documentation for more details. -
    - -
    -The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation. -
    - +

    By default, this component uses the built-in content sanitizer, which strips out any HTML elements that are not explicitly allowed. See the sanitizer section in our JavaScript documentation for more details.

    +

    The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation.

    Keep reading to see how popovers work with some examples.

    -

    Examples

    -

    Enable popovers

    +

    Examples

    +

    Enable popovers

    As mentioned above, you must initialize popovers before they can be used. One way to initialize all popovers on a page would be to select them by their data-bs-toggle attribute, like so:

    -
    const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]')
    -const popoverList = [...popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl))
    -

    Live demo

    +
    const popoverTriggerList = document.querySelectorAll('[data-bs-toggle="popover"]')
    +const popoverList = [...popoverTriggerList].map(popoverTriggerEl => new bootstrap.Popover(popoverTriggerEl))
    +
    +

    Live demo

    We use JavaScript similar to the snippet above to render the following live popover. Titles are set via data-bs-title and body content is set via data-bs-content.

    -
    -Feel free to use either title or data-bs-title in your HTML. When title is used, Popper will replace it automatically with data-bs-title when the element is rendered. -
    - -
    -
    - - - -
    - html -
    - - -
    -
    <button type="button" class="btn btn-lg btn-danger" data-bs-toggle="popover" data-bs-title="Popover title" data-bs-content="And here's some amazing content. It's very engaging. Right?">Click to toggle popover</button>
    -
    - -

    Four directions

    +

    Feel free to use either title or data-bs-title in your HTML. When title is used, Popper will replace it automatically with data-bs-title when the element is rendered.

    +
    html
    <button type="button" class="btn btn-lg btn-danger" data-bs-toggle="popover" data-bs-title="Popover title" data-bs-content="And here’s some amazing content. It’s very engaging. Right?">Click to toggle popover</button>
    +

    Four directions

    Four options are available: top, right, bottom, and left. Directions are mirrored when using Bootstrap in RTL. Set data-bs-placement to change the direction.

    -
    -
    - - - -
    - html -
    - - -
    -
    <button type="button" class="btn btn-secondary" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="top" data-bs-content="Top popover">
    -  Popover on top
    -</button>
    -<button type="button" class="btn btn-secondary" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="right" data-bs-content="Right popover">
    -  Popover on right
    -</button>
    -<button type="button" class="btn btn-secondary" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="bottom" data-bs-content="Bottom popover">
    -  Popover on bottom
    -</button>
    -<button type="button" class="btn btn-secondary" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="left" data-bs-content="Left popover">
    -  Popover on left
    -</button>
    -
    - -

    Custom container

    -

    When you have some styles on a parent element that interfere with a popover, you’ll want to specify a custom container so that the popover’s HTML appears within that element instead. This is common in responsive tables, input groups, and the like.

    -
    const popover = new bootstrap.Popover('.example-popover', {
    -  container: 'body'
    -})
    -

    Another situation where you’ll want to set an explicit custom container are popovers inside a modal dialog, to make sure that the popover itself is appended to the modal. This is particularly important for popovers that contain interactive elements – modal dialogs will trap focus, so unless the popover is a child element of the modal, users won’t be able to focus or activate these interactive elements.

    -
    const popover = new bootstrap.Popover('.example-popover', {
    -  container: '.modal-body'
    -})
    -

    Custom popovers

    +
    html
    <button type="button" class="btn btn-secondary" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="top" data-bs-content="Top popover">
    +  Popover on top
    +</button>
    +<button type="button" class="btn btn-secondary" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="right" data-bs-content="Right popover">
    +  Popover on right
    +</button>
    +<button type="button" class="btn btn-secondary" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="bottom" data-bs-content="Bottom popover">
    +  Popover on bottom
    +</button>
    +<button type="button" class="btn btn-secondary" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="left" data-bs-content="Left popover">
    +  Popover on left
    +</button>
    +

    Custom container

    +

    When you have some styles on a parent element that interfere with a popover, you’ll want to specify a custom container so that the popover’s HTML appears within that element instead. This is common in responsive tables, input groups, and the like.

    +
    const popover = new bootstrap.Popover('.example-popover', {
    +  container: 'body'
    +})
    +
    +

    Another situation where you’ll want to set an explicit custom container are popovers inside a modal dialog, to make sure that the popover itself is appended to the modal. This is particularly important for popovers that contain interactive elements – modal dialogs will trap focus, so unless the popover is a child element of the modal, users won’t be able to focus or activate these interactive elements.

    +
    const popover = new bootstrap.Popover('.example-popover', {
    +  container: '.modal-body'
    +})
    +
    +

    Custom popovers

    Added in v5.2.0 -

    You can customize the appearance of popovers using CSS variables. We set a custom class with data-bs-custom-class="custom-popover" to scope our custom appearance and use it to override some of the local CSS variables.

    -
    -
    .custom-popover {
    -  --bs-popover-max-width: 200px;
    -  --bs-popover-border-color: var(--bd-violet-bg);
    -  --bs-popover-header-bg: var(--bd-violet-bg);
    -  --bs-popover-header-color: var(--bs-white);
    -  --bs-popover-body-padding-x: 1rem;
    -  --bs-popover-body-padding-y: .5rem;
    -}
    -
    -
    .custom-popover {
    +  --bs-popover-max-width: 200px;
    +  --bs-popover-border-color: var(--bd-violet-bg);
    +  --bs-popover-header-bg: var(--bd-violet-bg);
    +  --bs-popover-header-color: var(--bs-white);
    +  --bs-popover-body-padding-x: 1rem;
    +  --bs-popover-body-padding-y: .5rem;
    +}
    +
    +
    - -
    - html -
    - - -
    -
    <button type="button" class="btn btn-secondary"
    -        data-bs-toggle="popover" data-bs-placement="right"
    -        data-bs-custom-class="custom-popover"
    -        data-bs-title="Custom popover"
    -        data-bs-content="This popover is themed via CSS variables.">
    -  Custom popover
    -</button>
    -
    - -

    Dismiss on next click

    -

    Use the focus trigger to dismiss popovers on the user’s next click of an element other than the toggle element.

    -
    -Dismissing on next click requires specific HTML for proper cross-browser and cross-platform behavior. You can only use <a> elements, not <button>s, and you must include a tabindex. -
    - -
    -
    - html -
    - - -
    -
    <a tabindex="0" class="btn btn-lg btn-danger" role="button" data-bs-toggle="popover" data-bs-trigger="focus" data-bs-title="Dismissible popover" data-bs-content="And here's some amazing content. It's very engaging. Right?">Dismissible popover</a>
    -
    - -
    const popover = new bootstrap.Popover('.popover-dismiss', {
    -  trigger: 'focus'
    -})
    -

    Disabled elements

    -

    Elements with the disabled attribute aren’t interactive, meaning users cannot hover or click them to trigger a popover (or tooltip). As a workaround, you’ll want to trigger the popover from a wrapper <div> or <span>, ideally made keyboard-focusable using tabindex="0".

    +
    html
    <button type="button" class="btn btn-secondary"
    +        data-bs-toggle="popover" data-bs-placement="right"
    +        data-bs-custom-class="custom-popover"
    +        data-bs-title="Custom popover"
    +        data-bs-content="This popover is themed via CSS variables.">
    +  Custom popover
    +</button>
    +

    Dismiss on next click

    +

    Use the focus trigger to dismiss popovers on the user’s next click of an element other than the toggle element.

    +

    Dismissing on next click requires specific HTML for proper cross-browser and cross-platform behavior. You can only use <a> elements, not <button>s, and you must include a tabindex.

    +
    html
    <a tabindex="0" class="btn btn-lg btn-danger" role="button" data-bs-toggle="popover" data-bs-trigger="focus" data-bs-title="Dismissible popover" data-bs-content="And here’s some amazing content. It’s very engaging. Right?">Dismissible popover</a>
    +
    const popover = new bootstrap.Popover('.popover-dismiss', {
    +  trigger: 'focus'
    +})
    +
    +

    Disabled elements

    +

    Elements with the disabled attribute aren’t interactive, meaning users cannot hover or click them to trigger a popover (or tooltip). As a workaround, you’ll want to trigger the popover from a wrapper <div> or <span>, ideally made keyboard-focusable using tabindex="0".

    For disabled popover triggers, you may also prefer data-bs-trigger="hover focus" so that the popover appears as immediate visual feedback to your users as they may not expect to click on a disabled element.

    -
    -
    - - +
    - - -
    - html -
    - - -
    -
    <span class="d-inline-block" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-content="Disabled popover">
    -  <button class="btn btn-primary" type="button" disabled>Disabled button</button>
    -</span>
    -
    - -

    CSS

    -

    Variables

    +
    html
    <span class="d-inline-block" tabindex="0" data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-content="Disabled popover">
    +  <button class="btn btn-primary" type="button" disabled>Disabled button</button>
    +</span>
    +

    CSS

    +

    Variables

    Added in v5.2.0 -

    As part of Bootstrap’s evolving CSS variables approach, popovers now use local CSS variables on .popover for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    -
    -
    - scss/_popover.scss -
    - -
    -
    --#{$prefix}popover-zindex: #{$zindex-popover};
    ---#{$prefix}popover-max-width: #{$popover-max-width};
    -@include rfs($popover-font-size, --#{$prefix}popover-font-size);
    ---#{$prefix}popover-bg: #{$popover-bg};
    ---#{$prefix}popover-border-width: #{$popover-border-width};
    ---#{$prefix}popover-border-color: #{$popover-border-color};
    ---#{$prefix}popover-border-radius: #{$popover-border-radius};
    ---#{$prefix}popover-inner-border-radius: #{$popover-inner-border-radius};
    ---#{$prefix}popover-box-shadow: #{$popover-box-shadow};
    ---#{$prefix}popover-header-padding-x: #{$popover-header-padding-x};
    ---#{$prefix}popover-header-padding-y: #{$popover-header-padding-y};
    -@include rfs($popover-header-font-size, --#{$prefix}popover-header-font-size);
    ---#{$prefix}popover-header-color: #{$popover-header-color};
    ---#{$prefix}popover-header-bg: #{$popover-header-bg};
    ---#{$prefix}popover-body-padding-x: #{$popover-body-padding-x};
    ---#{$prefix}popover-body-padding-y: #{$popover-body-padding-y};
    ---#{$prefix}popover-body-color: #{$popover-body-color};
    ---#{$prefix}popover-arrow-width: #{$popover-arrow-width};
    ---#{$prefix}popover-arrow-height: #{$popover-arrow-height};
    ---#{$prefix}popover-arrow-border: var(--#{$prefix}popover-border-color);
    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $popover-font-size:                 $font-size-sm;
    -$popover-bg:                        var(--#{$prefix}body-bg);
    -$popover-max-width:                 276px;
    -$popover-border-width:              var(--#{$prefix}border-width);
    -$popover-border-color:              var(--#{$prefix}border-color-translucent);
    -$popover-border-radius:             var(--#{$prefix}border-radius-lg);
    -$popover-inner-border-radius:       calc(#{$popover-border-radius} - #{$popover-border-width}); // stylelint-disable-line function-disallowed-list
    -$popover-box-shadow:                var(--#{$prefix}box-shadow);
    -
    -$popover-header-font-size:          $font-size-base;
    -$popover-header-bg:                 var(--#{$prefix}secondary-bg);
    -$popover-header-color:              $headings-color;
    -$popover-header-padding-y:          .5rem;
    -$popover-header-padding-x:          $spacer;
    -
    -$popover-body-color:                var(--#{$prefix}body-color);
    -$popover-body-padding-y:            $spacer;
    -$popover-body-padding-x:            $spacer;
    -
    -$popover-arrow-width:               1rem;
    -$popover-arrow-height:              .5rem;
    -
    -

    Usage

    +
    --#{$prefix}popover-zindex: #{$zindex-popover};
    +--#{$prefix}popover-max-width: #{$popover-max-width};
    +@include rfs($popover-font-size, --#{$prefix}popover-font-size);
    +--#{$prefix}popover-bg: #{$popover-bg};
    +--#{$prefix}popover-border-width: #{$popover-border-width};
    +--#{$prefix}popover-border-color: #{$popover-border-color};
    +--#{$prefix}popover-border-radius: #{$popover-border-radius};
    +--#{$prefix}popover-inner-border-radius: #{$popover-inner-border-radius};
    +--#{$prefix}popover-box-shadow: #{$popover-box-shadow};
    +--#{$prefix}popover-header-padding-x: #{$popover-header-padding-x};
    +--#{$prefix}popover-header-padding-y: #{$popover-header-padding-y};
    +@include rfs($popover-header-font-size, --#{$prefix}popover-header-font-size);
    +--#{$prefix}popover-header-color: #{$popover-header-color};
    +--#{$prefix}popover-header-bg: #{$popover-header-bg};
    +--#{$prefix}popover-body-padding-x: #{$popover-body-padding-x};
    +--#{$prefix}popover-body-padding-y: #{$popover-body-padding-y};
    +--#{$prefix}popover-body-color: #{$popover-body-color};
    +--#{$prefix}popover-arrow-width: #{$popover-arrow-width};
    +--#{$prefix}popover-arrow-height: #{$popover-arrow-height};
    +--#{$prefix}popover-arrow-border: var(--#{$prefix}popover-border-color);
    +
    +

    Sass variables

    +
    $popover-font-size:                 $font-size-sm;
    +$popover-bg:                        var(--#{$prefix}body-bg);
    +$popover-max-width:                 276px;
    +$popover-border-width:              var(--#{$prefix}border-width);
    +$popover-border-color:              var(--#{$prefix}border-color-translucent);
    +$popover-border-radius:             var(--#{$prefix}border-radius-lg);
    +$popover-inner-border-radius:       calc(#{$popover-border-radius} - #{$popover-border-width}); // stylelint-disable-line function-disallowed-list
    +$popover-box-shadow:                var(--#{$prefix}box-shadow);
    +
    +$popover-header-font-size:          $font-size-base;
    +$popover-header-bg:                 var(--#{$prefix}secondary-bg);
    +$popover-header-color:              $headings-color;
    +$popover-header-padding-y:          .5rem;
    +$popover-header-padding-x:          $spacer;
    +
    +$popover-body-color:                var(--#{$prefix}body-color);
    +$popover-body-padding-y:            $spacer;
    +$popover-body-padding-x:            $spacer;
    +
    +$popover-arrow-width:               1rem;
    +$popover-arrow-height:              .5rem;
    +
    +

    Usage

    Enable popovers via JavaScript:

    -
    const exampleEl = document.getElementById('example')
    -const popover = new bootstrap.Popover(exampleEl, options)
    -
    -

    Keep popovers accessible to keyboard and assistive technology users by only adding them to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). While other HTML elements can be made focusable by adding tabindex="0", this can create annoying and confusing tab stops on non-interactive elements for keyboard users, and most assistive technologies currently do not announce popovers in this situation. Additionally, do not rely solely on hover as the trigger for your popovers as this will make them impossible to trigger for keyboard users.

    -

    Avoid adding an excessive amount of content in popovers with the html option. Once popovers are displayed, their content is tied to the trigger element with the aria-describedby attribute, causing all of the popover’s content to be announced to assistive technology users as one long, uninterrupted stream.

    -

    Popovers do not manage keyboard focus order, and their placement can be random in the DOM, so be careful when adding interactive elements (like forms or links), as it may lead to an illogical focus order or make the popover content itself completely unreachable for keyboard users. In cases where you must use these elements, consider using a modal dialog instead.

    - -
    - -

    Options

    -

    As options can be passed via data attributes or JavaScript, you can append an option name to data-bs-, as in data-bs-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-bs-custom-class="beautifier" instead of data-bs-customClass="beautifier".

    -

    As of Bootstrap 5.2.0, all components support an experimental reserved data attribute data-bs-config that can house simple component configuration as a JSON string. When an element has data-bs-config='{"delay":0, "title":123}' and data-bs-title="456" attributes, the final title value will be 456 and the separate data attributes will override values given on data-bs-config. In addition, existing data attributes are able to house JSON values like data-bs-delay='{"show":0,"hide":150}'.

    +
    const exampleEl = document.getElementById('example')
    +const popover = new bootstrap.Popover(exampleEl, options)
    +
    +

    Keep popovers accessible to keyboard and assistive technology users by only adding them to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). While other HTML elements can be made focusable by adding tabindex="0", this can create annoying and confusing tab stops on non-interactive elements for keyboard users, and most assistive technologies currently do not announce popovers in this situation. Additionally, do not rely solely on hover as the trigger for your popovers as this will make them impossible to trigger for keyboard users.

    Avoid adding an excessive amount of content in popovers with the html option. Once popovers are displayed, their content is tied to the trigger element with the aria-describedby attribute, causing all of the popover’s content to be announced to assistive technology users as one long, uninterrupted stream.

    Popovers do not manage keyboard focus order, and their placement can be random in the DOM, so be careful when adding interactive elements (like forms or links), as it may lead to an illogical focus order or make the popover content itself completely unreachable for keyboard users. In cases where you must use these elements, consider using a modal dialog instead.

    +

    Options

    +

    As options can be passed via data attributes or JavaScript, you can append an option name to data-bs-, as in data-bs-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-bs-custom-class="beautifier" instead of data-bs-customClass="beautifier".

    +

    As of Bootstrap 5.2.0, all components support an experimental reserved data attribute data-bs-config that can house simple component configuration as a JSON string. When an element has data-bs-config='{"delay":0, "title":123}' and data-bs-title="456" attributes, the final title value will be 456 and the separate data attributes will override values given on data-bs-config. In addition, existing data attributes are able to house JSON values like data-bs-delay='{"show":0,"hide":150}'.

    The final configuration object is the merged result of data-bs-config, data-bs-, and js object where the latest given key-value overrides the others.

    - -
    -Note that for security reasons the sanitize, sanitizeFn, and allowList options cannot be supplied using data attributes. -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDefaultDescription
    allowListobjectDefault valueObject which contains allowed attributes and tags.
    animationbooleantrueApply a CSS fade transition to the popover.
    boundarystring, element'clippingParents'Overflow constraint boundary of the popover (applies only to Popper’s preventOverflow modifier). By default, it’s 'clippingParents' and can accept an HTMLElement reference (via JavaScript only). For more information refer to Popper’s detectOverflow docs.
    containerstring, element, falsefalseAppends the popover to a specific element. Example: container: 'body'. This option is particularly useful in that it allows you to position the popover in the flow of the document near the triggering element - which will prevent the popover from floating away from the triggering element during a window resize.
    contentstring, element, function''The popover’s text content. If a function is given, it will be called with its this reference set to the element that the popover is attached to.
    customClassstring, function''Add classes to the popover when it is shown. Note that these classes will be added in addition to any classes specified in the template. To add multiple classes, separate them with spaces: 'class-1 class-2'. You can also pass a function that should return a single string containing additional class names.
    delaynumber, object0Delay showing and hiding the popover (ms)—doesn’t apply to manual trigger type. If a number is supplied, delay is applied to both hide/show. Object structure is: delay: { "show": 500, "hide": 100 }.
    fallbackPlacementsstring, array['top', 'right', 'bottom', 'left']Define fallback placements by providing a list of placements in array (in order of preference). For more information refer to Popper’s behavior docs.
    htmlbooleanfalseAllow HTML in the popover. If true, HTML tags in the popover’s title will be rendered in the popover. If false, innerText property will be used to insert content into the DOM. Use text if you’re worried about XSS attacks.
    offsetnumber, string, function[0, 8]Offset of the popover relative to its target. You can pass a string in data attributes with comma separated values like: data-bs-offset="10,20". When a function is used to determine the offset, it is called with an object containing the popper placement, the reference, and popper rects as its first argument. The triggering element DOM node is passed as the second argument. The function must return an array with two numbers: skidding, distance. For more information refer to Popper’s offset docs.
    placementstring, function'right'How to position the popover: auto, top, bottom, left, right. When auto is specified, it will dynamically reorient the popover. When a function is used to determine the placement, it is called with the popover DOM node as its first argument and the triggering element DOM node as its second. The this context is set to the popover instance.
    popperConfignull, object, functionnullTo change Bootstrap’s default Popper config, see Popper’s configuration. When a function is used to create the Popper configuration, it’s called with an object that contains the Bootstrap’s default Popper configuration. It helps you use and merge the default with your own configuration. The function must return a configuration object for Popper.
    sanitizebooleantrueEnable or disable the sanitization. If activated 'template', 'content' and 'title' options will be sanitized.
    sanitizeFnnull, functionnullHere you can supply your own sanitize function. This can be useful if you prefer to use a dedicated library to perform sanitization.
    selectorstring, falsefalseIf a selector is provided, popover objects will be delegated to the specified targets. In practice, this is used to also apply popovers to dynamically added DOM elements (jQuery.on support). See this issue and an informative example. Note: title attribute must not be used as a selector.
    templatestring'<div class="popover" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'Base HTML to use when creating the popover. The popover’s title will be injected into the .popover-header. The popover’s content will be injected into the .popover-body. .popover-arrow will become the popover’s arrow. The outermost wrapper element should have the .popover class and role="tooltip".
    titlestring, element, function''The popover title. If a function is given, it will be called with its this reference set to the element that the popover is attached to.
    triggerstring'click'How popover is triggered: click, hover, focus, manual. You may pass multiple triggers; separate them with a space. 'manual' indicates that the popover will be triggered programmatically via the .popover('show'), .popover('hide') and .popover('toggle') methods; this value cannot be combined with any other trigger. 'hover' on its own will result in popovers that cannot be triggered via the keyboard, and should only be used if alternative methods for conveying the same information for keyboard users is present.
    - -
    -

    Data attributes for individual popovers

    -

    Options for individual popovers can alternatively be specified through the use of data attributes, as explained above.

    -
    - -

    Using function with popperConfig

    -
    const popover = new bootstrap.Popover(element, {
    -  popperConfig(defaultBsPopperConfig) {
    -    // const newPopperConfig = {...}
    -    // use defaultBsPopperConfig if needed...
    -    // return newPopperConfig
    -  }
    -})
    -

    Methods

    -
    -All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started, but before it ends. In addition, a method call on a transitioning component will be ignored. Learn more in our JavaScript docs. -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    MethodDescription
    disableRemoves the ability for an element’s popover to be shown. The popover will only be able to be shown if it is re-enabled.
    disposeHides and destroys an element’s popover (Removes stored data on the DOM element). Popovers that use delegation (which are created using the selector option) cannot be individually destroyed on descendant trigger elements.
    enableGives an element’s popover the ability to be shown. Popovers are enabled by default.
    getInstanceStatic method which allows you to get the popover instance associated with a DOM element.
    getOrCreateInstanceStatic method which allows you to get the popover instance associated with a DOM element, or create a new one in case it wasn’t initialized.
    hideHides an element’s popover. Returns to the caller before the popover has actually been hidden (i.e. before the hidden.bs.popover event occurs). This is considered a “manual” triggering of the popover.
    setContentGives a way to change the popover’s content after its initialization.
    showReveals an element’s popover. Returns to the caller before the popover has actually been shown (i.e. before the shown.bs.popover event occurs). This is considered a “manual” triggering of the popover. Popovers whose title and content are both zero-length are never displayed.
    toggleToggles an element’s popover. Returns to the caller before the popover has actually been shown or hidden (i.e. before the shown.bs.popover or hidden.bs.popover event occurs). This is considered a “manual” triggering of the popover.
    toggleEnabledToggles the ability for an element’s popover to be shown or hidden.
    updateUpdates the position of an element’s popover.
    - -
    // getOrCreateInstance example
    -const popover = bootstrap.Popover.getOrCreateInstance('#example') // Returns a Bootstrap popover instance
    -
    -// setContent example
    -popover.setContent({
    -  '.popover-header': 'another title',
    -  '.popover-body': 'another content'
    -})
    -
    -The setContent method accepts an object argument, where each property-key is a valid string selector within the popover template, and each related property-value can be string | element | function | null -
    - -

    Events

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    EventDescription
    hide.bs.popoverThis event is fired immediately when the hide instance method has been called.
    hidden.bs.popoverThis event is fired when the popover has finished being hidden from the user (will wait for CSS transitions to complete).
    inserted.bs.popoverThis event is fired after the show.bs.popover event when the popover template has been added to the DOM.
    show.bs.popoverThis event fires immediately when the show instance method is called.
    shown.bs.popoverThis event is fired when the popover has been made visible to the user (will wait for CSS transitions to complete).
    - -
    const myPopoverTrigger = document.getElementById('myPopover')
    -myPopoverTrigger.addEventListener('hidden.bs.popover', () => {
    -  // do something...
    -})
    -
    - - - +

    Note that for security reasons the sanitize, sanitizeFn, and allowList options cannot be supplied using data attributes.

    +
    - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDefaultDescription
    allowListobjectDefault valueObject which contains allowed attributes and tags.
    animationbooleantrueApply a CSS fade transition to the popover.
    boundarystring, element'clippingParents'Overflow constraint boundary of the popover (applies only to Popper’s preventOverflow modifier). By default, it’s 'clippingParents' and can accept an HTMLElement reference (via JavaScript only). For more information refer to Popper’s detectOverflow docs.
    containerstring, element, falsefalseAppends the popover to a specific element. Example: container: 'body'. This option is particularly useful in that it allows you to position the popover in the flow of the document near the triggering element - which will prevent the popover from floating away from the triggering element during a window resize.
    contentstring, element, function''The popover’s text content. If a function is given, it will be called with its this reference set to the element that the popover is attached to.
    customClassstring, function''Add classes to the popover when it is shown. Note that these classes will be added in addition to any classes specified in the template. To add multiple classes, separate them with spaces: 'class-1 class-2'. You can also pass a function that should return a single string containing additional class names.
    delaynumber, object0Delay showing and hiding the popover (ms)—doesn’t apply to manual trigger type. If a number is supplied, delay is applied to both hide/show. Object structure is: delay: { "show": 500, "hide": 100 }.
    fallbackPlacementsstring, array['top', 'right', 'bottom', 'left']Define fallback placements by providing a list of placements in array (in order of preference). For more information refer to Popper’s behavior docs.
    htmlbooleanfalseAllow HTML in the popover. If true, HTML tags in the popover’s title will be rendered in the popover. If false, innerText property will be used to insert content into the DOM. Use text if you’re worried about XSS attacks.
    offsetnumber, string, function[0, 8]Offset of the popover relative to its target. You can pass a string in data attributes with comma separated values like: data-bs-offset="10,20". When a function is used to determine the offset, it is called with an object containing the popper placement, the reference, and popper rects as its first argument. The triggering element DOM node is passed as the second argument. The function must return an array with two numbers: skidding, distance. For more information refer to Popper’s offset docs.
    placementstring, function'right'How to position the popover: auto, top, bottom, left, right. When auto is specified, it will dynamically reorient the popover. When a function is used to determine the placement, it is called with the popover DOM node as its first argument and the triggering element DOM node as its second. The this context is set to the popover instance.
    popperConfignull, object, functionnullTo change Bootstrap’s default Popper config, see Popper’s configuration. When a function is used to create the Popper configuration, it’s called with an object that contains the Bootstrap’s default Popper configuration. It helps you use and merge the default with your own configuration. The function must return a configuration object for Popper.
    sanitizebooleantrueEnable or disable the sanitization. If activated 'template', 'content' and 'title' options will be sanitized.
    sanitizeFnnull, functionnullHere you can supply your own sanitize function. This can be useful if you prefer to use a dedicated library to perform sanitization.
    selectorstring, falsefalseIf a selector is provided, popover objects will be delegated to the specified targets. In practice, this is used to also apply popovers to dynamically added DOM elements (jQuery.on support). See this issue and an informative example. Note: title attribute must not be used as a selector.
    templatestring'<div class="popover" role="tooltip"><div class="popover-arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>'Base HTML to use when creating the popover. The popover’s title will be injected into the .popover-header. The popover’s content will be injected into the .popover-body. .popover-arrow will become the popover’s arrow. The outermost wrapper element should have the .popover class and role="tooltip".
    titlestring, element, function''The popover title. If a function is given, it will be called with its this reference set to the element that the popover is attached to.
    triggerstring'click'How popover is triggered: click, hover, focus, manual. You may pass multiple triggers; separate them with a space. 'manual' indicates that the popover will be triggered programmatically via the .popover('show'), .popover('hide') and .popover('toggle') methods; this value cannot be combined with any other trigger. 'hover' on its own will result in popovers that cannot be triggered via the keyboard, and should only be used if alternative methods for conveying the same information for keyboard users is present.
    +

    Data attributes for individual popovers

    Options for individual popovers can alternatively be specified through the use of data attributes, as explained above.

    +

    Using function with popperConfig

    +
    const popover = new bootstrap.Popover(element, {
    +  popperConfig(defaultBsPopperConfig) {
    +    // const newPopperConfig = {...}
    +    // use defaultBsPopperConfig if needed...
    +    // return newPopperConfig
    +  }
    +})
    +
    +

    Methods

    +

    All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started, but before it ends. In addition, a method call on a transitioning component will be ignored. Learn more in our JavaScript docs.

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MethodDescription
    disableRemoves the ability for an element’s popover to be shown. The popover will only be able to be shown if it is re-enabled.
    disposeHides and destroys an element’s popover (Removes stored data on the DOM element). Popovers that use delegation (which are created using the selector option) cannot be individually destroyed on descendant trigger elements.
    enableGives an element’s popover the ability to be shown. Popovers are enabled by default.
    getInstanceStatic method which allows you to get the popover instance associated with a DOM element.
    getOrCreateInstanceStatic method which allows you to get the popover instance associated with a DOM element, or create a new one in case it wasn’t initialized.
    hideHides an element’s popover. Returns to the caller before the popover has actually been hidden (i.e. before the hidden.bs.popover event occurs). This is considered a “manual” triggering of the popover.
    setContentGives a way to change the popover’s content after its initialization.
    showReveals an element’s popover. Returns to the caller before the popover has actually been shown (i.e. before the shown.bs.popover event occurs). This is considered a “manual” triggering of the popover. Popovers whose title and content are both zero-length are never displayed.
    toggleToggles an element’s popover. Returns to the caller before the popover has actually been shown or hidden (i.e. before the shown.bs.popover or hidden.bs.popover event occurs). This is considered a “manual” triggering of the popover.
    toggleEnabledToggles the ability for an element’s popover to be shown or hidden.
    updateUpdates the position of an element’s popover.
    +
    // getOrCreateInstance example
    +const popover = bootstrap.Popover.getOrCreateInstance('#example') // Returns a Bootstrap popover instance
    +
    +// setContent example
    +popover.setContent({
    +  '.popover-header': 'another title',
    +  '.popover-body': 'another content'
    +})
    +
    +

    The setContent method accepts an object argument, where each property-key is a valid string selector within the popover template, and each related property-value can be string | element | function | null

    +

    Events

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    EventDescription
    hide.bs.popoverThis event is fired immediately when the hide instance method has been called.
    hidden.bs.popoverThis event is fired when the popover has finished being hidden from the user (will wait for CSS transitions to complete).
    inserted.bs.popoverThis event is fired after the show.bs.popover event when the popover template has been added to the DOM.
    show.bs.popoverThis event fires immediately when the show instance method is called.
    shown.bs.popoverThis event is fired when the popover has been made visible to the user (will wait for CSS transitions to complete).
    +
    const myPopoverTrigger = document.getElementById('myPopover')
    +myPopoverTrigger.addEventListener('hidden.bs.popover', () => {
    +  // do something...
    +})
    +
    \ No newline at end of file diff --git a/docs/5.3/components/progress/index.html b/docs/5.3/components/progress/index.html index 4a60d455c3..7a21723c20 100644 --- a/docs/5.3/components/progress/index.html +++ b/docs/5.3/components/progress/index.html @@ -1,587 +1,29 @@ - - - - - - - - - - - - - - - - -Progress · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Progress

    -
    -

    Documentation and examples for using Bootstrap custom progress bars featuring support for stacked bars, animated backgrounds, and text labels.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -
    -New markup in v5.3.0 — We’ve deprecated the previous HTML structure for progress bars and replaced it with a more accessible one. The previous structure will continue to work until v6. See what’s changed in our migration guide. -
    - -

    How it works

    -

    Progress components are built with two HTML elements, some CSS to set the width, and a few attributes. We don’t use the HTML5 <progress> element, ensuring you can stack progress bars, animate them, and place text labels over them.

    + Progress · Bootstrap v5.3

    Documentation and examples for using Bootstrap custom progress bars featuring support for stacked bars, animated backgrounds, and text labels.

    +

    New markup in v5.3.0 — We’ve deprecated the previous HTML structure for progress bars and replaced it with a more accessible one. The previous structure will continue to work until v6. See what’s changed in our migration guide.

    +

    How it works

    +

    Progress components are built with two HTML elements, some CSS to set the width, and a few attributes. We don’t use the HTML5 <progress> element, ensuring you can stack progress bars, animate them, and place text labels over them.

    • We use the .progress as a wrapper to indicate the max value of the progress bar.
    • The .progress wrapper also requires a role="progressbar" and aria attributes to make it accessible, including an accessible name (using aria-label, aria-labelledby, or similar).
    • @@ -590,10 +32,7 @@
    • We provide a special .progress-stacked class to create multiple/stacked progress bars.

    Put that all together, and you have the following examples.

    -
    -
    - -
    +
    @@ -607,128 +46,55 @@
    -
    - -
    - html -
    - - -
    -
    <div class="progress" role="progressbar" aria-label="Basic example" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar" style="width: 0%"></div>
    -</div>
    -<div class="progress" role="progressbar" aria-label="Basic example" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar" style="width: 25%"></div>
    -</div>
    -<div class="progress" role="progressbar" aria-label="Basic example" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar" style="width: 50%"></div>
    -</div>
    -<div class="progress" role="progressbar" aria-label="Basic example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar" style="width: 75%"></div>
    -</div>
    -<div class="progress" role="progressbar" aria-label="Basic example" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar" style="width: 100%"></div>
    -</div>
    -
    - -

    Bar sizing

    -

    Width

    -

    Bootstrap provides a handful of utilities for setting width. Depending on your needs, these may help with quickly configuring the width of the .progress-bar.

    -
    -
    - -
    +
    html
    <div class="progress" role="progressbar" aria-label="Basic example" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar" style="width: 0%"></div>
    +</div>
    +<div class="progress" role="progressbar" aria-label="Basic example" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar" style="width: 25%"></div>
    +</div>
    +<div class="progress" role="progressbar" aria-label="Basic example" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar" style="width: 50%"></div>
    +</div>
    +<div class="progress" role="progressbar" aria-label="Basic example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar" style="width: 75%"></div>
    +</div>
    +<div class="progress" role="progressbar" aria-label="Basic example" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar" style="width: 100%"></div>
    +</div>
    +

    Bar sizing

    +

    Width

    +

    Bootstrap provides a handful of utilities for setting width. Depending on your needs, these may help with quickly configuring the width of the .progress-bar.

    +
    -
    - -
    - html -
    - - -
    -
    <div class="progress" role="progressbar" aria-label="Basic example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar w-75"></div>
    -</div>
    -
    - -

    Height

    +
    html
    <div class="progress" role="progressbar" aria-label="Basic example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar w-75"></div>
    +</div>
    +

    Height

    You only set a height value on the .progress container, so if you change that value, the inner .progress-bar will automatically resize accordingly.

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="progress" role="progressbar" aria-label="Example 1px high" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100" style="height: 1px">
    -  <div class="progress-bar" style="width: 25%"></div>
    -</div>
    -<div class="progress" role="progressbar" aria-label="Example 20px high" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100" style="height: 20px">
    -  <div class="progress-bar" style="width: 25%"></div>
    -</div>
    -
    - -

    Labels

    +
    html
    <div class="progress" role="progressbar" aria-label="Example 1px high" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100" style="height: 1px">
    +  <div class="progress-bar" style="width: 25%"></div>
    +</div>
    +<div class="progress" role="progressbar" aria-label="Example 20px high" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100" style="height: 20px">
    +  <div class="progress-bar" style="width: 25%"></div>
    +</div>
    +

    Labels

    Add labels to your progress bars by placing text within the .progress-bar.

    -
    -
    - -
    +
    25%
    -
    - -
    - html -
    - - -
    -
    <div class="progress" role="progressbar" aria-label="Example with label" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar" style="width: 25%">25%</div>
    -</div>
    -
    - -

    Long labels

    -

    Note that by default, the content inside the .progress-bar is controlled with overflow: hidden, so it doesn’t bleed out of the bar. If your progress bar is shorter than its label, the content will be capped and may become unreadable. To change this behavior, you can use .overflow-visible from the overflow utilities.

    -
    -

    Labels longer than the progress bar within may not be fully accessible using this method because it relies on the text color having the correct contrast ratio with both the .progress and .progress-bar background colors. Use caution when implementing this example.

    -

    If the text can overlap the progress bar, we often recommend displaying the label outside of the progress bar for better accessibility.

    - -
    - -

    Backgrounds

    +
    html
    <div class="progress" role="progressbar" aria-label="Example with label" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar" style="width: 25%">25%</div>
    +</div>
    +

    Long labels

    +

    Note that by default, the content inside the .progress-bar is controlled with overflow: hidden, so it doesn’t bleed out of the bar. If your progress bar is shorter than its label, the content will be capped and may become unreadable. To change this behavior, you can use .overflow-visible from the overflow utilities.

    +

    Labels longer than the progress bar within may not be fully accessible using this method because it relies on the text color having the correct contrast ratio with both the .progress and .progress-bar background colors. Use caution when implementing this example.

    If the text can overlap the progress bar, we often recommend displaying the label outside of the progress bar for better accessibility.

    +

    Backgrounds

    Use background utility classes to change the appearance of individual progress bars.

    -
    -
    - -
    +
    @@ -739,41 +105,21 @@
    -
    - -
    - html -
    - - -
    -
    <div class="progress" role="progressbar" aria-label="Success example" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar bg-success" style="width: 25%"></div>
    -</div>
    -<div class="progress" role="progressbar" aria-label="Info example" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar bg-info" style="width: 50%"></div>
    -</div>
    -<div class="progress" role="progressbar" aria-label="Warning example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar bg-warning" style="width: 75%"></div>
    -</div>
    -<div class="progress" role="progressbar" aria-label="Danger example" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar bg-danger" style="width: 100%"></div>
    -</div>
    -
    - -
    -Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class. -
    - -

    If you’re adding labels to progress bars with a custom background color, make sure to also set an appropriate text color, so the labels remain readable and have sufficient contrast. We recommend using the color and background helper classes.

    -
    -
    - -
    +
    html
    <div class="progress" role="progressbar" aria-label="Success example" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar bg-success" style="width: 25%"></div>
    +</div>
    +<div class="progress" role="progressbar" aria-label="Info example" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar bg-info" style="width: 50%"></div>
    +</div>
    +<div class="progress" role="progressbar" aria-label="Warning example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar bg-warning" style="width: 75%"></div>
    +</div>
    +<div class="progress" role="progressbar" aria-label="Danger example" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar bg-danger" style="width: 100%"></div>
    +</div>
    +

    Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class.

    +

    If you’re adding labels to progress bars with a custom background color, make sure to also set an appropriate text color, so the labels remain readable and have sufficient contrast. We recommend using the color and background helper classes.

    +
    25%
    @@ -784,38 +130,21 @@
    100%
    -
    - -
    - html -
    - - -
    -
    <div class="progress" role="progressbar" aria-label="Success example" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar text-bg-success" style="width: 25%">25%</div>
    -</div>
    -<div class="progress" role="progressbar" aria-label="Info example" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar text-bg-info" style="width: 50%">50%</div>
    -</div>
    -<div class="progress" role="progressbar" aria-label="Warning example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar text-bg-warning" style="width: 75%">75%</div>
    -</div>
    -<div class="progress" role="progressbar" aria-label="Danger example" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar text-bg-danger" style="width: 100%">100%</div>
    -</div>
    -
    - -

    Multiple bars

    +
    html
    <div class="progress" role="progressbar" aria-label="Success example" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar text-bg-success" style="width: 25%">25%</div>
    +</div>
    +<div class="progress" role="progressbar" aria-label="Info example" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar text-bg-info" style="width: 50%">50%</div>
    +</div>
    +<div class="progress" role="progressbar" aria-label="Warning example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar text-bg-warning" style="width: 75%">75%</div>
    +</div>
    +<div class="progress" role="progressbar" aria-label="Danger example" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar text-bg-danger" style="width: 100%">100%</div>
    +</div>
    +

    Multiple bars

    You can include multiple progress components inside a container with .progress-stacked to create a single stacked progress bar. Note that in this case, the styling to set the visual width of the progress bar must be applied to the .progress elements, rather than the .progress-bars.

    -
    -
    - -
    +
    @@ -825,37 +154,20 @@
    -
    - -
    - html -
    - - -
    -
    <div class="progress-stacked">
    -  <div class="progress" role="progressbar" aria-label="Segment one" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100" style="width: 15%">
    -    <div class="progress-bar"></div>
    -  </div>
    -  <div class="progress" role="progressbar" aria-label="Segment two" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" style="width: 30%">
    -    <div class="progress-bar bg-success"></div>
    -  </div>
    -  <div class="progress" role="progressbar" aria-label="Segment three" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 20%">
    -    <div class="progress-bar bg-info"></div>
    -  </div>
    -</div>
    -
    - -

    Striped

    -

    Add .progress-bar-striped to any .progress-bar to apply a stripe via CSS gradient over the progress bar’s background color.

    -
    -
    - -
    +
    html
    <div class="progress-stacked">
    +  <div class="progress" role="progressbar" aria-label="Segment one" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100" style="width: 15%">
    +    <div class="progress-bar"></div>
    +  </div>
    +  <div class="progress" role="progressbar" aria-label="Segment two" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" style="width: 30%">
    +    <div class="progress-bar bg-success"></div>
    +  </div>
    +  <div class="progress" role="progressbar" aria-label="Segment three" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 20%">
    +    <div class="progress-bar bg-info"></div>
    +  </div>
    +</div>
    +

    Striped

    +

    Add .progress-bar-striped to any .progress-bar to apply a stripe via CSS gradient over the progress bar’s background color.

    +
    @@ -869,189 +181,61 @@
    -
    - -
    - html -
    - - -
    -
    <div class="progress" role="progressbar" aria-label="Default striped example" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar progress-bar-striped" style="width: 10%"></div>
    -</div>
    -<div class="progress" role="progressbar" aria-label="Success striped example" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar progress-bar-striped bg-success" style="width: 25%"></div>
    -</div>
    -<div class="progress" role="progressbar" aria-label="Info striped example" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar progress-bar-striped bg-info" style="width: 50%"></div>
    -</div>
    -<div class="progress" role="progressbar" aria-label="Warning striped example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar progress-bar-striped bg-warning" style="width: 75%"></div>
    -</div>
    -<div class="progress" role="progressbar" aria-label="Danger striped example" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar progress-bar-striped bg-danger" style="width: 100%"></div>
    -</div>
    -
    - -

    Animated stripes

    +
    html
    <div class="progress" role="progressbar" aria-label="Default striped example" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar progress-bar-striped" style="width: 10%"></div>
    +</div>
    +<div class="progress" role="progressbar" aria-label="Success striped example" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar progress-bar-striped bg-success" style="width: 25%"></div>
    +</div>
    +<div class="progress" role="progressbar" aria-label="Info striped example" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar progress-bar-striped bg-info" style="width: 50%"></div>
    +</div>
    +<div class="progress" role="progressbar" aria-label="Warning striped example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar progress-bar-striped bg-warning" style="width: 75%"></div>
    +</div>
    +<div class="progress" role="progressbar" aria-label="Danger striped example" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar progress-bar-striped bg-danger" style="width: 100%"></div>
    +</div>
    +

    Animated stripes

    The striped gradient can also be animated. Add .progress-bar-animated to .progress-bar to animate the stripes right to left via CSS3 animations.

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="progress" role="progressbar" aria-label="Animated striped example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar progress-bar-striped progress-bar-animated" style="width: 75%"></div>
    -</div>
    -
    - -

    CSS

    -

    Variables

    +
    html
    <div class="progress" role="progressbar" aria-label="Animated striped example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar progress-bar-striped progress-bar-animated" style="width: 75%"></div>
    +</div>
    +

    CSS

    +

    Variables

    Added in v5.2.0 - -

    As part of Bootstrap’s evolving CSS variables approach, progress bars now use local CSS variables on .progress for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    -
    -
    - scss/_progress.scss -
    - -
    -
    --#{$prefix}progress-height: #{$progress-height};
    -@include rfs($progress-font-size, --#{$prefix}progress-font-size);
    ---#{$prefix}progress-bg: #{$progress-bg};
    ---#{$prefix}progress-border-radius: #{$progress-border-radius};
    ---#{$prefix}progress-box-shadow: #{$progress-box-shadow};
    ---#{$prefix}progress-bar-color: #{$progress-bar-color};
    ---#{$prefix}progress-bar-bg: #{$progress-bar-bg};
    ---#{$prefix}progress-bar-transition: #{$progress-bar-transition};
    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $progress-height:                   1rem;
    -$progress-font-size:                $font-size-base * .75;
    -$progress-bg:                       var(--#{$prefix}secondary-bg);
    -$progress-border-radius:            var(--#{$prefix}border-radius);
    -$progress-box-shadow:               var(--#{$prefix}box-shadow-inset);
    -$progress-bar-color:                $white;
    -$progress-bar-bg:                   $primary;
    -$progress-bar-animation-timing:     1s linear infinite;
    -$progress-bar-transition:           width .6s ease;
    -
    -

    Keyframes

    +

    As part of Bootstrap’s evolving CSS variables approach, progress bars now use local CSS variables on .progress for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    +
    --#{$prefix}progress-height: #{$progress-height};
    +@include rfs($progress-font-size, --#{$prefix}progress-font-size);
    +--#{$prefix}progress-bg: #{$progress-bg};
    +--#{$prefix}progress-border-radius: #{$progress-border-radius};
    +--#{$prefix}progress-box-shadow: #{$progress-box-shadow};
    +--#{$prefix}progress-bar-color: #{$progress-bar-color};
    +--#{$prefix}progress-bar-bg: #{$progress-bar-bg};
    +--#{$prefix}progress-bar-transition: #{$progress-bar-transition};
    +
    +

    Sass variables

    +
    $progress-height:                   1rem;
    +$progress-font-size:                $font-size-base * .75;
    +$progress-bg:                       var(--#{$prefix}secondary-bg);
    +$progress-border-radius:            var(--#{$prefix}border-radius);
    +$progress-box-shadow:               var(--#{$prefix}box-shadow-inset);
    +$progress-bar-color:                $white;
    +$progress-bar-bg:                   $primary;
    +$progress-bar-animation-timing:     1s linear infinite;
    +$progress-bar-transition:           width .6s ease;
    +
    +

    Keyframes

    Used for creating the CSS animations for .progress-bar-animated. Included in scss/_progress-bar.scss.

    -
    -
    - scss/_progress.scss -
    - -
    -
    @if $enable-transitions {
    -  @keyframes progress-bar-stripes {
    -    0% { background-position-x: var(--#{$prefix}progress-height); }
    -  }
    -}
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    @if $enable-transitions {
    +  @keyframes progress-bar-stripes {
    +    0% { background-position-x: var(--#{$prefix}progress-height); }
    +  }
    +}
    +
    \ No newline at end of file diff --git a/docs/5.3/components/scrollspy/index.html b/docs/5.3/components/scrollspy/index.html index ae69268e02..cdc174f040 100644 --- a/docs/5.3/components/scrollspy/index.html +++ b/docs/5.3/components/scrollspy/index.html @@ -1,579 +1,28 @@ - - - - - - - - - - - - - - - - -Scrollspy · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Scrollspy

    -
    -

    Automatically update Bootstrap navigation or list group components based on scroll position to indicate which link is currently active in the viewport.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    How it works

    -

    Scrollspy toggles the .active class on anchor (<a>) elements when the element with the id referenced by the anchor’s href is scrolled into view. Scrollspy is best used in conjunction with a Bootstrap nav component or list group, but it will also work with any anchor elements in the current page. Here’s how it works.

    + Scrollspy · Bootstrap v5.3

    Automatically update Bootstrap navigation or list group components based on scroll position to indicate which link is currently active in the viewport.

    +

    How it works

    +

    Scrollspy toggles the .active class on anchor (<a>) elements when the element with the id referenced by the anchor’s href is scrolled into view. Scrollspy is best used in conjunction with a Bootstrap nav component or list group, but it will also work with any anchor elements in the current page. Here’s how it works.

    • To start, scrollspy requires two things: a navigation, list group, or a simple set of links, plus a scrollable container. The scrollable container can be the <body> or a custom element with a set height and overflow-y: scroll.

      @@ -582,498 +31,315 @@

      On the scrollable container, add data-bs-spy="scroll" and data-bs-target="#navId" where navId is the unique id of the associated navigation. If there is no focusable element inside the element, be sure to also include a tabindex="0" to ensure keyboard access.

    • -

      As you scroll the “spied” container, an .active class is added and removed from anchor links within the associated navigation. Links must have resolvable id targets, otherwise they’re ignored. For example, a <a href="#home">home</a> must correspond to something in the DOM like <div id="home"></div>

      +

      As you scroll the “spied” container, an .active class is added and removed from anchor links within the associated navigation. Links must have resolvable id targets, otherwise they’re ignored. For example, a <a href="#home">home</a> must correspond to something in the DOM like <div id="home"></div>

    • Target elements that are not visible will be ignored. See the Non-visible elements section below.

    -

    Examples

    - +

    Examples

    +

    Scroll the area below the navbar and watch the active class change. Open the dropdown menu and watch the dropdown items be highlighted as well.

    -
    - -
    -

    First heading

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Second heading

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Third heading

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Fourth heading

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Fifth heading

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -
    -
    -
    <nav id="navbar-example2" class="navbar bg-body-tertiary px-3 mb-3">
    -  <a class="navbar-brand" href="#">Navbar</a>
    -  <ul class="nav nav-pills">
    -    <li class="nav-item">
    -      <a class="nav-link" href="#scrollspyHeading1">First</a>
    -    </li>
    -    <li class="nav-item">
    -      <a class="nav-link" href="#scrollspyHeading2">Second</a>
    -    </li>
    -    <li class="nav-item dropdown">
    -      <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">Dropdown</a>
    -      <ul class="dropdown-menu">
    -        <li><a class="dropdown-item" href="#scrollspyHeading3">Third</a></li>
    -        <li><a class="dropdown-item" href="#scrollspyHeading4">Fourth</a></li>
    -        <li><hr class="dropdown-divider"></li>
    -        <li><a class="dropdown-item" href="#scrollspyHeading5">Fifth</a></li>
    -      </ul>
    -    </li>
    -  </ul>
    -</nav>
    -<div data-bs-spy="scroll" data-bs-target="#navbar-example2" data-bs-root-margin="0px 0px -40%" data-bs-smooth-scroll="true" class="scrollspy-example bg-body-tertiary p-3 rounded-2" tabindex="0">
    -  <h4 id="scrollspyHeading1">First heading</h4>
    -  <p>...</p>
    -  <h4 id="scrollspyHeading2">Second heading</h4>
    -  <p>...</p>
    -  <h4 id="scrollspyHeading3">Third heading</h4>
    -  <p>...</p>
    -  <h4 id="scrollspyHeading4">Fourth heading</h4>
    -  <p>...</p>
    -  <h4 id="scrollspyHeading5">Fifth heading</h4>
    -  <p>...</p>
    -</div>
    -

    Nested nav

    +
    +
    +

    First heading

    +

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    +

    Second heading

    +

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    +

    Third heading

    +

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    +

    Fourth heading

    +

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    +

    Fifth heading

    +

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    +
    +
    <nav id="navbar-example2" class="navbar bg-body-tertiary px-3 mb-3">
    +  <a class="navbar-brand" href="#">Navbar</a>
    +  <ul class="nav nav-pills">
    +    <li class="nav-item">
    +      <a class="nav-link" href="#scrollspyHeading1">First</a>
    +    </li>
    +    <li class="nav-item">
    +      <a class="nav-link" href="#scrollspyHeading2">Second</a>
    +    </li>
    +    <li class="nav-item dropdown">
    +      <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">Dropdown</a>
    +      <ul class="dropdown-menu">
    +        <li><a class="dropdown-item" href="#scrollspyHeading3">Third</a></li>
    +        <li><a class="dropdown-item" href="#scrollspyHeading4">Fourth</a></li>
    +        <li><hr class="dropdown-divider"></li>
    +        <li><a class="dropdown-item" href="#scrollspyHeading5">Fifth</a></li>
    +      </ul>
    +    </li>
    +  </ul>
    +</nav>
    +<div data-bs-spy="scroll" data-bs-target="#navbar-example2" data-bs-root-margin="0px 0px -40%" data-bs-smooth-scroll="true" class="scrollspy-example bg-body-tertiary p-3 rounded-2" tabindex="0">
    +  <h4 id="scrollspyHeading1">First heading</h4>
    +  <p>...</p>
    +  <h4 id="scrollspyHeading2">Second heading</h4>
    +  <p>...</p>
    +  <h4 id="scrollspyHeading3">Third heading</h4>
    +  <p>...</p>
    +  <h4 id="scrollspyHeading4">Fourth heading</h4>
    +  <p>...</p>
    +  <h4 id="scrollspyHeading5">Fifth heading</h4>
    +  <p>...</p>
    +</div>
    +
    +

    Nested nav

    Scrollspy also works with nested .navs. If a nested .nav is .active, its parents will also be .active. Scroll the area next to the navbar and watch the active class change.

    -
    -
    -
    - -
    -
    -
    -
    -

    Item 1

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Keep in mind that the JavaScript plugin tries to pick the right element among all that may be visible. Multiple visible scrollspy targets at the same time may cause some issues.

    -
    -
    -
    Item 1-1
    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Keep in mind that the JavaScript plugin tries to pick the right element among all that may be visible. Multiple visible scrollspy targets at the same time may cause some issues.

    -
    -
    -
    Item 1-2
    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Keep in mind that the JavaScript plugin tries to pick the right element among all that may be visible. Multiple visible scrollspy targets at the same time may cause some issues.

    -
    -
    -

    Item 2

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Keep in mind that the JavaScript plugin tries to pick the right element among all that may be visible. Multiple visible scrollspy targets at the same time may cause some issues.

    -
    -
    -

    Item 3

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Keep in mind that the JavaScript plugin tries to pick the right element among all that may be visible. Multiple visible scrollspy targets at the same time may cause some issues.

    -
    -
    -
    Item 3-1
    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Keep in mind that the JavaScript plugin tries to pick the right element among all that may be visible. Multiple visible scrollspy targets at the same time may cause some issues.

    -
    -
    -
    Item 3-2
    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Keep in mind that the JavaScript plugin tries to pick the right element among all that may be visible. Multiple visible scrollspy targets at the same time may cause some issues.

    -
    -
    -
    -
    -
    -
    <div class="row">
    -  <div class="col-4">
    -    <nav id="navbar-example3" class="h-100 flex-column align-items-stretch pe-4 border-end">
    -      <nav class="nav nav-pills flex-column">
    -        <a class="nav-link" href="#item-1">Item 1</a>
    -        <nav class="nav nav-pills flex-column">
    -          <a class="nav-link ms-3 my-1" href="#item-1-1">Item 1-1</a>
    -          <a class="nav-link ms-3 my-1" href="#item-1-2">Item 1-2</a>
    -        </nav>
    -        <a class="nav-link" href="#item-2">Item 2</a>
    -        <a class="nav-link" href="#item-3">Item 3</a>
    -        <nav class="nav nav-pills flex-column">
    -          <a class="nav-link ms-3 my-1" href="#item-3-1">Item 3-1</a>
    -          <a class="nav-link ms-3 my-1" href="#item-3-2">Item 3-2</a>
    -        </nav>
    -      </nav>
    -    </nav>
    -  </div>
    -
    -  <div class="col-8">
    -    <div data-bs-spy="scroll" data-bs-target="#navbar-example3" data-bs-smooth-scroll="true" class="scrollspy-example-2" tabindex="0">
    -      <div id="item-1">
    -        <h4>Item 1</h4>
    -        <p>...</p>
    -      </div>
    -      <div id="item-1-1">
    -        <h5>Item 1-1</h5>
    -        <p>...</p>
    -      </div>
    -      <div id="item-1-2">
    -        <h5>Item 1-2</h5>
    -        <p>...</p>
    -      </div>
    -      <div id="item-2">
    -        <h4>Item 2</h4>
    -        <p>...</p>
    -      </div>
    -      <div id="item-3">
    -        <h4>Item 3</h4>
    -        <p>...</p>
    -      </div>
    -      <div id="item-3-1">
    -        <h5>Item 3-1</h5>
    -        <p>...</p>
    -      </div>
    -      <div id="item-3-2">
    -        <h5>Item 3-2</h5>
    -        <p>...</p>
    -      </div>
    -    </div>
    -  </div>
    -</div>
    -

    List group

    +

    Item 1

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Keep in mind that the JavaScript plugin tries to pick the right element among all that may be visible. Multiple visible scrollspy targets at the same time may cause some issues.

    Item 1-1

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Keep in mind that the JavaScript plugin tries to pick the right element among all that may be visible. Multiple visible scrollspy targets at the same time may cause some issues.

    Item 1-2

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Keep in mind that the JavaScript plugin tries to pick the right element among all that may be visible. Multiple visible scrollspy targets at the same time may cause some issues.

    Item 2

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Keep in mind that the JavaScript plugin tries to pick the right element among all that may be visible. Multiple visible scrollspy targets at the same time may cause some issues.

    Item 3

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Keep in mind that the JavaScript plugin tries to pick the right element among all that may be visible. Multiple visible scrollspy targets at the same time may cause some issues.

    Item 3-1

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Keep in mind that the JavaScript plugin tries to pick the right element among all that may be visible. Multiple visible scrollspy targets at the same time may cause some issues.

    Item 3-2

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Keep in mind that the JavaScript plugin tries to pick the right element among all that may be visible. Multiple visible scrollspy targets at the same time may cause some issues.

    +
    <div class="row">
    +  <div class="col-4">
    +    <nav id="navbar-example3" class="h-100 flex-column align-items-stretch pe-4 border-end">
    +      <nav class="nav nav-pills flex-column">
    +        <a class="nav-link" href="#item-1">Item 1</a>
    +        <nav class="nav nav-pills flex-column">
    +          <a class="nav-link ms-3 my-1" href="#item-1-1">Item 1-1</a>
    +          <a class="nav-link ms-3 my-1" href="#item-1-2">Item 1-2</a>
    +        </nav>
    +        <a class="nav-link" href="#item-2">Item 2</a>
    +        <a class="nav-link" href="#item-3">Item 3</a>
    +        <nav class="nav nav-pills flex-column">
    +          <a class="nav-link ms-3 my-1" href="#item-3-1">Item 3-1</a>
    +          <a class="nav-link ms-3 my-1" href="#item-3-2">Item 3-2</a>
    +        </nav>
    +      </nav>
    +    </nav>
    +  </div>
    +
    +  <div class="col-8">
    +    <div data-bs-spy="scroll" data-bs-target="#navbar-example3" data-bs-smooth-scroll="true" class="scrollspy-example-2" tabindex="0">
    +      <div id="item-1">
    +        <h4>Item 1</h4>
    +        <p>...</p>
    +      </div>
    +      <div id="item-1-1">
    +        <h5>Item 1-1</h5>
    +        <p>...</p>
    +      </div>
    +      <div id="item-1-2">
    +        <h5>Item 1-2</h5>
    +        <p>...</p>
    +      </div>
    +      <div id="item-2">
    +        <h4>Item 2</h4>
    +        <p>...</p>
    +      </div>
    +      <div id="item-3">
    +        <h4>Item 3</h4>
    +        <p>...</p>
    +      </div>
    +      <div id="item-3-1">
    +        <h5>Item 3-1</h5>
    +        <p>...</p>
    +      </div>
    +      <div id="item-3-2">
    +        <h5>Item 3-2</h5>
    +        <p>...</p>
    +      </div>
    +    </div>
    +  </div>
    +</div>
    +
    +

    List group

    Scrollspy also works with .list-groups. Scroll the area next to the list group and watch the active class change.

    -
    -
    -
    - -
    -
    -
    -

    Item 1

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Item 2

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Item 3

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Item 4

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -
    -
    -
    -
    -
    <div class="row">
    -  <div class="col-4">
    -    <div id="list-example" class="list-group">
    -      <a class="list-group-item list-group-item-action" href="#list-item-1">Item 1</a>
    -      <a class="list-group-item list-group-item-action" href="#list-item-2">Item 2</a>
    -      <a class="list-group-item list-group-item-action" href="#list-item-3">Item 3</a>
    -      <a class="list-group-item list-group-item-action" href="#list-item-4">Item 4</a>
    -    </div>
    -  </div>
    -  <div class="col-8">
    -    <div data-bs-spy="scroll" data-bs-target="#list-example" data-bs-smooth-scroll="true" class="scrollspy-example" tabindex="0">
    -      <h4 id="list-item-1">Item 1</h4>
    -      <p>...</p>
    -      <h4 id="list-item-2">Item 2</h4>
    -      <p>...</p>
    -      <h4 id="list-item-3">Item 3</h4>
    -      <p>...</p>
    -      <h4 id="list-item-4">Item 4</h4>
    -      <p>...</p>
    -    </div>
    -  </div>
    -</div>
    -

    Simple anchors

    +

    Item 1

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Item 2

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Item 3

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Item 4

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    +
    <div class="row">
    +  <div class="col-4">
    +    <div id="list-example" class="list-group">
    +      <a class="list-group-item list-group-item-action" href="#list-item-1">Item 1</a>
    +      <a class="list-group-item list-group-item-action" href="#list-item-2">Item 2</a>
    +      <a class="list-group-item list-group-item-action" href="#list-item-3">Item 3</a>
    +      <a class="list-group-item list-group-item-action" href="#list-item-4">Item 4</a>
    +    </div>
    +  </div>
    +  <div class="col-8">
    +    <div data-bs-spy="scroll" data-bs-target="#list-example" data-bs-smooth-scroll="true" class="scrollspy-example" tabindex="0">
    +      <h4 id="list-item-1">Item 1</h4>
    +      <p>...</p>
    +      <h4 id="list-item-2">Item 2</h4>
    +      <p>...</p>
    +      <h4 id="list-item-3">Item 3</h4>
    +      <p>...</p>
    +      <h4 id="list-item-4">Item 4</h4>
    +      <p>...</p>
    +    </div>
    +  </div>
    +</div>
    +
    +

    Simple anchors

    Scrollspy is not limited to nav components and list groups, so it will work on any <a> anchor elements in the current document. Scroll the area and watch the .active class change.

    -
    -
    -
    - -
    -
    -
    -

    Item 1

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Item 2

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Item 3

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Item 4

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Item 5

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -
    -
    -
    -
    -
    <div class="row">
    -  <div class="col-4">
    -    <div id="simple-list-example" class="d-flex flex-column gap-2 simple-list-example-scrollspy text-center">
    -      <a class="p-1 rounded" href="#simple-list-item-1">Item 1</a>
    -      <a class="p-1 rounded" href="#simple-list-item-2">Item 2</a>
    -      <a class="p-1 rounded" href="#simple-list-item-3">Item 3</a>
    -      <a class="p-1 rounded" href="#simple-list-item-4">Item 4</a>
    -      <a class="p-1 rounded" href="#simple-list-item-5">Item 5</a>
    -    </div>
    -  </div>
    -  <div class="col-8">
    -    <div data-bs-spy="scroll" data-bs-target="#simple-list-example" data-bs-offset="0" data-bs-smooth-scroll="true" class="scrollspy-example" tabindex="0">
    -      <h4 id="simple-list-item-1">Item 1</h4>
    -      <p>...</p>
    -      <h4 id="simple-list-item-2">Item 2</h4>
    -      <p>...</p>
    -      <h4 id="simple-list-item-3">Item 3</h4>
    -      <p>...</p>
    -      <h4 id="simple-list-item-4">Item 4</h4>
    -      <p>...</p>
    -      <h4 id="simple-list-item-5">Item 5</h4>
    -      <p>...</p>
    -    </div>
    -  </div>
    -</div>
    -

    Non-visible elements

    -

    Target elements that aren’t visible will be ignored and their corresponding nav items won’t receive an .active class. Scrollspy instances initialized in a non-visible wrapper will ignore all target elements. Use the refresh method to check for observable elements once the wrapper becomes visible.

    -
    document.querySelectorAll('#nav-tab>[data-bs-toggle="tab"]').forEach(el => {
    -  el.addEventListener('shown.bs.tab', () => {
    -    const target = el.getAttribute('data-bs-target')
    -    const scrollElem = document.querySelector(`${target} [data-bs-spy="scroll"]`)
    -    bootstrap.ScrollSpy.getOrCreateInstance(scrollElem).refresh()
    -  })
    -})
    -

    Usage

    -

    Via data attributes

    +

    Item 1

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Item 2

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Item 3

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Item 4

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Item 5

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It’s repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    +
    <div class="row">
    +  <div class="col-4">
    +    <div id="simple-list-example" class="d-flex flex-column gap-2 simple-list-example-scrollspy text-center">
    +      <a class="p-1 rounded" href="#simple-list-item-1">Item 1</a>
    +      <a class="p-1 rounded" href="#simple-list-item-2">Item 2</a>
    +      <a class="p-1 rounded" href="#simple-list-item-3">Item 3</a>
    +      <a class="p-1 rounded" href="#simple-list-item-4">Item 4</a>
    +      <a class="p-1 rounded" href="#simple-list-item-5">Item 5</a>
    +    </div>
    +  </div>
    +  <div class="col-8">
    +    <div data-bs-spy="scroll" data-bs-target="#simple-list-example" data-bs-offset="0" data-bs-smooth-scroll="true" class="scrollspy-example" tabindex="0">
    +      <h4 id="simple-list-item-1">Item 1</h4>
    +      <p>...</p>
    +      <h4 id="simple-list-item-2">Item 2</h4>
    +      <p>...</p>
    +      <h4 id="simple-list-item-3">Item 3</h4>
    +      <p>...</p>
    +      <h4 id="simple-list-item-4">Item 4</h4>
    +      <p>...</p>
    +      <h4 id="simple-list-item-5">Item 5</h4>
    +      <p>...</p>
    +    </div>
    +  </div>
    +</div>
    +
    +

    Non-visible elements

    +

    Target elements that aren’t visible will be ignored and their corresponding nav items won’t receive an .active class. Scrollspy instances initialized in a non-visible wrapper will ignore all target elements. Use the refresh method to check for observable elements once the wrapper becomes visible.

    +
    document.querySelectorAll('#nav-tab>[data-bs-toggle="tab"]').forEach(el => {
    +  el.addEventListener('shown.bs.tab', () => {
    +    const target = el.getAttribute('data-bs-target')
    +    const scrollElem = document.querySelector(`${target} [data-bs-spy="scroll"]`)
    +    bootstrap.ScrollSpy.getOrCreateInstance(scrollElem).refresh()
    +  })
    +})
    +
    +

    Usage

    +

    Via data attributes

    To easily add scrollspy behavior to your topbar navigation, add data-bs-spy="scroll" to the element you want to spy on (most typically this would be the <body>). Then add the data-bs-target attribute with the id or class name of the parent element of any Bootstrap .nav component.

    -
    <body data-bs-spy="scroll" data-bs-target="#navbar-example">
    -  ...
    -  <div id="navbar-example">
    -    <ul class="nav nav-tabs" role="tablist">
    -      ...
    -    </ul>
    -  </div>
    -  ...
    -</body>
    -

    Via JavaScript

    -
    const scrollSpy = new bootstrap.ScrollSpy(document.body, {
    -  target: '#navbar-example'
    -})
    -

    Options

    -

    As options can be passed via data attributes or JavaScript, you can append an option name to data-bs-, as in data-bs-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-bs-custom-class="beautifier" instead of data-bs-customClass="beautifier".

    -

    As of Bootstrap 5.2.0, all components support an experimental reserved data attribute data-bs-config that can house simple component configuration as a JSON string. When an element has data-bs-config='{"delay":0, "title":123}' and data-bs-title="456" attributes, the final title value will be 456 and the separate data attributes will override values given on data-bs-config. In addition, existing data attributes are able to house JSON values like data-bs-delay='{"show":0,"hide":150}'.

    +
    <body data-bs-spy="scroll" data-bs-target="#navbar-example">
    +  ...
    +  <div id="navbar-example">
    +    <ul class="nav nav-tabs" role="tablist">
    +      ...
    +    </ul>
    +  </div>
    +  ...
    +</body>
    +
    +

    Via JavaScript

    +
    const scrollSpy = new bootstrap.ScrollSpy(document.body, {
    +  target: '#navbar-example'
    +})
    +
    +

    Options

    +

    As options can be passed via data attributes or JavaScript, you can append an option name to data-bs-, as in data-bs-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-bs-custom-class="beautifier" instead of data-bs-customClass="beautifier".

    +

    As of Bootstrap 5.2.0, all components support an experimental reserved data attribute data-bs-config that can house simple component configuration as a JSON string. When an element has data-bs-config='{"delay":0, "title":123}' and data-bs-title="456" attributes, the final title value will be 456 and the separate data attributes will override values given on data-bs-config. In addition, existing data attributes are able to house JSON values like data-bs-delay='{"show":0,"hide":150}'.

    The final configuration object is the merged result of data-bs-config, data-bs-, and js object where the latest given key-value overrides the others.

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDefaultDescription
    rootMarginstring0px 0px -25%Intersection Observer rootMargin valid units, when calculating scroll position.
    smoothScrollbooleanfalseEnables smooth scrolling when a user clicks on a link that refers to ScrollSpy observables.
    targetstring, DOM elementnullSpecifies element to apply Scrollspy plugin.
    thresholdarray[0.1, 0.5, 1]IntersectionObserver threshold valid input, when calculating scroll position.
    - -
    -

    Deprecated Options

    -

    Up until v5.1.3 we were using offset & method options, which are now deprecated and replaced by rootMargin. -To keep backwards compatibility, we will continue to parse a given offset to rootMargin, but this feature will be removed in v6.

    - -
    - -

    Methods

    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    MethodDescription
    disposeDestroys an element’s scrollspy. (Removes stored data on the DOM element)
    getInstanceStatic method to get the scrollspy instance associated with a DOM element.
    getOrCreateInstanceStatic method to get the scrollspy instance associated with a DOM element, or to create a new one in case it wasn’t initialized.
    refreshWhen adding or removing elements in the DOM, you’ll need to call the refresh method.
    - -

    Here’s an example using the refresh method:

    -
    const dataSpyList = document.querySelectorAll('[data-bs-spy="scroll"]')
    -dataSpyList.forEach(dataSpyEl => {
    -  bootstrap.ScrollSpy.getInstance(dataSpyEl).refresh()
    -})
    -

    Events

    -
    - - - - - - - - - - - - -
    EventDescription
    activate.bs.scrollspyThis event fires on the scroll element whenever an anchor is activated by the scrollspy.
    - -
    const firstScrollSpyEl = document.querySelector('[data-bs-spy="scroll"]')
    -firstScrollSpyEl.addEventListener('activate.bs.scrollspy', () => {
    -  // do something...
    -})
    -
    -
    -
    -
    +
    - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDefaultDescription
    rootMarginstring0px 0px -25%Intersection Observer rootMargin valid units, when calculating scroll position.
    smoothScrollbooleanfalseEnables smooth scrolling when a user clicks on a link that refers to ScrollSpy observables.
    targetstring, DOM elementnullSpecifies element to apply Scrollspy plugin.
    thresholdarray[0.1, 0.5, 1]IntersectionObserver threshold valid input, when calculating scroll position.
    +

    Deprecated Options

    Up until v5.1.3 we were using offset & method options, which are now deprecated and replaced by rootMargin. +To keep backwards compatibility, we will continue to parse a given offset to rootMargin, but this feature will be removed in v6.

    +

    Methods

    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    MethodDescription
    disposeDestroys an element’s scrollspy. (Removes stored data on the DOM element)
    getInstanceStatic method to get the scrollspy instance associated with a DOM element.
    getOrCreateInstanceStatic method to get the scrollspy instance associated with a DOM element, or to create a new one in case it wasn’t initialized.
    refreshWhen adding or removing elements in the DOM, you’ll need to call the refresh method.
    +

    Here’s an example using the refresh method:

    +
    const dataSpyList = document.querySelectorAll('[data-bs-spy="scroll"]')
    +dataSpyList.forEach(dataSpyEl => {
    +  bootstrap.ScrollSpy.getInstance(dataSpyEl).refresh()
    +})
    +
    +

    Events

    +
    + + + + + + + + + + + + +
    EventDescription
    activate.bs.scrollspyThis event fires on the scroll element whenever an anchor is activated by the scrollspy.
    +
    const firstScrollSpyEl = document.querySelector('[data-bs-spy="scroll"]')
    +firstScrollSpyEl.addEventListener('activate.bs.scrollspy', () => {
    +  // do something...
    +})
    +
    \ No newline at end of file diff --git a/docs/5.3/components/spinners/index.html b/docs/5.3/components/spinners/index.html index 5598330eb8..44fd51f9be 100644 --- a/docs/5.3/components/spinners/index.html +++ b/docs/5.3/components/spinners/index.html @@ -1,624 +1,40 @@ - - - - - - - - - - - - - - - - -Spinners · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Spinners

    -
    -

    Indicate the loading state of a component or page with Bootstrap spinners, built entirely with HTML, CSS, and no JavaScript.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    About

    -

    Bootstrap “spinners” can be used to show the loading state in your projects. They’re built only with HTML and CSS, meaning you don’t need any JavaScript to create them. You will, however, need some custom JavaScript to toggle their visibility. Their appearance, alignment, and sizing can be easily customized with our amazing utility classes.

    + Spinners · Bootstrap v5.3

    Indicate the loading state of a component or page with Bootstrap spinners, built entirely with HTML, CSS, and no JavaScript.

    +

    About

    +

    Bootstrap “spinners” can be used to show the loading state in your projects. They’re built only with HTML and CSS, meaning you don’t need any JavaScript to create them. You will, however, need some custom JavaScript to toggle their visibility. Their appearance, alignment, and sizing can be easily customized with our amazing utility classes.

    For accessibility purposes, each loader here includes role="status" and a nested <span class="visually-hidden">Loading...</span>.

    -
    -The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation. -
    - -

    Border spinner

    +

    The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation.

    +

    Border spinner

    Use the border spinners for a lightweight loading indicator.

    -
    -
    - -
    +
    Loading... -
    - -
    - html -
    - - -
    -
    <div class="spinner-border" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -
    - -

    Colors

    -

    The border spinner uses currentColor for its border-color, meaning you can customize the color with text color utilities. You can use any of our text color utilities on the standard spinner.

    -
    -
    - - -
    +
    html
    <div class="spinner-border" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +

    Colors

    +

    The border spinner uses currentColor for its border-color, meaning you can customize the color with text color utilities. You can use any of our text color utilities on the standard spinner.

    +
    Loading...
    @@ -641,78 +57,40 @@ The animation effect of this component is dependent on the prefers-reduced
    Loading... -
    - -
    - html -
    - - -
    -
    <div class="spinner-border text-primary" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -<div class="spinner-border text-secondary" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -<div class="spinner-border text-success" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -<div class="spinner-border text-danger" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -<div class="spinner-border text-warning" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -<div class="spinner-border text-info" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -<div class="spinner-border text-light" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -<div class="spinner-border text-dark" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -
    - -
    -Why not use border-color utilities? Each border spinner specifies a transparent border for at least one side, so .border-{color} utilities would override that. -
    - -

    Growing spinner

    -

    If you don’t fancy a border spinner, switch to the grow spinner. While it doesn’t technically spin, it does repeatedly grow!

    -
    -
    - -
    +
    html
    <div class="spinner-border text-primary" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +<div class="spinner-border text-secondary" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +<div class="spinner-border text-success" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +<div class="spinner-border text-danger" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +<div class="spinner-border text-warning" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +<div class="spinner-border text-info" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +<div class="spinner-border text-light" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +<div class="spinner-border text-dark" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +

    Why not use border-color utilities? Each border spinner specifies a transparent border for at least one side, so .border-{color} utilities would override that.

    +

    Growing spinner

    +

    If you don’t fancy a border spinner, switch to the grow spinner. While it doesn’t technically spin, it does repeatedly grow!

    +
    Loading... -
    - -
    - html -
    - - -
    -
    <div class="spinner-grow" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -
    - -

    Once again, this spinner is built with currentColor, so you can easily change its appearance with text color utilities. Here it is in blue, along with the supported variants.

    -
    -
    - - -
    +
    html
    <div class="spinner-grow" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +

    Once again, this spinner is built with currentColor, so you can easily change its appearance with text color utilities. Here it is in blue, along with the supported variants.

    +
    Loading...
    @@ -735,473 +113,187 @@ The animation effect of this component is dependent on the prefers-reduced
    Loading... -
    - -
    - html -
    - - -
    -
    <div class="spinner-grow text-primary" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -<div class="spinner-grow text-secondary" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -<div class="spinner-grow text-success" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -<div class="spinner-grow text-danger" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -<div class="spinner-grow text-warning" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -<div class="spinner-grow text-info" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -<div class="spinner-grow text-light" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -<div class="spinner-grow text-dark" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -
    - -

    Alignment

    +
    html
    <div class="spinner-grow text-primary" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +<div class="spinner-grow text-secondary" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +<div class="spinner-grow text-success" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +<div class="spinner-grow text-danger" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +<div class="spinner-grow text-warning" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +<div class="spinner-grow text-info" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +<div class="spinner-grow text-light" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +<div class="spinner-grow text-dark" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +

    Alignment

    Spinners in Bootstrap are built with rems, currentColor, and display: inline-flex. This means they can easily be resized, recolored, and quickly aligned.

    -

    Margin

    -

    Use margin utilities like .m-5 for easy spacing.

    -
    -
    - -
    +

    Margin

    +

    Use margin utilities like .m-5 for easy spacing.

    +
    Loading... -
    - -
    - html -
    - - -
    -
    <div class="spinner-border m-5" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -
    - -

    Placement

    -

    Use flexbox utilities, float utilities, or text alignment utilities to place spinners exactly where you need them in any situation.

    -

    Flex

    -
    -
    - -
    +
    html
    <div class="spinner-border m-5" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +

    Placement

    +

    Use flexbox utilities, float utilities, or text alignment utilities to place spinners exactly where you need them in any situation.

    +

    Flex

    +
    Loading...
    -
    - -
    - html -
    - - -
    -
    <div class="d-flex justify-content-center">
    -  <div class="spinner-border" role="status">
    -    <span class="visually-hidden">Loading...</span>
    -  </div>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="d-flex justify-content-center">
    +  <div class="spinner-border" role="status">
    +    <span class="visually-hidden">Loading...</span>
    +  </div>
    +</div>
    +
    Loading... -
    - -
    - html -
    - - -
    -
    <div class="d-flex align-items-center">
    -  <strong role="status">Loading...</strong>
    -  <div class="spinner-border ms-auto" aria-hidden="true"></div>
    -</div>
    -
    - -

    Floats

    -
    -
    - -
    +
    html
    <div class="d-flex align-items-center">
    +  <strong role="status">Loading...</strong>
    +  <div class="spinner-border ms-auto" aria-hidden="true"></div>
    +</div>
    +

    Floats

    +
    Loading...
    -
    - -
    - html -
    - - -
    -
    <div class="clearfix">
    -  <div class="spinner-border float-end" role="status">
    -    <span class="visually-hidden">Loading...</span>
    -  </div>
    -</div>
    -
    - -

    Text align

    -
    -
    - -
    +
    html
    <div class="clearfix">
    +  <div class="spinner-border float-end" role="status">
    +    <span class="visually-hidden">Loading...</span>
    +  </div>
    +</div>
    +

    Text align

    +
    Loading...
    -
    - -
    - html -
    - - -
    -
    <div class="text-center">
    -  <div class="spinner-border" role="status">
    -    <span class="visually-hidden">Loading...</span>
    -  </div>
    -</div>
    -
    - -

    Size

    +
    html
    <div class="text-center">
    +  <div class="spinner-border" role="status">
    +    <span class="visually-hidden">Loading...</span>
    +  </div>
    +</div>
    +

    Size

    Add .spinner-border-sm and .spinner-grow-sm to make a smaller spinner that can quickly be used within other components.

    -
    -
    - -
    +
    Loading...
    Loading... -
    - -
    - html -
    - - -
    -
    <div class="spinner-border spinner-border-sm" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -<div class="spinner-grow spinner-grow-sm" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -
    - +
    html
    <div class="spinner-border spinner-border-sm" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +<div class="spinner-grow spinner-grow-sm" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>

    Or, use custom CSS or inline styles to change the dimensions as needed.

    -
    -
    - -
    +
    Loading...
    Loading... -
    - -
    - html -
    - - -
    -
    <div class="spinner-border" style="width: 3rem; height: 3rem;" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -<div class="spinner-grow" style="width: 3rem; height: 3rem;" role="status">
    -  <span class="visually-hidden">Loading...</span>
    -</div>
    -
    - -

    Buttons

    +
    html
    <div class="spinner-border" style="width: 3rem; height: 3rem;" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +<div class="spinner-grow" style="width: 3rem; height: 3rem;" role="status">
    +  <span class="visually-hidden">Loading...</span>
    +</div>
    +

    Buttons

    Use spinners within buttons to indicate an action is currently processing or taking place. You may also swap the text out of the spinner element and utilize button text as needed.

    -
    -
    - - - -
    - html -
    - - -
    -
    <button class="btn btn-primary" type="button" disabled>
    -  <span class="spinner-border spinner-border-sm" aria-hidden="true"></span>
    -  <span class="visually-hidden" role="status">Loading...</span>
    -</button>
    -<button class="btn btn-primary" type="button" disabled>
    -  <span class="spinner-border spinner-border-sm" aria-hidden="true"></span>
    -  <span role="status">Loading...</span>
    -</button>
    -
    - -
    -
    - -
    html
    <button class="btn btn-primary" type="button" disabled>
    +  <span class="spinner-border spinner-border-sm" aria-hidden="true"></span>
    +  <span class="visually-hidden" role="status">Loading...</span>
    +</button>
    +<button class="btn btn-primary" type="button" disabled>
    +  <span class="spinner-border spinner-border-sm" aria-hidden="true"></span>
    +  <span role="status">Loading...</span>
    +</button>
    +
    - -
    - html -
    - - -
    -
    <button class="btn btn-primary" type="button" disabled>
    -  <span class="spinner-grow spinner-grow-sm" aria-hidden="true"></span>
    -  <span class="visually-hidden" role="status">Loading...</span>
    -</button>
    -<button class="btn btn-primary" type="button" disabled>
    -  <span class="spinner-grow spinner-grow-sm" aria-hidden="true"></span>
    -  <span role="status">Loading...</span>
    -</button>
    -
    - -

    CSS

    -

    Variables

    +
    html
    <button class="btn btn-primary" type="button" disabled>
    +  <span class="spinner-grow spinner-grow-sm" aria-hidden="true"></span>
    +  <span class="visually-hidden" role="status">Loading...</span>
    +</button>
    +<button class="btn btn-primary" type="button" disabled>
    +  <span class="spinner-grow spinner-grow-sm" aria-hidden="true"></span>
    +  <span role="status">Loading...</span>
    +</button>
    +

    CSS

    +

    Variables

    Added in v5.2.0 - -

    As part of Bootstrap’s evolving CSS variables approach, spinners now use local CSS variables on .spinner-border and .spinner-grow for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    +

    As part of Bootstrap’s evolving CSS variables approach, spinners now use local CSS variables on .spinner-border and .spinner-grow for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    Border spinner variables:

    -
    -
    - scss/_spinners.scss -
    - -
    -
    --#{$prefix}spinner-width: #{$spinner-width};
    ---#{$prefix}spinner-height: #{$spinner-height};
    ---#{$prefix}spinner-vertical-align: #{$spinner-vertical-align};
    ---#{$prefix}spinner-border-width: #{$spinner-border-width};
    ---#{$prefix}spinner-animation-speed: #{$spinner-animation-speed};
    ---#{$prefix}spinner-animation-name: spinner-border;
    +
    --#{$prefix}spinner-width: #{$spinner-width};
    +--#{$prefix}spinner-height: #{$spinner-height};
    +--#{$prefix}spinner-vertical-align: #{$spinner-vertical-align};
    +--#{$prefix}spinner-border-width: #{$spinner-border-width};
    +--#{$prefix}spinner-animation-speed: #{$spinner-animation-speed};
    +--#{$prefix}spinner-animation-name: spinner-border;
    +

    Growing spinner variables:

    -
    -
    - scss/_spinners.scss -
    - -
    -
    --#{$prefix}spinner-width: #{$spinner-width};
    ---#{$prefix}spinner-height: #{$spinner-height};
    ---#{$prefix}spinner-vertical-align: #{$spinner-vertical-align};
    ---#{$prefix}spinner-animation-speed: #{$spinner-animation-speed};
    ---#{$prefix}spinner-animation-name: spinner-grow;
    +
    --#{$prefix}spinner-width: #{$spinner-width};
    +--#{$prefix}spinner-height: #{$spinner-height};
    +--#{$prefix}spinner-vertical-align: #{$spinner-vertical-align};
    +--#{$prefix}spinner-animation-speed: #{$spinner-animation-speed};
    +--#{$prefix}spinner-animation-name: spinner-grow;
    +

    For both spinners, small spinner modifier classes are used to update the values of these CSS variables as needed. For example, the .spinner-border-sm class does the following:

    -
    -
    - scss/_spinners.scss -
    - -
    -
    --#{$prefix}spinner-width: #{$spinner-width-sm};
    ---#{$prefix}spinner-height: #{$spinner-height-sm};
    ---#{$prefix}spinner-border-width: #{$spinner-border-width-sm};
    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $spinner-width:           2rem;
    -$spinner-height:          $spinner-width;
    -$spinner-vertical-align:  -.125em;
    -$spinner-border-width:    .25em;
    -$spinner-animation-speed: .75s;
    -
    -$spinner-width-sm:        1rem;
    -$spinner-height-sm:       $spinner-width-sm;
    -$spinner-border-width-sm: .2em;
    -
    -

    Keyframes

    +
    --#{$prefix}spinner-width: #{$spinner-width-sm};
    +--#{$prefix}spinner-height: #{$spinner-height-sm};
    +--#{$prefix}spinner-border-width: #{$spinner-border-width-sm};
    +
    +

    Sass variables

    +
    $spinner-width:           2rem;
    +$spinner-height:          $spinner-width;
    +$spinner-vertical-align:  -.125em;
    +$spinner-border-width:    .25em;
    +$spinner-animation-speed: .75s;
    +
    +$spinner-width-sm:        1rem;
    +$spinner-height-sm:       $spinner-width-sm;
    +$spinner-border-width-sm: .2em;
    +
    +

    Keyframes

    Used for creating the CSS animations for our spinners. Included in scss/_spinners.scss.

    -
    -
    - scss/_spinners.scss -
    - -
    -
    @keyframes spinner-border {
    -  to { transform: rotate(360deg) #{"/* rtl:ignore */"}; }
    -}
    -
    -
    -
    - scss/_spinners.scss -
    - -
    -
    @keyframes spinner-grow {
    -  0% {
    -    transform: scale(0);
    -  }
    -  50% {
    -    opacity: 1;
    -    transform: none;
    -  }
    -}
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    @keyframes spinner-border {
    +  to { transform: rotate(360deg) #{"/* rtl:ignore */"}; }
    +}
    +
    +
    @keyframes spinner-grow {
    +  0% {
    +    transform: scale(0);
    +  }
    +  50% {
    +    opacity: 1;
    +    transform: none;
    +  }
    +}
    +
    \ No newline at end of file diff --git a/docs/5.3/components/toasts/index.html b/docs/5.3/components/toasts/index.html index 6d1e0fe8ef..1bb290b20a 100644 --- a/docs/5.3/components/toasts/index.html +++ b/docs/5.3/components/toasts/index.html @@ -1,606 +1,41 @@ - - - - - - - - - - - - - - - - -Toasts · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Toasts

    -
    -

    Push notifications to your visitors with a toast, a lightweight and easily customizable alert message.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Toasts are lightweight notifications designed to mimic the push notifications that have been popularized by mobile and desktop operating systems. They’re built with flexbox, so they’re easy to align and position.

    -

    Overview

    + Toasts · Bootstrap v5.3

    Push notifications to your visitors with a toast, a lightweight and easily customizable alert message.

    +

    Toasts are lightweight notifications designed to mimic the push notifications that have been popularized by mobile and desktop operating systems. They’re built with flexbox, so they’re easy to align and position.

    +

    Overview

    Things to know when using the toast plugin:

    • Toasts are opt-in for performance reasons, so you must initialize them yourself.
    • Toasts will automatically hide if you do not specify autohide: false.
    -
    -The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation. -
    - -

    Examples

    -

    Basic

    +

    The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation.

    +

    Examples

    +

    Basic

    To encourage extensible and predictable toasts, we recommend a header and body. Toast headers use display: flex, allowing easy alignment of content thanks to our margin and flexbox utilities.

    -

    Toasts are as flexible as you need and have very little required markup. At a minimum, we require a single element to contain your “toasted” content and strongly encourage a dismiss button.

    -
    -
    - -
    html
    <div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
    +  <div class="toast-header">
    +    <img src="..." class="rounded me-2" alt="...">
    +    <strong class="me-auto">Bootstrap</strong>
    +    <small>11 mins ago</small>
    +    <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
    +  </div>
    +  <div class="toast-body">
    +    Hello, world! This is a toast message.
    +  </div>
    +</div>
    +

    Previously, our scripts dynamically added the .hide class to completely hide a toast (with display:none, rather than just with opacity:0). This is now not necessary anymore. However, for backwards compatibility, our script will continue to toggle the class (even though there is no practical need for it) until the next major version.

    +

    Live example

    Click the button below to show a toast (positioned with our utilities in the lower right corner) that has been hidden by default.

    -
    - +

    Stacking

    You can stack toasts by wrapping them in a toast container, which will vertically add some spacing.

    -
    -
    - -
    +
    html
    <div class="toast-container position-static">
    +  <div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
    +    <div class="toast-header">
    +      <img src="..." class="rounded me-2" alt="...">
    +      <strong class="me-auto">Bootstrap</strong>
    +      <small class="text-body-secondary">just now</small>
    +      <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
    +    </div>
    +    <div class="toast-body">
    +      See? Just like this.
    +    </div>
    +  </div>
     
    -  
    - html -
    - - -
    -
    <div class="toast-container position-static">
    -  <div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
    -    <div class="toast-header">
    -      <img src="..." class="rounded me-2" alt="...">
    -      <strong class="me-auto">Bootstrap</strong>
    -      <small class="text-body-secondary">just now</small>
    -      <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
    -    </div>
    -    <div class="toast-body">
    -      See? Just like this.
    -    </div>
    -  </div>
    -
    -  <div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
    -    <div class="toast-header">
    -      <img src="..." class="rounded me-2" alt="...">
    -      <strong class="me-auto">Bootstrap</strong>
    -      <small class="text-body-secondary">2 seconds ago</small>
    -      <button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
    -    </div>
    -    <div class="toast-body">
    -      Heads up, toasts will stack automatically
    -    </div>
    -  </div>
    -</div>
    -
    - -

    Custom content

    -

    Customize your toasts by removing sub-components, tweaking them with utilities, or by adding your own markup. Here we’ve created a simpler toast by removing the default .toast-header, adding a custom hide icon from Bootstrap Icons, and using some flexbox utilities to adjust the layout.

    -
    -
    - -
    +

    Custom content

    +

    Customize your toasts by removing sub-components, tweaking them with utilities, or by adding your own markup. Here we’ve created a simpler toast by removing the default .toast-header, adding a custom hide icon from Bootstrap Icons, and using some flexbox utilities to adjust the layout.

    +
    - -
    - html -
    - - -
    -
    <div class="toast align-items-center" role="alert" aria-live="assertive" aria-atomic="true">
    -  <div class="d-flex">
    -    <div class="toast-body">
    -      Hello, world! This is a toast message.
    -    </div>
    -    <button type="button" class="btn-close me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
    -  </div>
    -</div>
    -
    - +
    html
    <div class="toast align-items-center" role="alert" aria-live="assertive" aria-atomic="true">
    +  <div class="d-flex">
    +    <div class="toast-body">
    +      Hello, world! This is a toast message.
    +    </div>
    +    <button type="button" class="btn-close me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
    +  </div>
    +</div>

    Alternatively, you can also add additional controls and components to toasts.

    -
    -
    - - +

    Placement

    +

    Place toasts with custom CSS as you need them. The top right is often used for notifications, as is the top middle. If you’re only ever going to show one toast at a time, put the positioning styles right on the .toast.

    +
    - - + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDefaultDescription
    animationbooleantrueApply a CSS fade transition to the toast.
    autohidebooleantrueAutomatically hide the toast after the delay.
    delaynumber5000Delay in milliseconds before hiding the toast.
    +

    Methods

    +

    All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started, but before it ends. In addition, a method call on a transitioning component will be ignored. Learn more in our JavaScript docs.

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MethodDescription
    disposeHides an element’s toast. Your toast will remain on the DOM but won’t show anymore.
    getInstanceStatic method which allows you to get the toast instance associated with a DOM element.
    For example: const myToastEl = document.getElementById('myToastEl') const myToast = bootstrap.Toast.getInstance(myToastEl) Returns a Bootstrap toast instance.
    getOrCreateInstanceStatic method which allows you to get the toast instance associated with a DOM element, or create a new one, in case it wasn’t initialized.
    const myToastEl = document.getElementById('myToastEl') const myToast = bootstrap.Toast.getOrCreateInstance(myToastEl) Returns a Bootstrap toast instance.
    hideHides an element’s toast. Returns to the caller before the toast has actually been hidden (i.e. before the hidden.bs.toast event occurs). You have to manually call this method if you made autohide to false.
    isShownReturns a boolean according to toast’s visibility state.
    showReveals an element’s toast. Returns to the caller before the toast has actually been shown (i.e. before the shown.bs.toast event occurs). You have to manually call this method, instead your toast won’t show.
    +

    Events

    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    EventDescription
    hide.bs.toastThis event is fired immediately when the hide instance method has been called.
    hidden.bs.toastThis event is fired when the toast has finished being hidden from the user.
    show.bs.toastThis event fires immediately when the show instance method is called.
    shown.bs.toastThis event is fired when the toast has been made visible to the user.
    +
    const myToastEl = document.getElementById('myToast')
    +myToastEl.addEventListener('hidden.bs.toast', () => {
    +  // do something...
    +})
    +
    \ No newline at end of file diff --git a/docs/5.3/components/tooltips/index.html b/docs/5.3/components/tooltips/index.html index baae6d24ad..5fbaf05090 100644 --- a/docs/5.3/components/tooltips/index.html +++ b/docs/5.3/components/tooltips/index.html @@ -1,1139 +1,396 @@ - - - - - - - - - - - - - - - - -Tooltips · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Tooltips

    -
    -

    Documentation and examples for adding custom Bootstrap tooltips with CSS and JavaScript using CSS3 for animations and data-bs-attributes for local title storage.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Overview

    + Tooltips · Bootstrap v5.3

    Documentation and examples for adding custom Bootstrap tooltips with CSS and JavaScript using CSS3 for animations and data-bs-attributes for local title storage.

    +

    Overview

    Things to know when using the tooltip plugin:

    • Tooltips rely on the third party library Popper for positioning. You must include popper.min.js before bootstrap.js, or use one bootstrap.bundle.min.js which contains Popper.
    • Tooltips are opt-in for performance reasons, so you must initialize them yourself.
    • Tooltips with zero-length titles are never displayed.
    • -
    • Specify container: 'body' to avoid rendering problems in more complex components (like our input groups, button groups, etc).
    • +
    • Specify container: 'body' to avoid rendering problems in more complex components (like our input groups, button groups, etc).
    • Triggering tooltips on hidden elements will not work.
    • Tooltips for .disabled or disabled elements must be triggered on a wrapper element.
    • When triggered from hyperlinks that span multiple lines, tooltips will be centered. Use white-space: nowrap; on your <a>s to avoid this behavior.
    • Tooltips must be hidden before their corresponding elements have been removed from the DOM.
    • Tooltips can be triggered thanks to an element inside a shadow DOM.
    -

    Got all that? Great, let’s see how they work with some examples.

    -
    -By default, this component uses the built-in content sanitizer, which strips out any HTML elements that are not explicitly allowed. See the sanitizer section in our JavaScript documentation for more details. -
    - -
    -The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation. -
    - -

    Examples

    -

    Enable tooltips

    +

    Got all that? Great, let’s see how they work with some examples.

    +

    By default, this component uses the built-in content sanitizer, which strips out any HTML elements that are not explicitly allowed. See the sanitizer section in our JavaScript documentation for more details.

    +

    The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation.

    +

    Examples

    +

    Enable tooltips

    As mentioned above, you must initialize tooltips before they can be used. One way to initialize all tooltips on a page would be to select them by their data-bs-toggle attribute, like so:

    -
    const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
    -const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
    -
    +
    const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
    +const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
    +
    +

    Hover over the links below to see tooltips:

    -
    -
    - -

    Placeholder text to demonstrate some inline links with tooltips. This is now just filler, no killer. Content placed here just to mimic the presence of real text. And all that just to give you an idea of how tooltips would look when used in real-world situations. So hopefully you've now seen how these tooltips on links can work in practice, once you use them on your own site or project.

    - -
    - html -
    - - -
    -
    <p class="muted">Placeholder text to demonstrate some <a href="#" data-bs-toggle="tooltip" data-bs-title="Default tooltip">inline links</a> with tooltips. This is now just filler, no killer. Content placed here just to mimic the presence of <a href="#" data-bs-toggle="tooltip" data-bs-title="Another tooltip">real text</a>. And all that just to give you an idea of how tooltips would look when used in real-world situations. So hopefully you've now seen how <a href="#" data-bs-toggle="tooltip" data-bs-title="Another one here too">these tooltips on links</a> can work in practice, once you use them on <a href="#" data-bs-toggle="tooltip" data-bs-title="The last tip!">your own</a> site or project.</p>
    -
    - -
    -Feel free to use either title or data-bs-title in your HTML. When title is used, Popper will replace it automatically with data-bs-title when the element is rendered. -
    - -

    Custom tooltips

    +

    Placeholder text to demonstrate some inline links with tooltips. This is now just filler, no killer. Content placed here just to mimic the presence of real text. And all that just to give you an idea of how tooltips would look when used in real-world situations. So hopefully you’ve now seen how these tooltips on links can work in practice, once you use them on your own site or project.

    html
    <p class="muted">Placeholder text to demonstrate some <a href="#" data-bs-toggle="tooltip" data-bs-title="Default tooltip">inline links</a> with tooltips. This is now just filler, no killer. Content placed here just to mimic the presence of <a href="#" data-bs-toggle="tooltip" data-bs-title="Another tooltip">real text</a>. And all that just to give you an idea of how tooltips would look when used in real-world situations. So hopefully you’ve now seen how <a href="#" data-bs-toggle="tooltip" data-bs-title="Another one here too">these tooltips on links</a> can work in practice, once you use them on <a href="#" data-bs-toggle="tooltip" data-bs-title="The last tip!">your own</a> site or project.</p>
    +

    Feel free to use either title or data-bs-title in your HTML. When title is used, Popper will replace it automatically with data-bs-title when the element is rendered.

    +

    Custom tooltips

    Added in v5.2.0 -

    You can customize the appearance of tooltips using CSS variables. We set a custom class with data-bs-custom-class="custom-tooltip" to scope our custom appearance and use it to override a local CSS variable.

    -
    -
    .custom-tooltip {
    -  --bs-tooltip-bg: var(--bd-violet-bg);
    -  --bs-tooltip-color: var(--bs-white);
    -}
    -
    -
    .custom-tooltip {
    +  --bs-tooltip-bg: var(--bd-violet-bg);
    +  --bs-tooltip-color: var(--bs-white);
    +}
    +
    +
    - -
    - html -
    - - -
    -
    <button type="button" class="btn btn-secondary"
    -        data-bs-toggle="tooltip" data-bs-placement="top"
    -        data-bs-custom-class="custom-tooltip"
    -        data-bs-title="This top tooltip is themed via CSS variables.">
    -  Custom tooltip
    -</button>
    -
    - -

    Directions

    +
    html
    <button type="button" class="btn btn-secondary"
    +        data-bs-toggle="tooltip" data-bs-placement="top"
    +        data-bs-custom-class="custom-tooltip"
    +        data-bs-title="This top tooltip is themed via CSS variables.">
    +  Custom tooltip
    +</button>
    +

    Directions

    Hover over the buttons below to see the four tooltips directions: top, right, bottom, and left. Directions are mirrored when using Bootstrap in RTL.

    -
    -
    - - - - - -
    -
    -
    <button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Tooltip on top">
    -  Tooltip on top
    -</button>
    -<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="Tooltip on right">
    -  Tooltip on right
    -</button>
    -<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Tooltip on bottom">
    -  Tooltip on bottom
    -</button>
    -<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="left" data-bs-title="Tooltip on left">
    -  Tooltip on left
    -</button>
    -

    And with custom HTML added:

    -
    <button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-html="true" data-bs-title="<em>Tooltip</em> <u>with</u> <b>HTML</b>">
    -  Tooltip with HTML
    -</button>
    -

    With an SVG:

    - -

    CSS

    -

    Variables

    +
    + + + + + +
    +
    <button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-title="Tooltip on top">
    +  Tooltip on top
    +</button>
    +<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="Tooltip on right">
    +  Tooltip on right
    +</button>
    +<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Tooltip on bottom">
    +  Tooltip on bottom
    +</button>
    +<button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-placement="left" data-bs-title="Tooltip on left">
    +  Tooltip on left
    +</button>
    +
    +

    And with custom HTML added:

    +
    <button type="button" class="btn btn-secondary" data-bs-toggle="tooltip" data-bs-html="true" data-bs-title="<em>Tooltip</em> <u>with</u> <b>HTML</b>">
    +  Tooltip with HTML
    +</button>
    +
    +

    With an SVG:

    +
    +

    CSS

    +

    Variables

    Added in v5.2.0 -

    As part of Bootstrap’s evolving CSS variables approach, tooltips now use local CSS variables on .tooltip for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    -
    -
    - scss/_tooltip.scss -
    - -
    -
    --#{$prefix}tooltip-zindex: #{$zindex-tooltip};
    ---#{$prefix}tooltip-max-width: #{$tooltip-max-width};
    ---#{$prefix}tooltip-padding-x: #{$tooltip-padding-x};
    ---#{$prefix}tooltip-padding-y: #{$tooltip-padding-y};
    ---#{$prefix}tooltip-margin: #{$tooltip-margin};
    -@include rfs($tooltip-font-size, --#{$prefix}tooltip-font-size);
    ---#{$prefix}tooltip-color: #{$tooltip-color};
    ---#{$prefix}tooltip-bg: #{$tooltip-bg};
    ---#{$prefix}tooltip-border-radius: #{$tooltip-border-radius};
    ---#{$prefix}tooltip-opacity: #{$tooltip-opacity};
    ---#{$prefix}tooltip-arrow-width: #{$tooltip-arrow-width};
    ---#{$prefix}tooltip-arrow-height: #{$tooltip-arrow-height};
    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $tooltip-font-size:                 $font-size-sm;
    -$tooltip-max-width:                 200px;
    -$tooltip-color:                     var(--#{$prefix}body-bg);
    -$tooltip-bg:                        var(--#{$prefix}emphasis-color);
    -$tooltip-border-radius:             var(--#{$prefix}border-radius);
    -$tooltip-opacity:                   .9;
    -$tooltip-padding-y:                 $spacer * .25;
    -$tooltip-padding-x:                 $spacer * .5;
    -$tooltip-margin:                    null; // TODO: remove this in v6
    -
    -$tooltip-arrow-width:               .8rem;
    -$tooltip-arrow-height:              .4rem;
    -// fusv-disable
    -$tooltip-arrow-color:               null; // Deprecated in Bootstrap 5.2.0 for CSS variables
    -// fusv-enable
    -
    -

    Usage

    +
    --#{$prefix}tooltip-zindex: #{$zindex-tooltip};
    +--#{$prefix}tooltip-max-width: #{$tooltip-max-width};
    +--#{$prefix}tooltip-padding-x: #{$tooltip-padding-x};
    +--#{$prefix}tooltip-padding-y: #{$tooltip-padding-y};
    +--#{$prefix}tooltip-margin: #{$tooltip-margin};
    +@include rfs($tooltip-font-size, --#{$prefix}tooltip-font-size);
    +--#{$prefix}tooltip-color: #{$tooltip-color};
    +--#{$prefix}tooltip-bg: #{$tooltip-bg};
    +--#{$prefix}tooltip-border-radius: #{$tooltip-border-radius};
    +--#{$prefix}tooltip-opacity: #{$tooltip-opacity};
    +--#{$prefix}tooltip-arrow-width: #{$tooltip-arrow-width};
    +--#{$prefix}tooltip-arrow-height: #{$tooltip-arrow-height};
    +
    +

    Sass variables

    +
    $tooltip-font-size:                 $font-size-sm;
    +$tooltip-max-width:                 200px;
    +$tooltip-color:                     var(--#{$prefix}body-bg);
    +$tooltip-bg:                        var(--#{$prefix}emphasis-color);
    +$tooltip-border-radius:             var(--#{$prefix}border-radius);
    +$tooltip-opacity:                   .9;
    +$tooltip-padding-y:                 $spacer * .25;
    +$tooltip-padding-x:                 $spacer * .5;
    +$tooltip-margin:                    null; // TODO: remove this in v6
    +
    +$tooltip-arrow-width:               .8rem;
    +$tooltip-arrow-height:              .4rem;
    +// fusv-disable
    +$tooltip-arrow-color:               null; // Deprecated in Bootstrap 5.2.0 for CSS variables
    +// fusv-enable
    +
    +

    Usage

    The tooltip plugin generates content and markup on demand, and by default places tooltips after their trigger element. Trigger the tooltip via JavaScript:

    -
    const exampleEl = document.getElementById('example')
    -const tooltip = new bootstrap.Tooltip(exampleEl, options)
    -
    -

    Tooltips automatically attempt to change positions when a parent container has overflow: auto or overflow: scroll, but still keeps the original placement’s positioning. Set the boundary option (for the flip modifier using the popperConfig option) to any HTMLElement to override the default value, 'clippingParents', such as document.body:

    -
    const tooltip = new bootstrap.Tooltip('#example', {
    -  boundary: document.body // or document.querySelector('#boundary')
    -})
    -
    -
    - -

    Markup

    +
    const exampleEl = document.getElementById('example')
    +const tooltip = new bootstrap.Tooltip(exampleEl, options)
    +
    +

    Tooltips automatically attempt to change positions when a parent container has overflow: auto or overflow: scroll, but still keeps the original placement’s positioning. Set the boundary option (for the flip modifier using the popperConfig option) to any HTMLElement to override the default value, 'clippingParents', such as document.body:

    const tooltip = new bootstrap.Tooltip('#example', {
    +  boundary: document.body // or document.querySelector('#boundary')
    +})
    +
    +

    Markup

    The required markup for a tooltip is only a data attribute and title on the HTML element you wish to have a tooltip. The generated markup of a tooltip is rather simple, though it does require a position (by default, set to top by the plugin).

    -
    -Keep tooltips accessible to keyboard and assistive technology users by only adding them to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). While other HTML elements can be made focusable by adding tabindex="0", this can create annoying and confusing tab stops on non-interactive elements for keyboard users, and most assistive technologies currently do not announce tooltips in this situation. Additionally, do not rely solely on hover as the trigger for your tooltips as this will make them impossible to trigger for keyboard users. -
    +

    Keep tooltips accessible to keyboard and assistive technology users by only adding them to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). While other HTML elements can be made focusable by adding tabindex="0", this can create annoying and confusing tab stops on non-interactive elements for keyboard users, and most assistive technologies currently do not announce tooltips in this situation. Additionally, do not rely solely on hover as the trigger for your tooltips as this will make them impossible to trigger for keyboard users.

    +
    <!-- HTML to write -->
    +<a href="#" data-bs-toggle="tooltip" data-bs-title="Some tooltip text!">Hover over me</a>
     
    -
    <!-- HTML to write -->
    -<a href="#" data-bs-toggle="tooltip" data-bs-title="Some tooltip text!">Hover over me</a>
    -
    -<!-- Generated markup by the plugin -->
    -<div class="tooltip bs-tooltip-auto" role="tooltip">
    -  <div class="tooltip-arrow"></div>
    -  <div class="tooltip-inner">
    -    Some tooltip text!
    -  </div>
    -</div>
    -

    Disabled elements

    -

    Elements with the disabled attribute aren’t interactive, meaning users cannot focus, hover, or click them to trigger a tooltip (or popover). As a workaround, you’ll want to trigger the tooltip from a wrapper <div> or <span>, ideally made keyboard-focusable using tabindex="0".

    -
    -
    - - +<!-- Generated markup by the plugin --> +<div class="tooltip bs-tooltip-auto" role="tooltip"> + <div class="tooltip-arrow"></div> + <div class="tooltip-inner"> + Some tooltip text! + </div> +</div> +
    +

    Disabled elements

    +

    Elements with the disabled attribute aren’t interactive, meaning users cannot focus, hover, or click them to trigger a tooltip (or popover). As a workaround, you’ll want to trigger the tooltip from a wrapper <div> or <span>, ideally made keyboard-focusable using tabindex="0".

    +
    - - -
    - html -
    - - -
    -
    <span class="d-inline-block" tabindex="0" data-bs-toggle="tooltip" data-bs-title="Disabled tooltip">
    -  <button class="btn btn-primary" type="button" disabled>Disabled button</button>
    -</span>
    -
    - -

    Options

    -

    As options can be passed via data attributes or JavaScript, you can append an option name to data-bs-, as in data-bs-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-bs-custom-class="beautifier" instead of data-bs-customClass="beautifier".

    -

    As of Bootstrap 5.2.0, all components support an experimental reserved data attribute data-bs-config that can house simple component configuration as a JSON string. When an element has data-bs-config='{"delay":0, "title":123}' and data-bs-title="456" attributes, the final title value will be 456 and the separate data attributes will override values given on data-bs-config. In addition, existing data attributes are able to house JSON values like data-bs-delay='{"show":0,"hide":150}'.

    +
    html
    <span class="d-inline-block" tabindex="0" data-bs-toggle="tooltip" data-bs-title="Disabled tooltip">
    +  <button class="btn btn-primary" type="button" disabled>Disabled button</button>
    +</span>
    +

    Options

    +

    As options can be passed via data attributes or JavaScript, you can append an option name to data-bs-, as in data-bs-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-bs-custom-class="beautifier" instead of data-bs-customClass="beautifier".

    +

    As of Bootstrap 5.2.0, all components support an experimental reserved data attribute data-bs-config that can house simple component configuration as a JSON string. When an element has data-bs-config='{"delay":0, "title":123}' and data-bs-title="456" attributes, the final title value will be 456 and the separate data attributes will override values given on data-bs-config. In addition, existing data attributes are able to house JSON values like data-bs-delay='{"show":0,"hide":150}'.

    The final configuration object is the merged result of data-bs-config, data-bs-, and js object where the latest given key-value overrides the others.

    - -
    -Note that for security reasons the sanitize, sanitizeFn, and allowList options cannot be supplied using data attributes. -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeDefaultDescription
    allowListobjectDefault valueObject which contains allowed attributes and tags.
    animationbooleantrueApply a CSS fade transition to the tooltip.
    boundarystring, element'clippingParents'Overflow constraint boundary of the tooltip (applies only to Popper’s preventOverflow modifier). By default, it’s 'clippingParents' and can accept an HTMLElement reference (via JavaScript only). For more information refer to Popper’s detectOverflow docs.
    containerstring, element, falsefalseAppends the tooltip to a specific element. Example: container: 'body'. This option is particularly useful in that it allows you to position the tooltip in the flow of the document near the triggering element - which will prevent the tooltip from floating away from the triggering element during a window resize.
    customClassstring, function''Add classes to the tooltip when it is shown. Note that these classes will be added in addition to any classes specified in the template. To add multiple classes, separate them with spaces: 'class-1 class-2'. You can also pass a function that should return a single string containing additional class names.
    delaynumber, object0Delay showing and hiding the tooltip (ms)—doesn’t apply to manual trigger type. If a number is supplied, delay is applied to both hide/show. Object structure is: delay: { "show": 500, "hide": 100 }.
    fallbackPlacementsarray['top', 'right', 'bottom', 'left']Define fallback placements by providing a list of placements in array (in order of preference). For more information refer to Popper’s behavior docs.
    htmlbooleanfalseAllow HTML in the tooltip. If true, HTML tags in the tooltip’s title will be rendered in the tooltip. If false, innerText property will be used to insert content into the DOM. Use text if you’re worried about XSS attacks.
    offsetarray, string, function[0, 6]Offset of the tooltip relative to its target. You can pass a string in data attributes with comma separated values like: data-bs-offset="10,20". When a function is used to determine the offset, it is called with an object containing the popper placement, the reference, and popper rects as its first argument. The triggering element DOM node is passed as the second argument. The function must return an array with two numbers: skidding, distance. For more information refer to Popper’s offset docs.
    placementstring, function'top'How to position the tooltip: auto, top, bottom, left, right. When auto is specified, it will dynamically reorient the tooltip. When a function is used to determine the placement, it is called with the tooltip DOM node as its first argument and the triggering element DOM node as its second. The this context is set to the tooltip instance.
    popperConfignull, object, functionnullTo change Bootstrap’s default Popper config, see Popper’s configuration. When a function is used to create the Popper configuration, it’s called with an object that contains the Bootstrap’s default Popper configuration. It helps you use and merge the default with your own configuration. The function must return a configuration object for Popper.
    sanitizebooleantrueEnable or disable the sanitization. If activated 'template', 'content' and 'title' options will be sanitized.
    sanitizeFnnull, functionnullHere you can supply your own sanitize function. This can be useful if you prefer to use a dedicated library to perform sanitization.
    selectorstring, falsefalseIf a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to also apply tooltips to dynamically added DOM elements (jQuery.on support). See this issue and an informative example. Note: title attribute must not be used as a selector.
    templatestring'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'Base HTML to use when creating the tooltip. The tooltip’s title will be injected into the .tooltip-inner. .tooltip-arrow will become the tooltip’s arrow. The outermost wrapper element should have the .tooltip class and role="tooltip".
    titlestring, element, function''The tooltip title. If a function is given, it will be called with its this reference set to the element that the popover is attached to.
    triggerstring'hover focus'How tooltip is triggered: click, hover, focus, manual. You may pass multiple triggers; separate them with a space. 'manual' indicates that the tooltip will be triggered programmatically via the .tooltip('show'), .tooltip('hide') and .tooltip('toggle') methods; this value cannot be combined with any other trigger. 'hover' on its own will result in tooltips that cannot be triggered via the keyboard, and should only be used if alternative methods for conveying the same information for keyboard users is present.
    - -
    -

    Data attributes for individual tooltips

    -

    Options for individual tooltips can alternatively be specified through the use of data attributes, as explained above.

    -
    - -

    Using function with popperConfig

    -
    const tooltip = new bootstrap.Tooltip(element, {
    -  popperConfig(defaultBsPopperConfig) {
    -    // const newPopperConfig = {...}
    -    // use defaultBsPopperConfig if needed...
    -    // return newPopperConfig
    -  }
    -})
    -

    Methods

    -
    -All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started, but before it ends. In addition, a method call on a transitioning component will be ignored. Learn more in our JavaScript docs. -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    MethodDescription
    disableRemoves the ability for an element’s tooltip to be shown. The tooltip will only be able to be shown if it is re-enabled.
    disposeHides and destroys an element’s tooltip (Removes stored data on the DOM element). Tooltips that use delegation (which are created using the selector option) cannot be individually destroyed on descendant trigger elements.
    enableGives an element’s tooltip the ability to be shown. Tooltips are enabled by default.
    getInstanceStatic method which allows you to get the tooltip instance associated with a DOM element, or create a new one in case it wasn’t initialized.
    getOrCreateInstanceStatic method which allows you to get the tooltip instance associated with a DOM element, or create a new one in case it wasn’t initialized.
    hideHides an element’s tooltip. Returns to the caller before the tooltip has actually been hidden (i.e. before the hidden.bs.tooltip event occurs). This is considered a “manual” triggering of the tooltip.
    setContentGives a way to change the tooltip’s content after its initialization.
    showReveals an element’s tooltip. Returns to the caller before the tooltip has actually been shown (i.e. before the shown.bs.tooltip event occurs). This is considered a “manual” triggering of the tooltip. Tooltips with zero-length titles are never displayed.
    toggleToggles an element’s tooltip. Returns to the caller before the tooltip has actually been shown or hidden (i.e. before the shown.bs.tooltip or hidden.bs.tooltip event occurs). This is considered a “manual” triggering of the tooltip.
    toggleEnabledToggles the ability for an element’s tooltip to be shown or hidden.
    updateUpdates the position of an element’s tooltip.
    - -
    const tooltip = bootstrap.Tooltip.getInstance('#example') // Returns a Bootstrap tooltip instance
    -
    -// setContent example
    -tooltip.setContent({ '.tooltip-inner': 'another title' })
    -
    -The setContent method accepts an object argument, where each property-key is a valid string selector within the tooltip template, and each related property-value can be string | element | function | null -
    - -

    Events

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    EventDescription
    hide.bs.tooltipThis event is fired immediately when the hide instance method has been called.
    hidden.bs.tooltipThis event is fired when the tooltip has finished being hidden from the user (will wait for CSS transitions to complete).
    inserted.bs.tooltipThis event is fired after the show.bs.tooltip event when the tooltip template has been added to the DOM.
    show.bs.tooltipThis event fires immediately when the show instance method is called.
    shown.bs.tooltipThis event is fired when the tooltip has been made visible to the user (will wait for CSS transitions to complete).
    - -
    const myTooltipEl = document.getElementById('myTooltip')
    -const tooltip = bootstrap.Tooltip.getOrCreateInstance(myTooltipEl)
    -
    -myTooltipEl.addEventListener('hidden.bs.tooltip', () => {
    -  // do something...
    -})
    -
    -tooltip.hide()
    -
    -
    - - +

    Note that for security reasons the sanitize, sanitizeFn, and allowList options cannot be supplied using data attributes.

    +
    - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeDefaultDescription
    allowListobjectDefault valueObject which contains allowed attributes and tags.
    animationbooleantrueApply a CSS fade transition to the tooltip.
    boundarystring, element'clippingParents'Overflow constraint boundary of the tooltip (applies only to Popper’s preventOverflow modifier). By default, it’s 'clippingParents' and can accept an HTMLElement reference (via JavaScript only). For more information refer to Popper’s detectOverflow docs.
    containerstring, element, falsefalseAppends the tooltip to a specific element. Example: container: 'body'. This option is particularly useful in that it allows you to position the tooltip in the flow of the document near the triggering element - which will prevent the tooltip from floating away from the triggering element during a window resize.
    customClassstring, function''Add classes to the tooltip when it is shown. Note that these classes will be added in addition to any classes specified in the template. To add multiple classes, separate them with spaces: 'class-1 class-2'. You can also pass a function that should return a single string containing additional class names.
    delaynumber, object0Delay showing and hiding the tooltip (ms)—doesn’t apply to manual trigger type. If a number is supplied, delay is applied to both hide/show. Object structure is: delay: { "show": 500, "hide": 100 }.
    fallbackPlacementsarray['top', 'right', 'bottom', 'left']Define fallback placements by providing a list of placements in array (in order of preference). For more information refer to Popper’s behavior docs.
    htmlbooleanfalseAllow HTML in the tooltip. If true, HTML tags in the tooltip’s title will be rendered in the tooltip. If false, innerText property will be used to insert content into the DOM. Use text if you’re worried about XSS attacks.
    offsetarray, string, function[0, 6]Offset of the tooltip relative to its target. You can pass a string in data attributes with comma separated values like: data-bs-offset="10,20". When a function is used to determine the offset, it is called with an object containing the popper placement, the reference, and popper rects as its first argument. The triggering element DOM node is passed as the second argument. The function must return an array with two numbers: skidding, distance. For more information refer to Popper’s offset docs.
    placementstring, function'top'How to position the tooltip: auto, top, bottom, left, right. When auto is specified, it will dynamically reorient the tooltip. When a function is used to determine the placement, it is called with the tooltip DOM node as its first argument and the triggering element DOM node as its second. The this context is set to the tooltip instance.
    popperConfignull, object, functionnullTo change Bootstrap’s default Popper config, see Popper’s configuration. When a function is used to create the Popper configuration, it’s called with an object that contains the Bootstrap’s default Popper configuration. It helps you use and merge the default with your own configuration. The function must return a configuration object for Popper.
    sanitizebooleantrueEnable or disable the sanitization. If activated 'template', 'content' and 'title' options will be sanitized.
    sanitizeFnnull, functionnullHere you can supply your own sanitize function. This can be useful if you prefer to use a dedicated library to perform sanitization.
    selectorstring, falsefalseIf a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to also apply tooltips to dynamically added DOM elements (jQuery.on support). See this issue and an informative example. Note: title attribute must not be used as a selector.
    templatestring'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'Base HTML to use when creating the tooltip. The tooltip’s title will be injected into the .tooltip-inner. .tooltip-arrow will become the tooltip’s arrow. The outermost wrapper element should have the .tooltip class and role="tooltip".
    titlestring, element, function''The tooltip title. If a function is given, it will be called with its this reference set to the element that the popover is attached to.
    triggerstring'hover focus'How tooltip is triggered: click, hover, focus, manual. You may pass multiple triggers; separate them with a space. 'manual' indicates that the tooltip will be triggered programmatically via the .tooltip('show'), .tooltip('hide') and .tooltip('toggle') methods; this value cannot be combined with any other trigger. 'hover' on its own will result in tooltips that cannot be triggered via the keyboard, and should only be used if alternative methods for conveying the same information for keyboard users is present.
    +

    Data attributes for individual tooltips

    Options for individual tooltips can alternatively be specified through the use of data attributes, as explained above.

    +

    Using function with popperConfig

    +
    const tooltip = new bootstrap.Tooltip(element, {
    +  popperConfig(defaultBsPopperConfig) {
    +    // const newPopperConfig = {...}
    +    // use defaultBsPopperConfig if needed...
    +    // return newPopperConfig
    +  }
    +})
    +
    +

    Methods

    +

    All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started, but before it ends. In addition, a method call on a transitioning component will be ignored. Learn more in our JavaScript docs.

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    MethodDescription
    disableRemoves the ability for an element’s tooltip to be shown. The tooltip will only be able to be shown if it is re-enabled.
    disposeHides and destroys an element’s tooltip (Removes stored data on the DOM element). Tooltips that use delegation (which are created using the selector option) cannot be individually destroyed on descendant trigger elements.
    enableGives an element’s tooltip the ability to be shown. Tooltips are enabled by default.
    getInstanceStatic method which allows you to get the tooltip instance associated with a DOM element.
    getOrCreateInstanceStatic method which allows you to get the tooltip instance associated with a DOM element, or create a new one in case it wasn’t initialized.
    hideHides an element’s tooltip. Returns to the caller before the tooltip has actually been hidden (i.e. before the hidden.bs.tooltip event occurs). This is considered a “manual” triggering of the tooltip.
    setContentGives a way to change the tooltip’s content after its initialization.
    showReveals an element’s tooltip. Returns to the caller before the tooltip has actually been shown (i.e. before the shown.bs.tooltip event occurs). This is considered a “manual” triggering of the tooltip. Tooltips with zero-length titles are never displayed.
    toggleToggles an element’s tooltip. Returns to the caller before the tooltip has actually been shown or hidden (i.e. before the shown.bs.tooltip or hidden.bs.tooltip event occurs). This is considered a “manual” triggering of the tooltip.
    toggleEnabledToggles the ability for an element’s tooltip to be shown or hidden.
    updateUpdates the position of an element’s tooltip.
    +
    const tooltip = bootstrap.Tooltip.getInstance('#example') // Returns a Bootstrap tooltip instance
    +
    +// setContent example
    +tooltip.setContent({ '.tooltip-inner': 'another title' })
    +
    +

    The setContent method accepts an object argument, where each property-key is a valid string selector within the tooltip template, and each related property-value can be string | element | function | null

    +

    Events

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    EventDescription
    hide.bs.tooltipThis event is fired immediately when the hide instance method has been called.
    hidden.bs.tooltipThis event is fired when the tooltip has finished being hidden from the user (will wait for CSS transitions to complete).
    inserted.bs.tooltipThis event is fired after the show.bs.tooltip event when the tooltip template has been added to the DOM.
    show.bs.tooltipThis event fires immediately when the show instance method is called.
    shown.bs.tooltipThis event is fired when the tooltip has been made visible to the user (will wait for CSS transitions to complete).
    +
    const myTooltipEl = document.getElementById('myTooltip')
    +const tooltip = bootstrap.Tooltip.getOrCreateInstance(myTooltipEl)
    +
    +myTooltipEl.addEventListener('hidden.bs.tooltip', () => {
    +  // do something...
    +})
    +
    +tooltip.hide()
    +
    \ No newline at end of file diff --git a/docs/5.3/content/figures/index.html b/docs/5.3/content/figures/index.html index 062e84b3cf..e88b29fb0f 100644 --- a/docs/5.3/content/figures/index.html +++ b/docs/5.3/content/figures/index.html @@ -1,701 +1,49 @@ - - - - - - - - - - - - - - - - -Figures · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Figures

    -
    -

    Documentation and examples for displaying related images and text with the figure component in Bootstrap.

    - - -
    - - -
    - - On this page -
    -
    - -
    -
    - - -
    - - -

    Anytime you need to display a piece of content—like an image with an optional caption, consider using a <figure>.

    + Figures · Bootstrap v5.3

    Documentation and examples for displaying related images and text with the figure component in Bootstrap.

    +
    On this page

    Anytime you need to display a piece of content—like an image with an optional caption, consider using a <figure>.

    Use the included .figure, .figure-img and .figure-caption classes to provide some baseline styles for the HTML5 <figure> and <figcaption> elements. Images in figures have no explicit size, so be sure to add the .img-fluid class to your <img> to make it responsive.

    -
    -
    - -
    - Placeholder400x300 +
    + Placeholder400x300
    A caption for the above image.
    -
    - -
    - html -
    - - -
    -
    <figure class="figure">
    -  <img src="..." class="figure-img img-fluid rounded" alt="...">
    -  <figcaption class="figure-caption">A caption for the above image.</figcaption>
    -</figure>
    -
    - -

    Aligning the figure’s caption is easy with our text utilities.

    -
    -
    - -
    - Placeholder400x300 +
    html
    <figure class="figure">
    +  <img src="..." class="figure-img img-fluid rounded" alt="...">
    +  <figcaption class="figure-caption">A caption for the above image.</figcaption>
    +</figure>
    +

    Aligning the figure’s caption is easy with our text utilities.

    +
    + Placeholder400x300
    A caption for the above image.
    -
    - -
    - html -
    - - -
    -
    <figure class="figure">
    -  <img src="..." class="figure-img img-fluid rounded" alt="...">
    -  <figcaption class="figure-caption text-end">A caption for the above image.</figcaption>
    -</figure>
    -
    - -

    CSS

    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $figure-caption-font-size:          $small-font-size;
    -$figure-caption-color:              var(--#{$prefix}secondary-color);
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    html
    <figure class="figure">
    +  <img src="..." class="figure-img img-fluid rounded" alt="...">
    +  <figcaption class="figure-caption text-end">A caption for the above image.</figcaption>
    +</figure>
    +

    CSS

    +

    Sass variables

    +
    $figure-caption-font-size:          $small-font-size;
    +$figure-caption-color:              var(--#{$prefix}secondary-color);
    +
    \ No newline at end of file diff --git a/docs/5.3/content/images/index.html b/docs/5.3/content/images/index.html index b74949c77b..c4d75c980c 100644 --- a/docs/5.3/content/images/index.html +++ b/docs/5.3/content/images/index.html @@ -1,767 +1,61 @@ - - - - - - - - - - - - - - - - -Images · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Images

    -
    -

    Documentation and examples for opting images into responsive behavior (so they never become wider than their parent) and add lightweight styles to them—all via classes.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Responsive images

    + Images · Bootstrap v5.3

    Documentation and examples for opting images into responsive behavior (so they never become wider than their parent) and add lightweight styles to them—all via classes.

    +

    Responsive images

    Images in Bootstrap are made responsive with .img-fluid. This applies max-width: 100%; and height: auto; to the image so that it scales with the parent width.

    -
    -
    - -PlaceholderResponsive image - -
    - html -
    - - -
    -
    <img src="..." class="img-fluid" alt="...">
    -
    - -

    Image thumbnails

    -

    In addition to our border-radius utilities, you can use .img-thumbnail to give an image a rounded 1px border appearance.

    -
    -
    - -A generic square placeholder image with a white border around it, making it resemble a photograph taken with an old instant camera200x200 - -
    - html -
    - - -
    -
    <img src="..." class="img-thumbnail" alt="...">
    -
    - -

    Aligning images

    -

    Align images with the helper float classes or text alignment classes. block-level images can be centered using the .mx-auto margin utility class.

    -
    -
    - -Placeholder200x200 -Placeholder200x200 - -
    - html -
    - - -
    -
    <img src="..." class="rounded float-start" alt="...">
    -<img src="..." class="rounded float-end" alt="...">
    -
    - -
    -
    - -Placeholder200x200 - -
    - html -
    - - -
    -
    <img src="..." class="rounded mx-auto d-block" alt="...">
    -
    - -
    -
    - -
    - Placeholder200x200 -
    - -
    - html -
    - - -
    -
    <div class="text-center">
    -  <img src="..." class="rounded" alt="...">
    -</div>
    -
    - -

    Picture

    +
    PlaceholderResponsive image
    html
    <img src="..." class="img-fluid" alt="...">
    +

    Image thumbnails

    +

    In addition to our border-radius utilities, you can use .img-thumbnail to give an image a rounded 1px border appearance.

    +
    A generic square placeholder image with a white border around it, making it resemble a photograph taken with an old instant camera200x200
    html
    <img src="..." class="img-thumbnail" alt="...">
    +

    Aligning images

    +

    Align images with the helper float classes or text alignment classes. block-level images can be centered using the .mx-auto margin utility class.

    +
    Placeholder200x200 +Placeholder200x200
    html
    <img src="..." class="rounded float-start" alt="...">
    +<img src="..." class="rounded float-end" alt="...">
    +
    Placeholder200x200
    html
    <img src="..." class="rounded mx-auto d-block" alt="...">
    +
    + Placeholder200x200 +
    html
    <div class="text-center">
    +  <img src="..." class="rounded" alt="...">
    +</div>
    +

    Picture

    If you are using the <picture> element to specify multiple <source> elements for a specific <img>, make sure to add the .img-* classes to the <img> and not to the <picture> tag.

    -
    <picture>
    -  <source srcset="..." type="image/svg+xml">
    -  <img src="..." class="img-fluid img-thumbnail" alt="...">
    -</picture>
    -

    CSS

    -

    Sass variables

    +
    <picture>
    +  <source srcset="..." type="image/svg+xml">
    +  <img src="..." class="img-fluid img-thumbnail" alt="...">
    +</picture>
    +
    +

    CSS

    +

    Sass variables

    Variables are available for image thumbnails.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $thumbnail-padding:                 .25rem;
    -$thumbnail-bg:                      var(--#{$prefix}body-bg);
    -$thumbnail-border-width:            var(--#{$prefix}border-width);
    -$thumbnail-border-color:            var(--#{$prefix}border-color);
    -$thumbnail-border-radius:           var(--#{$prefix}border-radius);
    -$thumbnail-box-shadow:              var(--#{$prefix}box-shadow-sm);
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    $thumbnail-padding:                 .25rem;
    +$thumbnail-bg:                      var(--#{$prefix}body-bg);
    +$thumbnail-border-width:            var(--#{$prefix}border-width);
    +$thumbnail-border-color:            var(--#{$prefix}border-color);
    +$thumbnail-border-radius:           var(--#{$prefix}border-radius);
    +$thumbnail-box-shadow:              var(--#{$prefix}box-shadow-sm);
    +
    \ No newline at end of file diff --git a/docs/5.3/content/index.html b/docs/5.3/content/index.html index 4166f9d2d4..9fb4be8a99 100644 --- a/docs/5.3/content/index.html +++ b/docs/5.3/content/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/content/reboot/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/content/reboot/index.html b/docs/5.3/content/reboot/index.html index 0135438de4..ff3929fb62 100644 --- a/docs/5.3/content/reboot/index.html +++ b/docs/5.3/content/reboot/index.html @@ -1,588 +1,27 @@ - - - - - - - - - - - - - - - - -Reboot · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Reboot

    -
    -

    Reboot, a collection of element-specific CSS changes in a single file, kickstart Bootstrap to provide an elegant, consistent, and simple baseline to build upon.

    - - -
    - - - - - -
    - - -

    Approach

    + Reboot · Bootstrap v5.3

    Reboot, a collection of element-specific CSS changes in a single file, kickstart Bootstrap to provide an elegant, consistent, and simple baseline to build upon.

    +

    Approach

    Reboot builds upon Normalize, providing many HTML elements with somewhat opinionated styles using only element selectors. Additional styling is done only with classes. For example, we reboot some <table> styles for a simpler baseline and later provide .table, .table-bordered, and more.

    Here are our guidelines and reasons for choosing what to override in Reboot:

      @@ -591,74 +30,59 @@
    • For easier scaling across device sizes, block elements should use rems for margins.
    • Keep declarations of font-related properties to a minimum, using inherit whenever possible.
    -

    CSS variables

    +

    CSS variables

    Added in v5.2.0 - -

    With v5.1.1, we standardized our required @imports across all our CSS bundles (including bootstrap.css, bootstrap-reboot.css, and bootstrap-grid.css) to include _root.scss. This adds :root level CSS variables to all bundles, regardless of how many of them are used in that bundle. Ultimately Bootstrap 5 will continue to see more CSS variables added over time, in order to provide more real-time customization without the need to always recompile Sass. Our approach is to take our source Sass variables and transform them into CSS variables. That way, even if you don’t use CSS variables, you still have all the power of Sass. This is still in-progress and will take time to fully implement.

    +

    With v5.1.1, we standardized our required @imports across all our CSS bundles (including bootstrap.css, bootstrap-reboot.css, and bootstrap-grid.css) to include _root.scss. This adds :root level CSS variables to all bundles, regardless of how many of them are used in that bundle. Ultimately Bootstrap 5 will continue to see more CSS variables added over time, in order to provide more real-time customization without the need to always recompile Sass. Our approach is to take our source Sass variables and transform them into CSS variables. That way, even if you don’t use CSS variables, you still have all the power of Sass. This is still in-progress and will take time to fully implement.

    For example, consider these :root CSS variables for common <body> styles:

    -
    -
    - scss/_root.scss -
    - -
    -
    @if $font-size-root != null {
    -  --#{$prefix}root-font-size: #{$font-size-root};
    -}
    ---#{$prefix}body-font-family: #{inspect($font-family-base)};
    -@include rfs($font-size-base, --#{$prefix}body-font-size);
    ---#{$prefix}body-font-weight: #{$font-weight-base};
    ---#{$prefix}body-line-height: #{$line-height-base};
    -@if $body-text-align != null {
    -  --#{$prefix}body-text-align: #{$body-text-align};
    -}
    -
    ---#{$prefix}body-color: #{$body-color};
    ---#{$prefix}body-color-rgb: #{to-rgb($body-color)};
    ---#{$prefix}body-bg: #{$body-bg};
    ---#{$prefix}body-bg-rgb: #{to-rgb($body-bg)};
    -
    ---#{$prefix}emphasis-color: #{$body-emphasis-color};
    ---#{$prefix}emphasis-color-rgb: #{to-rgb($body-emphasis-color)};
    -
    ---#{$prefix}secondary-color: #{$body-secondary-color};
    ---#{$prefix}secondary-color-rgb: #{to-rgb($body-secondary-color)};
    ---#{$prefix}secondary-bg: #{$body-secondary-bg};
    ---#{$prefix}secondary-bg-rgb: #{to-rgb($body-secondary-bg)};
    -
    ---#{$prefix}tertiary-color: #{$body-tertiary-color};
    ---#{$prefix}tertiary-color-rgb: #{to-rgb($body-tertiary-color)};
    ---#{$prefix}tertiary-bg: #{$body-tertiary-bg};
    ---#{$prefix}tertiary-bg-rgb: #{to-rgb($body-tertiary-bg)};
    +
    @if $font-size-root != null {
    +  --#{$prefix}root-font-size: #{$font-size-root};
    +}
    +--#{$prefix}body-font-family: #{inspect($font-family-base)};
    +@include rfs($font-size-base, --#{$prefix}body-font-size);
    +--#{$prefix}body-font-weight: #{$font-weight-base};
    +--#{$prefix}body-line-height: #{$line-height-base};
    +@if $body-text-align != null {
    +  --#{$prefix}body-text-align: #{$body-text-align};
    +}
    +
    +--#{$prefix}body-color: #{$body-color};
    +--#{$prefix}body-color-rgb: #{to-rgb($body-color)};
    +--#{$prefix}body-bg: #{$body-bg};
    +--#{$prefix}body-bg-rgb: #{to-rgb($body-bg)};
    +
    +--#{$prefix}emphasis-color: #{$body-emphasis-color};
    +--#{$prefix}emphasis-color-rgb: #{to-rgb($body-emphasis-color)};
    +
    +--#{$prefix}secondary-color: #{$body-secondary-color};
    +--#{$prefix}secondary-color-rgb: #{to-rgb($body-secondary-color)};
    +--#{$prefix}secondary-bg: #{$body-secondary-bg};
    +--#{$prefix}secondary-bg-rgb: #{to-rgb($body-secondary-bg)};
    +
    +--#{$prefix}tertiary-color: #{$body-tertiary-color};
    +--#{$prefix}tertiary-color-rgb: #{to-rgb($body-tertiary-color)};
    +--#{$prefix}tertiary-bg: #{$body-tertiary-bg};
    +--#{$prefix}tertiary-bg-rgb: #{to-rgb($body-tertiary-bg)};
    +

    In practice, those variables are then applied in Reboot like so:

    -
    -
    - scss/_reboot.scss -
    - -
    -
    body {
    -  margin: 0; // 1
    -  font-family: var(--#{$prefix}body-font-family);
    -  @include font-size(var(--#{$prefix}body-font-size));
    -  font-weight: var(--#{$prefix}body-font-weight);
    -  line-height: var(--#{$prefix}body-line-height);
    -  color: var(--#{$prefix}body-color);
    -  text-align: var(--#{$prefix}body-text-align);
    -  background-color: var(--#{$prefix}body-bg); // 2
    -  -webkit-text-size-adjust: 100%; // 3
    -  -webkit-tap-highlight-color: rgba($black, 0); // 4
    -}
    -
    +
    body {
    +  margin: 0; // 1
    +  font-family: var(--#{$prefix}body-font-family);
    +  @include font-size(var(--#{$prefix}body-font-size));
    +  font-weight: var(--#{$prefix}body-font-weight);
    +  line-height: var(--#{$prefix}body-line-height);
    +  color: var(--#{$prefix}body-color);
    +  text-align: var(--#{$prefix}body-text-align);
    +  background-color: var(--#{$prefix}body-bg); // 2
    +  -webkit-text-size-adjust: 100%; // 3
    +  -webkit-tap-highlight-color: rgba($black, 0); // 4
    +}
    +

    Which allows you to make real-time customizations however you like:

    -
    <body style="--bs-body-color: #333;">
    -  <!-- ... -->
    -</body>
    -

    Page defaults

    +
    <body style="--bs-body-color: #333;">
    +  <!-- ... -->
    +</body>
    +
    +

    Page defaults

    The <html> and <body> elements are updated to provide better page-wide defaults. More specifically:

    • The box-sizing is globally set on every element—including *::before and *::after, to border-box. This ensures that the declared width of element is never exceeded due to padding or border. @@ -669,183 +93,97 @@
    • The <body> also sets a global font-family, font-weight, line-height, and color. This is inherited later by some form elements to prevent font inconsistencies.
    • For safety, the <body> has a declared background-color, defaulting to #fff.
    -

    Native font stack

    -

    Bootstrap utilizes a “native font stack” or “system font stack” for optimum text rendering on every device and OS. These system fonts have been designed specifically with today’s devices in mind, with improved rendering on screens, variable font support, and more. Read more about native font stacks in this Smashing Magazine article.

    -
    $font-family-sans-serif:
    -  // Cross-platform generic font family (default user interface font)
    -  system-ui,
    -  // Safari for macOS and iOS (San Francisco)
    -  -apple-system,
    -  // Windows
    -  "Segoe UI",
    -  // Android
    -  Roboto,
    -  // older macOS and iOS
    -  "Helvetica Neue",
    -  // Linux
    -  "Noto Sans",
    -  "Liberation Sans",
    -  // Basic web fallback
    -  Arial,
    -  // Sans serif fallback
    -  sans-serif,
    -  // Emoji fonts
    -  "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !default;
    -

    Note that because the font stack includes emoji fonts, many common symbol/dingbat Unicode characters will be rendered as multicolored pictographs. Their appearance will vary, depending on the style used in the browser/platform’s native emoji font, and they won’t be affected by any CSS color styles.

    +

    Native font stack

    +

    Bootstrap utilizes a “native font stack” or “system font stack” for optimum text rendering on every device and OS. These system fonts have been designed specifically with today’s devices in mind, with improved rendering on screens, variable font support, and more. Read more about native font stacks in this Smashing Magazine article.

    +
    $font-family-sans-serif:
    +  // Cross-platform generic font family (default user interface font)
    +  system-ui,
    +  // Safari for macOS and iOS (San Francisco)
    +  -apple-system,
    +  // Windows
    +  "Segoe UI",
    +  // Android
    +  Roboto,
    +  // older macOS and iOS
    +  "Helvetica Neue",
    +  // Linux
    +  "Noto Sans",
    +  "Liberation Sans",
    +  // Basic web fallback
    +  Arial,
    +  // Sans serif fallback
    +  sans-serif,
    +  // Emoji fonts
    +  "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !default;
    +
    +

    Note that because the font stack includes emoji fonts, many common symbol/dingbat Unicode characters will be rendered as multicolored pictographs. Their appearance will vary, depending on the style used in the browser/platform’s native emoji font, and they won’t be affected by any CSS color styles.

    This font-family is applied to the <body> and automatically inherited globally throughout Bootstrap. To switch the global font-family, update $font-family-base and recompile Bootstrap.

    -

    Headings

    +

    Headings

    All heading elements—<h1><h6> have their margin-top removed, margin-bottom: .5rem set, and line-height tightened. While headings inherit their color by default, you can also override it via optional CSS variable, --bs-heading-color.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    HeadingExample
    <h1></h1>h1. Bootstrap heading
    <h2></h2>h2. Bootstrap heading
    <h3></h3>h3. Bootstrap heading
    <h4></h4>h4. Bootstrap heading
    <h5></h5>h5. Bootstrap heading
    <h6></h6>h6. Bootstrap heading
    +
    -

    Paragraphs

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    HeadingExample
    <h1></h1>h1. Bootstrap heading
    <h2></h2>h2. Bootstrap heading
    <h3></h3>h3. Bootstrap heading
    <h4></h4>h4. Bootstrap heading
    <h5></h5>h5. Bootstrap heading
    <h6></h6>h6. Bootstrap heading
    +

    Paragraphs

    All <p> elements have their margin-top removed and margin-bottom: 1rem set for easy spacing.

    -
    -
    - -

    This is an example paragraph.

    - -
    - html -
    - - -
    -
    <p>This is an example paragraph.</p>
    -
    - - -

    Links have a default color and underline applied. While links change on :hover, they don’t change based on whether someone :visited the link. They also receive no special :focus styles.

    -
    -
    - html -
    - - -
    -
    <a href="#">This is an example link</a>
    -
    - +

    This is an example paragraph.

    html
    <p>This is an example paragraph.</p>
    + +

    Links have a default color and underline applied. While links change on :hover, they don’t change based on whether someone :visited the link. They also receive no special :focus styles.

    +
    html
    <a href="#">This is an example link</a>

    As of v5.3.x, link color is set using rgba() and new -rgb CSS variables, allowing for easy customization of link color opacity. Change the link color opacity with the --bs-link-opacity CSS variable:

    -
    -
    - html -
    - - -
    -
    <a href="#" style="--bs-link-opacity: .5">This is an example link</a>
    -
    - +
    html
    <a href="#" style="--bs-link-opacity: .5">This is an example link</a>

    Placeholder links—those without an href—are targeted with a more specific selector and have their color and text-decoration reset to their default values.

    -
    -
    - html -
    - - -
    -
    <a>This is a placeholder link</a>
    -
    - -

    Horizontal rules

    +
    html
    <a>This is a placeholder link</a>
    +

    Horizontal rules

    The <hr> element has been simplified. Similar to browser defaults, <hr>s are styled via border-top, have a default opacity: .25, and automatically inherit their border-color via color, including when color is set via the parent. They can be modified with text, border, and opacity utilities.

    -
    -
    - -
    +



    -
    +
    html
    <hr>
     
    -  
    - html -
    - - -
    -
    <hr>
    -
    -<div class="text-success">
    -  <hr>
    -</div>
    -
    -<hr class="border border-danger border-2 opacity-50">
    -<hr class="border border-primary border-3 opacity-75">
    -
    +<div class="text-success"> + <hr> +</div> -

    Lists

    -

    All lists—<ul>, <ol>, and <dl>—have their margin-top removed and a margin-bottom: 1rem. Nested lists have no margin-bottom. We’ve also reset the padding-left on <ul> and <ol> elements.

    -
    -
      +<hr class="border border-danger border-2 opacity-50"> +<hr class="border border-primary border-3 opacity-75">
    +

    Lists

    +

    All lists—<ul>, <ol>, and <dl>—have their margin-top removed and a margin-bottom: 1rem. Nested lists have no margin-bottom. We’ve also reset the padding-left on <ul> and <ol> elements.

    +
    • All lists have their top margin removed
    • And their bottom margin normalized
    • Nested lists have no bottom margin @@ -855,139 +193,38 @@
  • The left padding has also been reset
  • - -
      -
    1. Here’s an ordered list
    2. +
        +
      1. Here’s an ordered list
      2. With a few list items
      3. It has the same overall look
      4. As the previous unordered list
      5. -
      - -
    +

    For simpler styling, clear hierarchy, and better spacing, description lists have updated margins. <dd>s reset margin-left to 0 and add margin-bottom: .5rem. <dt>s are bolded.

    -
    -
    -
    Description lists
    -
    A description list is perfect for defining terms.
    -
    Term
    -
    Definition for the term.
    -
    A second definition for the same term.
    -
    Another term
    -
    Definition for this other term.
    -
    -
    -

    Inline code

    +
    Description lists
    A description list is perfect for defining terms.
    Term
    Definition for the term.
    A second definition for the same term.
    Another term
    Definition for this other term.
    +

    Inline code

    Wrap inline snippets of code with <code>. Be sure to escape HTML angle brackets.

    -
    -
    - -For example, <section> should be wrapped as inline. - -
    - html -
    - - -
    -
    For example, <code>&lt;section&gt;</code> should be wrapped as inline.
    -
    - -

    Code blocks

    +
    For example, <section> should be wrapped as inline.
    html
    For example, <code>&lt;section&gt;</code> should be wrapped as inline.
    +

    Code blocks

    Use <pre>s for multiple lines of code. Once again, be sure to escape any angle brackets in the code for proper rendering. The <pre> element is reset to remove its margin-top and use rem units for its margin-bottom.

    -
    -
    - -
    <p>Sample text here...</p>
    +
    <p>Sample text here...</p>
     <p>And another line of sample text here...</p>
    -
    - -
    - html -
    - - -
    -
    <pre><code>&lt;p&gt;Sample text here...&lt;/p&gt;
    -&lt;p&gt;And another line of sample text here...&lt;/p&gt;
    -</code></pre>
    -
    - -

    Variables

    +
    html
    <pre><code>&lt;p&gt;Sample text here...&lt;/p&gt;
    +&lt;p&gt;And another line of sample text here...&lt;/p&gt;
    +</code></pre>
    +

    Variables

    For indicating variables use the <var> tag.

    -
    -
    - -y = mx + b - -
    - html -
    - - -
    -
    <var>y</var> = <var>m</var><var>x</var> + <var>b</var>
    -
    - -

    User input

    +
    y = mx + b
    html
    <var>y</var> = <var>m</var><var>x</var> + <var>b</var>
    +

    User input

    Use the <kbd> to indicate input that is typically entered via keyboard.

    -
    -
    - -To switch directories, type cd followed by the name of the directory.
    -To edit settings, press Ctrl + , - -
    - html -
    - - -
    -
    To switch directories, type <kbd>cd</kbd> followed by the name of the directory.<br>
    -To edit settings, press <kbd><kbd>Ctrl</kbd> + <kbd>,</kbd></kbd>
    -
    - -

    Sample output

    +
    To switch directories, type cd followed by the name of the directory.
    +To edit settings, press Ctrl + ,
    html
    To switch directories, type <kbd>cd</kbd> followed by the name of the directory.<br>
    +To edit settings, press <kbd><kbd>Ctrl</kbd> + <kbd>,</kbd></kbd>
    +

    Sample output

    For indicating sample output from a program use the <samp> tag.

    -
    -
    - -This text is meant to be treated as sample output from a computer program. - -
    - html -
    - - -
    -
    <samp>This text is meant to be treated as sample output from a computer program.</samp>
    -
    - -

    Tables

    -

    Tables are slightly adjusted to style <caption>s, collapse borders, and ensure consistent text-align throughout. Additional changes for borders, padding, and more come with the .table class.

    -
    -
    - - +
    This text is meant to be treated as sample output from a computer program.
    html
    <samp>This text is meant to be treated as sample output from a computer program.</samp>
    +

    Tables

    +

    Tables are slightly adjusted to style <caption>s, collapse borders, and ensure consistent text-align throughout. Additional changes for borders, padding, and more come with the .table class.

    +
    @@ -1019,331 +256,212 @@ To edit settings, press Ctrl + , -
    This is an example table, and this is its caption to describe the contents.
    Table cell
    - -
    - html -
    - - -
    -
    <table>
    -  <caption>
    -    This is an example table, and this is its caption to describe the contents.
    -  </caption>
    -  <thead>
    -    <tr>
    -      <th>Table heading</th>
    -      <th>Table heading</th>
    -      <th>Table heading</th>
    -      <th>Table heading</th>
    -    </tr>
    -  </thead>
    -  <tbody>
    -    <tr>
    -      <td>Table cell</td>
    -      <td>Table cell</td>
    -      <td>Table cell</td>
    -      <td>Table cell</td>
    -    </tr>
    -    <tr>
    -      <td>Table cell</td>
    -      <td>Table cell</td>
    -      <td>Table cell</td>
    -      <td>Table cell</td>
    -    </tr>
    -    <tr>
    -      <td>Table cell</td>
    -      <td>Table cell</td>
    -      <td>Table cell</td>
    -      <td>Table cell</td>
    -    </tr>
    -  </tbody>
    -</table>
    -
    - -

    Forms

    +
    html
    <table>
    +  <caption>
    +    This is an example table, and this is its caption to describe the contents.
    +  </caption>
    +  <thead>
    +    <tr>
    +      <th>Table heading</th>
    +      <th>Table heading</th>
    +      <th>Table heading</th>
    +      <th>Table heading</th>
    +    </tr>
    +  </thead>
    +  <tbody>
    +    <tr>
    +      <td>Table cell</td>
    +      <td>Table cell</td>
    +      <td>Table cell</td>
    +      <td>Table cell</td>
    +    </tr>
    +    <tr>
    +      <td>Table cell</td>
    +      <td>Table cell</td>
    +      <td>Table cell</td>
    +      <td>Table cell</td>
    +    </tr>
    +    <tr>
    +      <td>Table cell</td>
    +      <td>Table cell</td>
    +      <td>Table cell</td>
    +      <td>Table cell</td>
    +    </tr>
    +  </tbody>
    +</table>
    +

    Forms

    Various form elements have been rebooted for simpler base styles. Here are some of the most notable changes:

    • <fieldset>s have no borders, padding, or margin so they can be easily used as wrappers for individual inputs or groups of inputs.
    • <legend>s, like fieldsets, have also been restyled to be displayed as a heading of sorts.
    • <label>s are set to display: inline-block to allow margin to be applied.
    • <input>s, <select>s, <textarea>s, and <button>s are mostly addressed by Normalize, but Reboot removes their margin and sets line-height: inherit, too.
    • -
    • <textarea>s are modified to only be resizable vertically as horizontal resizing often “breaks” page layout.
    • +
    • <textarea>s are modified to only be resizable vertically as horizontal resizing often “breaks” page layout.
    • <button>s and <input> button elements have cursor: pointer when :not(:disabled).

    These changes, and more, are demonstrated below.

    -
    -Some date inputs types are not fully supported by the latest versions of Safari and Firefox. -
    - - -
    - Example legend -

    - - -

    -

    - - -

    -

    - - -

    -

    - - -

    -

    - - -

    -

    - - -

    -

    - - -

    -

    - - -

    -

    - - -

    -

    - -

    -

    - - - -

    -

    - - -

    -

    - - -

    -

    - - -

    -

    - - -

    -

    - - -

    -

    - - -

    -

    - - -

    -

    - - -

    -

    - - 100 -

    -

    - - - - -

    -

    - - - - -

    -
    - -

    Pointers on buttons

    -

    Reboot includes an enhancement for role="button" to change the default cursor to pointer. Add this attribute to elements to help indicate elements are interactive. This role isn’t necessary for <button> elements, which get their own cursor change.

    -
    -
    - -Non-button element button - -
    - html -
    - - -
    -
    <span role="button" tabindex="0">Non-button element button</span>
    -
    - -

    Misc elements

    -

    Address

    +

    Some date inputs types are not fully supported by the latest versions of Safari and Firefox.

    +
    +
    + Example legend +

    + + +

    +

    + + +

    +

    + + +

    +

    + + +

    +

    + + +

    +

    + + +

    +

    + + +

    +

    + + +

    +

    + + +

    +

    + +

    +

    + + + +

    +

    + + +

    +

    + + +

    +

    + + +

    +

    + + +

    +

    + + +

    +

    + + +

    +

    + + +

    +

    + + +

    +

    + + 100 +

    +

    + + + + +

    +

    + + + + +

    +
    +
    +

    Pointers on buttons

    +

    Reboot includes an enhancement for role="button" to change the default cursor to pointer. Add this attribute to elements to help indicate elements are interactive. This role isn’t necessary for <button> elements, which get their own cursor change.

    +
    Non-button element button
    html
    <span role="button" tabindex="0">Non-button element button</span>
    +

    Misc elements

    +

    Address

    The <address> element is updated to reset the browser default font-style from italic to normal. line-height is also now inherited, and margin-bottom: 1rem has been added. <address>s are for presenting contact information for the nearest ancestor (or an entire body of work). Preserve formatting by ending lines with <br>.

    -
    -
    - ACME Corporation
    - 1123 Fictional St,
    - San Francisco, CA 94103
    - P: (123) 456-7890 -
    -
    - Full Name
    - first.last@example.com -
    -
    -

    Blockquote

    +
    + ACME Corporation
    + 1123 Fictional St,
    + San Francisco, CA 94103
    + P: (123) 456-7890 +
    + +
    + Full Name
    + first.last@example.com +
    +

    Blockquote

    The default margin on blockquotes is 1em 40px, so we reset that to 0 0 1rem for something more consistent with other elements.

    -
    +

    A well-known quote, contained in a blockquote element.

    -

    Someone famous in Source Title

    -
    -

    Inline elements

    +
    + Someone famous in Source Title +
    +
    +

    Inline elements

    The <abbr> element receives basic styling to make it stand out amongst paragraph text.

    -
    - The HTML abbreviation element. -
    -

    Summary

    +

    The HTML abbreviation element.

    +

    Summary

    The default cursor on summary is text, so we reset that to pointer to convey that the element can be interacted with by clicking on it.

    -
    -
    - Some details -

    More info about the details.

    -
    -
    - Even more details -

    Here are even more details about the details.

    -
    -
    -

    HTML5 [hidden] attribute

    +
    Some details

    More info about the details.

    Even more details

    Here are even more details about the details.

    +

    HTML5 [hidden] attribute

    HTML5 adds a new global attribute named [hidden], which is styled as display: none by default. Borrowing an idea from PureCSS, we improve upon this default by making [hidden] { display: none !important; } to help prevent its display from getting accidentally overridden.

    -
    <input type="text" hidden>
    -
    -Since [hidden] is not compatible with jQuery’s $(...).hide() and $(...).show() methods, we don’t specifically endorse [hidden] over other techniques for managing the display of elements. -
    - -

    To merely toggle the visibility of an element, meaning its display is not modified and the element can still affect the flow of the document, use the .invisible class instead.

    - -
    -
    -
    - - - - - - - - - - - - - - - +
    <input type="text" hidden>
    +
    +

    Since [hidden] is not compatible with jQuery’s $(...).hide() and $(...).show() methods, we don’t specifically endorse [hidden] over other techniques for managing the display of elements.

    +

    To merely toggle the visibility of an element, meaning its display is not modified and the element can still affect the flow of the document, use the .invisible class instead.

    \ No newline at end of file diff --git a/docs/5.3/content/tables/index.html b/docs/5.3/content/tables/index.html index 3e516fafef..42cb4dfb46 100644 --- a/docs/5.3/content/tables/index.html +++ b/docs/5.3/content/tables/index.html @@ -1,606 +1,30 @@ - - - - - - - - - - - - - - - - -Tables · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Tables

    -
    -

    Documentation and examples for opt-in styling of tables (given their prevalent use in JavaScript plugins) with Bootstrap.

    - - -
    - - - - - -
    - - -

    Overview

    -

    Due to the widespread use of <table> elements across third-party widgets like calendars and date pickers, Bootstrap’s tables are opt-in. Add the base class .table to any <table>, then extend with our optional modifier classes or custom styles. All table styles are not inherited in Bootstrap, meaning any nested tables can be styled independent from the parent.

    -

    Using the most basic table markup, here’s how .table-based tables look in Bootstrap.

    -
    - - +Tables · Bootstrap v5.3

    Documentation and examples for opt-in styling of tables (given their prevalent use in JavaScript plugins) with Bootstrap.

    +

    Overview

    +

    Due to the widespread use of <table> elements across third-party widgets like calendars and date pickers, Bootstrap’s tables are opt-in. Add the base class .table to any <table>, then extend with our optional modifier classes or custom styles. All table styles are not inherited in Bootstrap, meaning any nested tables can be styled independent from the parent.

    +

    Using the most basic table markup, here’s how .table-based tables look in Bootstrap.

    +
    @@ -627,145 +51,76 @@ - - -
    # FirstDoe @social
    -
    <table class="table">
    -  <thead>
    -    <tr>
    -      <th scope="col">#</th>
    -      <th scope="col">First</th>
    -      <th scope="col">Last</th>
    -      <th scope="col">Handle</th>
    -    </tr>
    -  </thead>
    -  <tbody>
    -    <tr>
    -      <th scope="row">1</th>
    -      <td>Mark</td>
    -      <td>Otto</td>
    -      <td>@mdo</td>
    -    </tr>
    -    <tr>
    -      <th scope="row">2</th>
    -      <td>Jacob</td>
    -      <td>Thornton</td>
    -      <td>@fat</td>
    -    </tr>
    -    <tr>
    -      <th scope="row">3</th>
    -      <td>John</td>
    -      <td>Doe</td>
    -      <td>@social</td>
    -    </tr>
    -  </tbody>
    -</table>
    -

    Variants

    +
    <table class="table">
    +  <thead>
    +    <tr>
    +      <th scope="col">#</th>
    +      <th scope="col">First</th>
    +      <th scope="col">Last</th>
    +      <th scope="col">Handle</th>
    +    </tr>
    +  </thead>
    +  <tbody>
    +    <tr>
    +      <th scope="row">1</th>
    +      <td>Mark</td>
    +      <td>Otto</td>
    +      <td>@mdo</td>
    +    </tr>
    +    <tr>
    +      <th scope="row">2</th>
    +      <td>Jacob</td>
    +      <td>Thornton</td>
    +      <td>@fat</td>
    +    </tr>
    +    <tr>
    +      <th scope="row">3</th>
    +      <td>John</td>
    +      <td>Doe</td>
    +      <td>@social</td>
    +    </tr>
    +  </tbody>
    +</table>
    +

    Variants

    Use contextual classes to color tables, table rows or individual cells.

    -
    -Heads up! Because of the more complicated CSS used to generate our table variants, they most likely won’t see color mode adaptive styling until v6. -
    +

    Heads up! Because of the more complicated CSS used to generate our table variants, they most likely won’t see color mode adaptive styling until v6.

    +
    ClassHeadingHeading
    DefaultCellCell
    PrimaryCellCell
    SecondaryCellCell
    SuccessCellCell
    DangerCellCell
    WarningCellCell
    InfoCellCell
    LightCellCell
    DarkCellCell
    +
    <!-- On tables -->
    +<table class="table-primary">...</table>
    +<table class="table-secondary">...</table>
    +<table class="table-success">...</table>
    +<table class="table-danger">...</table>
    +<table class="table-warning">...</table>
    +<table class="table-info">...</table>
    +<table class="table-light">...</table>
    +<table class="table-dark">...</table>
     
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ClassHeadingHeading
    DefaultCellCell
    PrimaryCellCell
    SecondaryCellCell
    SuccessCellCell
    DangerCellCell
    WarningCellCell
    InfoCellCell
    LightCellCell
    DarkCellCell
    -
    -
    <!-- On tables -->
    -<table class="table-primary">...</table>
    -<table class="table-secondary">...</table>
    -<table class="table-success">...</table>
    -<table class="table-danger">...</table>
    -<table class="table-warning">...</table>
    -<table class="table-info">...</table>
    -<table class="table-light">...</table>
    -<table class="table-dark">...</table>
    -
    -<!-- On rows -->
    -<tr class="table-primary">...</tr>
    -<tr class="table-secondary">...</tr>
    -<tr class="table-success">...</tr>
    -<tr class="table-danger">...</tr>
    -<tr class="table-warning">...</tr>
    -<tr class="table-info">...</tr>
    -<tr class="table-light">...</tr>
    -<tr class="table-dark">...</tr>
    -
    -<!-- On cells (`td` or `th`) -->
    -<tr>
    -  <td class="table-primary">...</td>
    -  <td class="table-secondary">...</td>
    -  <td class="table-success">...</td>
    -  <td class="table-danger">...</td>
    -  <td class="table-warning">...</td>
    -  <td class="table-info">...</td>
    -  <td class="table-light">...</td>
    -  <td class="table-dark">...</td>
    -</tr>
    -
    -Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class. -
    +<!-- On rows --> +<tr class="table-primary">...</tr> +<tr class="table-secondary">...</tr> +<tr class="table-success">...</tr> +<tr class="table-danger">...</tr> +<tr class="table-warning">...</tr> +<tr class="table-info">...</tr> +<tr class="table-light">...</tr> +<tr class="table-dark">...</tr> -

    Accented tables

    -

    Striped rows

    +<!-- On cells (`td` or `th`) --> +<tr> + <td class="table-primary">...</td> + <td class="table-secondary">...</td> + <td class="table-success">...</td> + <td class="table-danger">...</td> + <td class="table-warning">...</td> + <td class="table-info">...</td> + <td class="table-light">...</td> + <td class="table-dark">...</td> +</tr>
    +

    Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class.

    +

    Accented tables

    +

    Striped rows

    Use .table-striped to add zebra-striping to any table row within the <tbody>.

    -
    - - +
    @@ -792,17 +147,12 @@ - - -
    # FirstDoe @social
    -
    <table class="table table-striped">
    -  ...
    -</table>
    -

    Striped columns

    +
    <table class="table table-striped">
    +  ...
    +</table>
    +

    Striped columns

    Use .table-striped-columns to add zebra-striping to any table column.

    -
    - - +
    @@ -829,16 +179,11 @@ - - -
    # FirstDoe @social
    -
    <table class="table table-striped-columns">
    -  ...
    -</table>
    +
    <table class="table table-striped-columns">
    +  ...
    +</table>

    These classes can also be added to table variants:

    -
    - - +
    @@ -865,15 +210,10 @@ - - -
    # FirstDoe @social
    -
    <table class="table table-dark table-striped">
    -  ...
    -</table>
    -
    - - +
    <table class="table table-dark table-striped">
    +  ...
    +</table>
    +
    @@ -900,15 +240,10 @@ - - -
    # FirstDoe @social
    -
    <table class="table table-dark table-striped-columns">
    -  ...
    -</table>
    -
    - - +
    <table class="table table-dark table-striped-columns">
    +  ...
    +</table>
    +
    @@ -935,15 +270,10 @@ - - -
    # FirstDoe @social
    -
    <table class="table table-success table-striped">
    -  ...
    -</table>
    -
    - - +
    <table class="table table-success table-striped">
    +  ...
    +</table>
    +
    @@ -970,17 +300,12 @@ - - -
    # FirstDoe @social
    -
    <table class="table table-success table-striped-columns">
    -  ...
    -</table>
    -

    Hoverable rows

    +
    <table class="table table-success table-striped-columns">
    +  ...
    +</table>
    +

    Hoverable rows

    Add .table-hover to enable a hover state on table rows within a <tbody>.

    -
    - - +
    @@ -1007,15 +332,10 @@ - - -
    # FirstDoe @social
    -
    <table class="table table-hover">
    -  ...
    -</table>
    -
    - - +
    <table class="table table-hover">
    +  ...
    +</table>
    +
    @@ -1042,16 +362,11 @@ - - -
    # FirstDoe @social
    -
    <table class="table table-dark table-hover">
    -  ...
    -</table>
    +
    <table class="table table-dark table-hover">
    +  ...
    +</table>

    These hoverable rows can also be combined with the striped rows variant:

    -
    - - +
    @@ -1078,163 +393,90 @@ - - -
    # FirstDoe @social
    -
    <table class="table table-striped table-hover">
    -  ...
    -</table>
    -

    Active tables

    +
    <table class="table table-striped table-hover">
    +  ...
    +</table>
    +

    Active tables

    Highlight a table row or cell by adding a .table-active class.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #FirstLastHandle
    1MarkOtto@mdo
    2JacobThornton@fat
    3JohnDoe@social
    -
    -
    <table class="table">
    -  <thead>
    -    ...
    -  </thead>
    -  <tbody>
    -    <tr class="table-active">
    -      ...
    -    </tr>
    -    <tr>
    -      ...
    -    </tr>
    -    <tr>
    -      <th scope="row">3</th>
    -      <td>John</td>
    -      <td>Doe</td>
    -      <td class="table-active">@social</td>
    -    </tr>
    -  </tbody>
    -</table>
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #FirstLastHandle
    1MarkOtto@mdo
    2JacobThornton@fat
    3JohnDoe@social
    -
    -
    <table class="table table-dark">
    -  <thead>
    -    ...
    -  </thead>
    -  <tbody>
    -    <tr class="table-active">
    -      ...
    -    </tr>
    -    <tr>
    -      ...
    -    </tr>
    -    <tr>
    -      <th scope="row">3</th>
    -      <td>John</td>
    -      <td>Doe</td>
    -      <td class="table-active">@social</td>
    -    </tr>
    -  </tbody>
    -</table>
    -

    How do the variants and accented tables work?

    +
    #FirstLastHandle
    1MarkOtto@mdo
    2JacobThornton@fat
    3JohnDoe@social
    +
    <table class="table">
    +  <thead>
    +    ...
    +  </thead>
    +  <tbody>
    +    <tr class="table-active">
    +      ...
    +    </tr>
    +    <tr>
    +      ...
    +    </tr>
    +    <tr>
    +      <th scope="row">3</th>
    +      <td>John</td>
    +      <td>Doe</td>
    +      <td class="table-active">@social</td>
    +    </tr>
    +  </tbody>
    +</table>
    +
    +
    #FirstLastHandle
    1MarkOtto@mdo
    2JacobThornton@fat
    3JohnDoe@social
    +
    <table class="table table-dark">
    +  <thead>
    +    ...
    +  </thead>
    +  <tbody>
    +    <tr class="table-active">
    +      ...
    +    </tr>
    +    <tr>
    +      ...
    +    </tr>
    +    <tr>
    +      <th scope="row">3</th>
    +      <td>John</td>
    +      <td>Doe</td>
    +      <td class="table-active">@social</td>
    +    </tr>
    +  </tbody>
    +</table>
    +
    +

    How do the variants and accented tables work?

    For the accented tables (striped rows, striped columns, hoverable rows, and active tables), we used some techniques to make these effects work for all our table variants:

      -
    • We start by setting the background of a table cell with the --bs-table-bg custom property. All table variants then set that custom property to colorize the table cells. This way, we don’t get into trouble if semi-transparent colors are used as table backgrounds.
    • -
    • Then we add an inset box shadow on the table cells with box-shadow: inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg-type, var(--bs-table-accent-bg))); to layer on top of any specified background-color. It uses custom cascade to override the box-shadow, regardless the CSS specificity. Because we use a huge spread and no blur, the color will be monotone. Since --bs-table-accent-bg is set to transparent by default, we don’t have a default box shadow.
    • +
    • We start by setting the background of a table cell with the --bs-table-bg custom property. All table variants then set that custom property to colorize the table cells. This way, we don’t get into trouble if semi-transparent colors are used as table backgrounds.
    • +
    • Then we add an inset box shadow on the table cells with box-shadow: inset 0 0 0 9999px var(--bs-table-bg-state, var(--bs-table-bg-type, var(--bs-table-accent-bg))); to layer on top of any specified background-color. It uses custom cascade to override the box-shadow, regardless the CSS specificity. Because we use a huge spread and no blur, the color will be monotone. Since --bs-table-accent-bg is set to transparent by default, we don’t have a default box shadow.
    • When either .table-striped, .table-striped-columns, .table-hover or .table-active classes are added, either --bs-table-bg-type or --bs-table-bg-state (by default set to initial) are set to a semitransparent color (--bs-table-striped-bg, --bs-table-active-bg or --bs-table-hover-bg) to colorize the background and override default --bs-table-accent-bg.
    • For each table variant, we generate a --bs-table-accent-bg color with the highest contrast depending on that color. For example, the accent color for .table-primary is darker while .table-dark has a lighter accent color.
    • Text and border colors are generated the same way, and their colors are inherited by default.

    Behind the scenes it looks like this:

    -
    -
    @mixin table-variant($state, $background) {
    -  .table-#{$state} {
    -    $color: color-contrast(opaque($body-bg, $background));
    -    $hover-bg: mix($color, $background, percentage($table-hover-bg-factor));
    -    $striped-bg: mix($color, $background, percentage($table-striped-bg-factor));
    -    $active-bg: mix($color, $background, percentage($table-active-bg-factor));
    -    $table-border-color: mix($color, $background, percentage($table-border-factor));
    -
    -    --#{$prefix}table-color: #{$color};
    -    --#{$prefix}table-bg: #{$background};
    -    --#{$prefix}table-border-color: #{$table-border-color};
    -    --#{$prefix}table-striped-bg: #{$striped-bg};
    -    --#{$prefix}table-striped-color: #{color-contrast($striped-bg)};
    -    --#{$prefix}table-active-bg: #{$active-bg};
    -    --#{$prefix}table-active-color: #{color-contrast($active-bg)};
    -    --#{$prefix}table-hover-bg: #{$hover-bg};
    -    --#{$prefix}table-hover-color: #{color-contrast($hover-bg)};
    -
    -    color: var(--#{$prefix}table-color);
    -    border-color: var(--#{$prefix}table-border-color);
    -  }
    -}
    -
    -

    Table borders

    -

    Bordered tables

    +
    @mixin table-variant($state, $background) {
    +  .table-#{$state} {
    +    $color: color-contrast(opaque($body-bg, $background));
    +    $hover-bg: mix($color, $background, percentage($table-hover-bg-factor));
    +    $striped-bg: mix($color, $background, percentage($table-striped-bg-factor));
    +    $active-bg: mix($color, $background, percentage($table-active-bg-factor));
    +    $table-border-color: mix($color, $background, percentage($table-border-factor));
    +
    +    --#{$prefix}table-color: #{$color};
    +    --#{$prefix}table-bg: #{$background};
    +    --#{$prefix}table-border-color: #{$table-border-color};
    +    --#{$prefix}table-striped-bg: #{$striped-bg};
    +    --#{$prefix}table-striped-color: #{color-contrast($striped-bg)};
    +    --#{$prefix}table-active-bg: #{$active-bg};
    +    --#{$prefix}table-active-color: #{color-contrast($active-bg)};
    +    --#{$prefix}table-hover-bg: #{$hover-bg};
    +    --#{$prefix}table-hover-color: #{color-contrast($hover-bg)};
    +
    +    color: var(--#{$prefix}table-color);
    +    border-color: var(--#{$prefix}table-border-color);
    +  }
    +}
    +
    +

    Table borders

    +

    Bordered tables

    Add .table-bordered for borders on all sides of the table and cells.

    -
    - - +
    @@ -1261,16 +503,11 @@ - - -
    # FirstDoe @social
    -
    <table class="table table-bordered">
    -  ...
    -</table>
    -

    Border color utilities can be added to change colors:

    -
    - - +
    <table class="table table-bordered">
    +  ...
    +</table>
    +

    Border color utilities can be added to change colors:

    +
    @@ -1297,17 +534,12 @@ - - -
    # FirstDoe @social
    -
    <table class="table table-bordered border-primary">
    -  ...
    -</table>
    -

    Tables without borders

    +
    <table class="table table-bordered border-primary">
    +  ...
    +</table>
    +

    Tables without borders

    Add .table-borderless for a table without borders.

    -
    - - +
    @@ -1334,15 +566,10 @@ - - -
    # FirstDoe @social
    -
    <table class="table table-borderless">
    -  ...
    -</table>
    -
    - - +
    <table class="table table-borderless">
    +  ...
    +</table>
    +
    @@ -1369,17 +596,12 @@ - - -
    # FirstDoe @social
    -
    <table class="table table-dark table-borderless">
    -  ...
    -</table>
    -

    Small tables

    +
    <table class="table table-dark table-borderless">
    +  ...
    +</table>
    +

    Small tables

    Add .table-sm to make any .table more compact by cutting all cell padding in half.

    -
    - - +
    @@ -1406,15 +628,10 @@ - - -
    # FirstDoe @social
    -
    <table class="table table-sm">
    -  ...
    -</table>
    -
    - - +
    <table class="table table-sm">
    +  ...
    +</table>
    +
    @@ -1441,18 +658,12 @@ - - -
    # FirstDoe @social
    -
    <table class="table table-dark table-sm">
    -  ...
    -</table>
    -

    Table group dividers

    -

    Add a thicker border, darker between table groups—<thead>, <tbody>, and <tfoot>—with .table-group-divider. Customize the color by changing the border-top-color (which we don’t currently provide a utility class for at this time).

    -
    -
    - - +
    <table class="table table-dark table-sm">
    +  ...
    +</table>
    +

    Table group dividers

    +

    Add a thicker border, darker between table groups—<thead>, <tbody>, and <tfoot>—with .table-group-divider. Customize the color by changing the border-top-color (which we don’t currently provide a utility class for at this time).

    +
    @@ -1481,192 +692,126 @@ -
    #@social
    - -
    - html -
    - - -
    -
    <table class="table">
    -  <thead>
    -    <tr>
    -      <th scope="col">#</th>
    -      <th scope="col">First</th>
    -      <th scope="col">Last</th>
    -      <th scope="col">Handle</th>
    -    </tr>
    -  </thead>
    -  <tbody class="table-group-divider">
    -    <tr>
    -      <th scope="row">1</th>
    -      <td>Mark</td>
    -      <td>Otto</td>
    -      <td>@mdo</td>
    -    </tr>
    -    <tr>
    -      <th scope="row">2</th>
    -      <td>Jacob</td>
    -      <td>Thornton</td>
    -      <td>@fat</td>
    -    </tr>
    -    <tr>
    -      <th scope="row">3</th>
    -      <td>John</td>
    -      <td>Doe</td>
    -      <td>@social</td>
    -    </tr>
    -  </tbody>
    -</table>
    -
    - -

    Vertical alignment

    -

    Table cells of <thead> are always vertical aligned to the bottom. Table cells in <tbody> inherit their alignment from <table> and are aligned to the top by default. Use the vertical align classes to re-align where needed.

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Heading 1Heading 2Heading 3Heading 4
    This cell inherits vertical-align: middle; from the tableThis cell inherits vertical-align: middle; from the tableThis cell inherits vertical-align: middle; from the tableThis here is some placeholder text, intended to take up quite a bit of vertical space, to demonstrate how the vertical alignment works in the preceding cells.
    This cell inherits vertical-align: bottom; from the table rowThis cell inherits vertical-align: bottom; from the table rowThis cell inherits vertical-align: bottom; from the table rowThis here is some placeholder text, intended to take up quite a bit of vertical space, to demonstrate how the vertical alignment works in the preceding cells.
    This cell inherits vertical-align: middle; from the tableThis cell inherits vertical-align: middle; from the tableThis cell is aligned to the top.This here is some placeholder text, intended to take up quite a bit of vertical space, to demonstrate how the vertical alignment works in the preceding cells.
    -
    -
    -
    <div class="table-responsive">
    -  <table class="table align-middle">
    -    <thead>
    -      <tr>
    -        ...
    -      </tr>
    -    </thead>
    -    <tbody>
    -      <tr>
    -        ...
    -      </tr>
    -      <tr class="align-bottom">
    -        ...
    -      </tr>
    -      <tr>
    -        <td>...</td>
    -        <td>...</td>
    -        <td class="align-top">This cell is aligned to the top.</td>
    -        <td>...</td>
    -      </tr>
    -    </tbody>
    -  </table>
    -</div>
    -

    Nesting

    +
    html
    <table class="table">
    +  <thead>
    +    <tr>
    +      <th scope="col">#</th>
    +      <th scope="col">First</th>
    +      <th scope="col">Last</th>
    +      <th scope="col">Handle</th>
    +    </tr>
    +  </thead>
    +  <tbody class="table-group-divider">
    +    <tr>
    +      <th scope="row">1</th>
    +      <td>Mark</td>
    +      <td>Otto</td>
    +      <td>@mdo</td>
    +    </tr>
    +    <tr>
    +      <th scope="row">2</th>
    +      <td>Jacob</td>
    +      <td>Thornton</td>
    +      <td>@fat</td>
    +    </tr>
    +    <tr>
    +      <th scope="row">3</th>
    +      <td>John</td>
    +      <td>Doe</td>
    +      <td>@social</td>
    +    </tr>
    +  </tbody>
    +</table>
    +

    Vertical alignment

    +

    Table cells of <thead> are always vertical aligned to the bottom. Table cells in <tbody> inherit their alignment from <table> and are aligned to the top by default. Use the vertical align classes to re-align where needed.

    +
    Heading 1Heading 2Heading 3Heading 4
    This cell inherits vertical-align: middle; from the tableThis cell inherits vertical-align: middle; from the tableThis cell inherits vertical-align: middle; from the tableThis here is some placeholder text, intended to take up quite a bit of vertical space, to demonstrate how the vertical alignment works in the preceding cells.
    This cell inherits vertical-align: bottom; from the table rowThis cell inherits vertical-align: bottom; from the table rowThis cell inherits vertical-align: bottom; from the table rowThis here is some placeholder text, intended to take up quite a bit of vertical space, to demonstrate how the vertical alignment works in the preceding cells.
    This cell inherits vertical-align: middle; from the tableThis cell inherits vertical-align: middle; from the tableThis cell is aligned to the top.This here is some placeholder text, intended to take up quite a bit of vertical space, to demonstrate how the vertical alignment works in the preceding cells.
    +
    <div class="table-responsive">
    +  <table class="table align-middle">
    +    <thead>
    +      <tr>
    +        ...
    +      </tr>
    +    </thead>
    +    <tbody>
    +      <tr>
    +        ...
    +      </tr>
    +      <tr class="align-bottom">
    +        ...
    +      </tr>
    +      <tr>
    +        <td>...</td>
    +        <td>...</td>
    +        <td class="align-top">This cell is aligned to the top.</td>
    +        <td>...</td>
    +      </tr>
    +    </tbody>
    +  </table>
    +</div>
    +
    +

    Nesting

    Border styles, active styles, and table variants are not inherited by nested tables.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #FirstLastHandle
    1MarkOtto@mdo
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    HeaderHeaderHeader
    AFirstLast
    BFirstLast
    CFirstLast
    -
    3JohnDoe@social
    -
    -
    <table class="table table-striped table-bordered">
    -  <thead>
    -    ...
    -  </thead>
    -  <tbody>
    -    ...
    -    <tr>
    -      <td colspan="4">
    -        <table class="table mb-0">
    -          ...
    -        </table>
    -      </td>
    -    </tr>
    -    ...
    -  </tbody>
    -</table>
    -

    How nesting works

    +
    #FirstLastHandle
    1MarkOtto@mdo
    HeaderHeaderHeader
    AFirstLast
    BFirstLast
    CFirstLast
    3JohnDoe@social
    +
    <table class="table table-striped table-bordered">
    +  <thead>
    +    ...
    +  </thead>
    +  <tbody>
    +    ...
    +    <tr>
    +      <td colspan="4">
    +        <table class="table mb-0">
    +          ...
    +        </table>
    +      </td>
    +    </tr>
    +    ...
    +  </tbody>
    +</table>
    +
    +

    How nesting works

    To prevent any styles from leaking to nested tables, we use the child combinator (>) selector in our CSS. Since we need to target all the tds and ths in the thead, tbody, and tfoot, our selector would look pretty long without it. As such, we use the rather odd looking .table > :not(caption) > * > * selector to target all tds and ths of the .table, but none of any potential nested tables.

    Note that if you add <tr>s as direct children of a table, those <tr> will be wrapped in a <tbody> by default, thus making our selectors work as intended.

    -

    Anatomy

    -

    Table head

    +

    Anatomy

    +

    Table head

    Similar to tables and dark tables, use the modifier classes .table-light or .table-dark to make <thead>s appear light or dark gray.

    -
    - - +
    #FirstLastHandle
    1MarkOtto@mdo
    2JacobThornton@fat
    3JohnDoe@social
    +
    <table class="table">
    +  <thead class="table-light">
    +    ...
    +  </thead>
    +  <tbody>
    +    ...
    +  </tbody>
    +</table>
    +
    +
    #FirstLastHandle
    1MarkOtto@mdo
    2JacobThornton@fat
    3JohnDoe@social
    +
    <table class="table">
    +  <thead class="table-dark">
    +    ...
    +  </thead>
    +  <tbody>
    +    ...
    +  </tbody>
    +</table>
    +
    +

    Table foot

    +
    #FirstLastHandle
    1MarkOtto@mdo
    2JacobThornton@fat
    3JohnDoe@social
    FooterFooterFooterFooter
    +
    <table class="table">
    +  <thead>
    +    ...
    +  </thead>
    +  <tbody>
    +    ...
    +  </tbody>
    +  <tfoot>
    +    ...
    +  </tfoot>
    +</table>
    +
    +

    Captions

    +

    A <caption> functions like a heading for a table. It helps users with screen readers to find a table and understand what it’s about and decide if they want to read it.

    +
    @@ -1693,160 +838,19 @@ - -
    List of users
    # FirstDoe @social
    -
    -
    <table class="table">
    -  <thead class="table-light">
    -    ...
    -  </thead>
    -  <tbody>
    -    ...
    -  </tbody>
    -</table>
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #FirstLastHandle
    1MarkOtto@mdo
    2JacobThornton@fat
    3JohnDoe@social
    -
    -
    <table class="table">
    -  <thead class="table-dark">
    -    ...
    -  </thead>
    -  <tbody>
    -    ...
    -  </tbody>
    -</table>
    -

    Table foot

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #FirstLastHandle
    1MarkOtto@mdo
    2JacobThornton@fat
    3JohnDoe@social
    FooterFooterFooterFooter
    -
    -
    <table class="table">
    -  <thead>
    -    ...
    -  </thead>
    -  <tbody>
    -    ...
    -  </tbody>
    -  <tfoot>
    -    ...
    -  </tfoot>
    -</table>
    -

    Captions

    -

    A <caption> functions like a heading for a table. It helps users with screen readers to find a table and understand what it’s about and decide if they want to read it.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    List of users
    #FirstLastHandle
    1MarkOtto@mdo
    2JacobThornton@fat
    3JohnDoe@social
    -
    -
    <table class="table table-sm">
    -  <caption>List of users</caption>
    -  <thead>
    -    ...
    -  </thead>
    -  <tbody>
    -    ...
    -  </tbody>
    -</table>
    -

    You can also put the <caption> on the top of the table with .caption-top.

    -
    -
    - - +
    +
    <table class="table table-sm">
    +  <caption>List of users</caption>
    +  <thead>
    +    ...
    +  </thead>
    +  <tbody>
    +    ...
    +  </tbody>
    +</table>
    +
    +

    You can also put the <caption> on the top of the table with .caption-top.

    +
    @@ -1876,646 +880,147 @@ -
    List of users
    @social
    - -
    - html -
    - - -
    -
    <table class="table caption-top">
    -  <caption>List of users</caption>
    -  <thead>
    -    <tr>
    -      <th scope="col">#</th>
    -      <th scope="col">First</th>
    -      <th scope="col">Last</th>
    -      <th scope="col">Handle</th>
    -    </tr>
    -  </thead>
    -  <tbody>
    -    <tr>
    -      <th scope="row">1</th>
    -      <td>Mark</td>
    -      <td>Otto</td>
    -      <td>@mdo</td>
    -    </tr>
    -    <tr>
    -      <th scope="row">2</th>
    -      <td>Jacob</td>
    -      <td>Thornton</td>
    -      <td>@fat</td>
    -    </tr>
    -    <tr>
    -      <th scope="row">3</th>
    -      <td>John</td>
    -      <td>Doe</td>
    -      <td>@social</td>
    -    </tr>
    -  </tbody>
    -</table>
    -
    - -

    Responsive tables

    +
    html
    <table class="table caption-top">
    +  <caption>List of users</caption>
    +  <thead>
    +    <tr>
    +      <th scope="col">#</th>
    +      <th scope="col">First</th>
    +      <th scope="col">Last</th>
    +      <th scope="col">Handle</th>
    +    </tr>
    +  </thead>
    +  <tbody>
    +    <tr>
    +      <th scope="row">1</th>
    +      <td>Mark</td>
    +      <td>Otto</td>
    +      <td>@mdo</td>
    +    </tr>
    +    <tr>
    +      <th scope="row">2</th>
    +      <td>Jacob</td>
    +      <td>Thornton</td>
    +      <td>@fat</td>
    +    </tr>
    +    <tr>
    +      <th scope="row">3</th>
    +      <td>John</td>
    +      <td>Doe</td>
    +      <td>@social</td>
    +    </tr>
    +  </tbody>
    +</table>
    +

    Responsive tables

    Responsive tables allow tables to be scrolled horizontally with ease. Make any table responsive across all viewports by wrapping a .table with .table-responsive. Or, pick a maximum breakpoint with which to have a responsive table up to by using .table-responsive{-sm|-md|-lg|-xl|-xxl}.

    -
    -
    Vertical clipping/truncation
    -

    Responsive tables make use of overflow-y: hidden, which clips off any content that goes beyond the bottom or top edges of the table. In particular, this can clip off dropdown menus and other third-party widgets.

    -
    - -

    Always responsive

    +
    Vertical clipping/truncation

    Responsive tables make use of overflow-y: hidden, which clips off any content that goes beyond the bottom or top edges of the table. In particular, this can clip off dropdown menus and other third-party widgets.

    +

    Always responsive

    Across every breakpoint, use .table-responsive for horizontally scrolling tables.

    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #HeadingHeadingHeadingHeadingHeadingHeadingHeadingHeadingHeading
    1CellCellCellCellCellCellCellCellCell
    2CellCellCellCellCellCellCellCellCell
    3CellCellCellCellCellCellCellCellCell
    -
    -
    -
    <div class="table-responsive">
    -  <table class="table">
    -    ...
    -  </table>
    -</div>
    -

    Breakpoint specific

    +
    #HeadingHeadingHeadingHeadingHeadingHeadingHeadingHeadingHeading
    1CellCellCellCellCellCellCellCellCell
    2CellCellCellCellCellCellCellCellCell
    3CellCellCellCellCellCellCellCellCell
    +
    <div class="table-responsive">
    +  <table class="table">
    +    ...
    +  </table>
    +</div>
    +
    +

    Breakpoint specific

    Use .table-responsive{-sm|-md|-lg|-xl|-xxl} as needed to create responsive tables up to a particular breakpoint. From that breakpoint and up, the table will behave normally and not scroll horizontally.

    These tables may appear broken until their responsive styles apply at specific viewport widths.

    +
    #HeadingHeadingHeadingHeadingHeadingHeadingHeadingHeading
    1CellCellCellCellCellCellCellCell
    2CellCellCellCellCellCellCellCell
    3CellCellCellCellCellCellCellCell
    #HeadingHeadingHeadingHeadingHeadingHeadingHeadingHeading
    1CellCellCellCellCellCellCellCell
    2CellCellCellCellCellCellCellCell
    3CellCellCellCellCellCellCellCell
    #HeadingHeadingHeadingHeadingHeadingHeadingHeadingHeading
    1CellCellCellCellCellCellCellCell
    2CellCellCellCellCellCellCellCell
    3CellCellCellCellCellCellCellCell
    #HeadingHeadingHeadingHeadingHeadingHeadingHeadingHeading
    1CellCellCellCellCellCellCellCell
    2CellCellCellCellCellCellCellCell
    3CellCellCellCellCellCellCellCell
    #HeadingHeadingHeadingHeadingHeadingHeadingHeadingHeading
    1CellCellCellCellCellCellCellCell
    2CellCellCellCellCellCellCellCell
    3CellCellCellCellCellCellCellCell
    #HeadingHeadingHeadingHeadingHeadingHeadingHeadingHeading
    1CellCellCellCellCellCellCellCell
    2CellCellCellCellCellCellCellCell
    3CellCellCellCellCellCellCellCell
    +
    <div class="table-responsive">
    +  <table class="table">
    +    ...
    +  </table>
    +</div>
     
    +<div class="table-responsive-sm">
    +  <table class="table">
    +    ...
    +  </table>
    +</div>
     
    +<div class="table-responsive-md">
    +  <table class="table">
    +    ...
    +  </table>
    +</div>
     
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #HeadingHeadingHeadingHeadingHeadingHeadingHeadingHeading
    1CellCellCellCellCellCellCellCell
    2CellCellCellCellCellCellCellCell
    3CellCellCellCellCellCellCellCell
    -
    -
    +<div class="table-responsive-lg"> + <table class="table"> + ... + </table> +</div> +<div class="table-responsive-xl"> + <table class="table"> + ... + </table> +</div> -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #HeadingHeadingHeadingHeadingHeadingHeadingHeadingHeading
    1CellCellCellCellCellCellCellCell
    2CellCellCellCellCellCellCellCell
    3CellCellCellCellCellCellCellCell
    -
    -
    +<div class="table-responsive-xxl"> + <table class="table"> + ... + </table> +</div> +
    +

    CSS

    +

    Sass variables

    +
    $table-cell-padding-y:        .5rem;
    +$table-cell-padding-x:        .5rem;
    +$table-cell-padding-y-sm:     .25rem;
    +$table-cell-padding-x-sm:     .25rem;
     
    +$table-cell-vertical-align:   top;
     
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #HeadingHeadingHeadingHeadingHeadingHeadingHeadingHeading
    1CellCellCellCellCellCellCellCell
    2CellCellCellCellCellCellCellCell
    3CellCellCellCellCellCellCellCell
    -
    -
    +$table-color: var(--#{$prefix}emphasis-color); +$table-bg: var(--#{$prefix}body-bg); +$table-accent-bg: transparent; +$table-th-font-weight: null; -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #HeadingHeadingHeadingHeadingHeadingHeadingHeadingHeading
    1CellCellCellCellCellCellCellCell
    2CellCellCellCellCellCellCellCell
    3CellCellCellCellCellCellCellCell
    -
    -
    +$table-striped-color: $table-color; +$table-striped-bg-factor: .05; +$table-striped-bg: rgba(var(--#{$prefix}emphasis-color-rgb), $table-striped-bg-factor); +$table-active-color: $table-color; +$table-active-bg-factor: .1; +$table-active-bg: rgba(var(--#{$prefix}emphasis-color-rgb), $table-active-bg-factor); -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #HeadingHeadingHeadingHeadingHeadingHeadingHeadingHeading
    1CellCellCellCellCellCellCellCell
    2CellCellCellCellCellCellCellCell
    3CellCellCellCellCellCellCellCell
    -
    -
    +$table-hover-color: $table-color; +$table-hover-bg-factor: .075; +$table-hover-bg: rgba(var(--#{$prefix}emphasis-color-rgb), $table-hover-bg-factor); +$table-border-factor: .2; +$table-border-width: var(--#{$prefix}border-width); +$table-border-color: var(--#{$prefix}border-color); -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #HeadingHeadingHeadingHeadingHeadingHeadingHeadingHeading
    1CellCellCellCellCellCellCellCell
    2CellCellCellCellCellCellCellCell
    3CellCellCellCellCellCellCellCell
    -
    -
    +$table-striped-order: odd; +$table-striped-columns-order: even; -
    <div class="table-responsive">
    -  <table class="table">
    -    ...
    -  </table>
    -</div>
    -
    -<div class="table-responsive-sm">
    -  <table class="table">
    -    ...
    -  </table>
    -</div>
    -
    -<div class="table-responsive-md">
    -  <table class="table">
    -    ...
    -  </table>
    -</div>
    -
    -<div class="table-responsive-lg">
    -  <table class="table">
    -    ...
    -  </table>
    -</div>
    -
    -<div class="table-responsive-xl">
    -  <table class="table">
    -    ...
    -  </table>
    -</div>
    -
    -<div class="table-responsive-xxl">
    -  <table class="table">
    -    ...
    -  </table>
    -</div>
    -

    CSS

    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $table-cell-padding-y:        .5rem;
    -$table-cell-padding-x:        .5rem;
    -$table-cell-padding-y-sm:     .25rem;
    -$table-cell-padding-x-sm:     .25rem;
    -
    -$table-cell-vertical-align:   top;
    -
    -$table-color:                 var(--#{$prefix}emphasis-color);
    -$table-bg:                    var(--#{$prefix}body-bg);
    -$table-accent-bg:             transparent;
    -
    -$table-th-font-weight:        null;
    -
    -$table-striped-color:         $table-color;
    -$table-striped-bg-factor:     .05;
    -$table-striped-bg:            rgba(var(--#{$prefix}emphasis-color-rgb), $table-striped-bg-factor);
    -
    -$table-active-color:          $table-color;
    -$table-active-bg-factor:      .1;
    -$table-active-bg:             rgba(var(--#{$prefix}emphasis-color-rgb), $table-active-bg-factor);
    -
    -$table-hover-color:           $table-color;
    -$table-hover-bg-factor:       .075;
    -$table-hover-bg:              rgba(var(--#{$prefix}emphasis-color-rgb), $table-hover-bg-factor);
    -
    -$table-border-factor:         .2;
    -$table-border-width:          var(--#{$prefix}border-width);
    -$table-border-color:          var(--#{$prefix}border-color);
    -
    -$table-striped-order:         odd;
    -$table-striped-columns-order: even;
    -
    -$table-group-separator-color: currentcolor;
    -
    -$table-caption-color:         var(--#{$prefix}secondary-color);
    -
    -$table-bg-scale:              -80%;
    -
    -

    Sass loops

    -
    -
    - scss/_variables.scss -
    - -
    -
    $table-variants: (
    -  "primary":    shift-color($primary, $table-bg-scale),
    -  "secondary":  shift-color($secondary, $table-bg-scale),
    -  "success":    shift-color($success, $table-bg-scale),
    -  "info":       shift-color($info, $table-bg-scale),
    -  "warning":    shift-color($warning, $table-bg-scale),
    -  "danger":     shift-color($danger, $table-bg-scale),
    -  "light":      $light,
    -  "dark":       $dark,
    -);
    -
    -

    Customizing

    +$table-group-separator-color: currentcolor; + +$table-caption-color: var(--#{$prefix}secondary-color); + +$table-bg-scale: -80%; +
    +

    Sass loops

    +
    $table-variants: (
    +  "primary":    shift-color($primary, $table-bg-scale),
    +  "secondary":  shift-color($secondary, $table-bg-scale),
    +  "success":    shift-color($success, $table-bg-scale),
    +  "info":       shift-color($info, $table-bg-scale),
    +  "warning":    shift-color($warning, $table-bg-scale),
    +  "danger":     shift-color($danger, $table-bg-scale),
    +  "light":      $light,
    +  "dark":       $dark,
    +);
    +
    +

    Customizing

    • The factor variables ($table-striped-bg-factor, $table-active-bg-factor & $table-hover-bg-factor) are used to determine the contrast in table variants.
    • Apart from the light & dark table variants, theme colors are lightened by the $table-bg-scale variable.
    • -
    - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/docs/5.3/content/typography/index.html b/docs/5.3/content/typography/index.html index 592d764a5a..f750968048 100644 --- a/docs/5.3/content/typography/index.html +++ b/docs/5.3/content/typography/index.html @@ -1,795 +1,150 @@ - - - - - - - - - - - - - - - - -Typography · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Typography

    -
    -

    Documentation and examples for Bootstrap typography, including global settings, headings, body text, lists, and more.

    - - -
    - - - - - -
    - - -

    Global settings

    -

    Bootstrap sets basic global display, typography, and link styles. When more control is needed, check out the textual utility classes.

    + Typography · Bootstrap v5.3

    Typography

    Documentation and examples for Bootstrap typography, including global settings, headings, body text, lists, and more.

    +

    Global settings

    +

    Bootstrap sets basic global display, typography, and link styles. When more control is needed, check out the textual utility classes.

      -
    • Use a native font stack that selects the best font-family for each OS and device.
    • -
    • For a more inclusive and accessible type scale, we use the browser’s default root font-size (typically 16px) so visitors can customize their browser defaults as needed.
    • +
    • Use a native font stack that selects the best font-family for each OS and device.
    • +
    • For a more inclusive and accessible type scale, we use the browser’s default root font-size (typically 16px) so visitors can customize their browser defaults as needed.
    • Use the $font-family-base, $font-size-base, and $line-height-base attributes as our typographic base applied to the <body>.
    • Set the global link color via $link-color.
    • Use $body-bg to set a background-color on the <body> (#fff by default).

    These styles can be found within _reboot.scss, and the global variables are defined in _variables.scss. Make sure to set $font-size-base in rem.

    -

    Headings

    +

    Headings

    All HTML headings, <h1> through <h6>, are available.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    HeadingExample
    <h1></h1>h1. Bootstrap heading
    <h2></h2>h2. Bootstrap heading
    <h3></h3>h3. Bootstrap heading
    <h4></h4>h4. Bootstrap heading
    <h5></h5>h5. Bootstrap heading
    <h6></h6>h6. Bootstrap heading
    +
    -
    <h1>h1. Bootstrap heading</h1>
    -<h2>h2. Bootstrap heading</h2>
    -<h3>h3. Bootstrap heading</h3>
    -<h4>h4. Bootstrap heading</h4>
    -<h5>h5. Bootstrap heading</h5>
    -<h6>h6. Bootstrap heading</h6>
    -

    .h1 through .h6 classes are also available, for when you want to match the font styling of a heading but cannot use the associated HTML element.

    -
    -
    - -

    h1. Bootstrap heading

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    HeadingExample
    <h1></h1>h1. Bootstrap heading
    <h2></h2>h2. Bootstrap heading
    <h3></h3>h3. Bootstrap heading
    <h4></h4>h4. Bootstrap heading
    <h5></h5>h5. Bootstrap heading
    <h6></h6>h6. Bootstrap heading
    +
    <h1>h1. Bootstrap heading</h1>
    +<h2>h2. Bootstrap heading</h2>
    +<h3>h3. Bootstrap heading</h3>
    +<h4>h4. Bootstrap heading</h4>
    +<h5>h5. Bootstrap heading</h5>
    +<h6>h6. Bootstrap heading</h6>
    +
    +

    .h1 through .h6 classes are also available, for when you want to match the font styling of a heading but cannot use the associated HTML element.

    +

    h1. Bootstrap heading

    h2. Bootstrap heading

    h3. Bootstrap heading

    h4. Bootstrap heading

    h5. Bootstrap heading

    -

    h6. Bootstrap heading

    - -
    - html -
    - - -
    -
    <p class="h1">h1. Bootstrap heading</p>
    -<p class="h2">h2. Bootstrap heading</p>
    -<p class="h3">h3. Bootstrap heading</p>
    -<p class="h4">h4. Bootstrap heading</p>
    -<p class="h5">h5. Bootstrap heading</p>
    -<p class="h6">h6. Bootstrap heading</p>
    -
    - -

    Customizing headings

    +

    h6. Bootstrap heading

    html
    <p class="h1">h1. Bootstrap heading</p>
    +<p class="h2">h2. Bootstrap heading</p>
    +<p class="h3">h3. Bootstrap heading</p>
    +<p class="h4">h4. Bootstrap heading</p>
    +<p class="h5">h5. Bootstrap heading</p>
    +<p class="h6">h6. Bootstrap heading</p>
    +

    Customizing headings

    Use the included utility classes to recreate the small secondary heading text from Bootstrap 3.

    -
    -
    - -

    +

    Fancy display heading With faded secondary text -

    - -
    - html -
    - - -
    -
    <h3>
    -  Fancy display heading
    -  <small class="text-body-secondary">With faded secondary text</small>
    -</h3>
    -
    - -

    Display headings

    +
    html
    <h3>
    +  Fancy display heading
    +  <small class="text-body-secondary">With faded secondary text</small>
    +</h3>
    +

    Display headings

    Traditional heading elements are designed to work best in the meat of your page content. When you need a heading to stand out, consider using a display heading—a larger, slightly more opinionated heading style.

    -
    -
    Display 1
    -
    Display 2
    -
    Display 3
    -
    Display 4
    -
    Display 5
    -
    Display 6
    -
    -
    <h1 class="display-1">Display 1</h1>
    -<h1 class="display-2">Display 2</h1>
    -<h1 class="display-3">Display 3</h1>
    -<h1 class="display-4">Display 4</h1>
    -<h1 class="display-5">Display 5</h1>
    -<h1 class="display-6">Display 6</h1>
    -

    Display headings are configured via the $display-font-sizes Sass map and two variables, $display-font-weight and $display-line-height.

    +
    Display 1
    Display 2
    Display 3
    Display 4
    Display 5
    Display 6
    +
    <h1 class="display-1">Display 1</h1>
    +<h1 class="display-2">Display 2</h1>
    +<h1 class="display-3">Display 3</h1>
    +<h1 class="display-4">Display 4</h1>
    +<h1 class="display-5">Display 5</h1>
    +<h1 class="display-6">Display 6</h1>
    +
    +

    Display headings are configured via the $display-font-sizes Sass map and two variables, $display-font-weight and $display-line-height.

    Display headings are customizable via two variables, $display-font-family and $display-font-style.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $display-font-sizes: (
    -  1: 5rem,
    -  2: 4.5rem,
    -  3: 4rem,
    -  4: 3.5rem,
    -  5: 3rem,
    -  6: 2.5rem
    -);
    -
    -$display-font-family: null;
    -$display-font-style:  null;
    -$display-font-weight: 300;
    -$display-line-height: $headings-line-height;
    -
    -

    Lead

    +
    $display-font-sizes: (
    +  1: 5rem,
    +  2: 4.5rem,
    +  3: 4rem,
    +  4: 3.5rem,
    +  5: 3rem,
    +  6: 2.5rem
    +);
    +
    +$display-font-family: null;
    +$display-font-style:  null;
    +$display-font-weight: 300;
    +$display-line-height: $headings-line-height;
    +
    +

    Lead

    Make a paragraph stand out by adding .lead.

    -
    -
    - -

    +

    This is a lead paragraph. It stands out from regular paragraphs. -

    - -
    - html -
    - - -
    -
    <p class="lead">
    -  This is a lead paragraph. It stands out from regular paragraphs.
    -</p>
    -
    - -

    Inline text elements

    +

    html
    <p class="lead">
    +  This is a lead paragraph. It stands out from regular paragraphs.
    +</p>
    +

    Inline text elements

    Styling for common inline HTML5 elements.

    -
    -
    - -

    You can use the mark tag to highlight text.

    +

    You can use the mark tag to highlight text.

    This line of text is meant to be treated as deleted text.

    This line of text is meant to be treated as no longer accurate.

    This line of text is meant to be treated as an addition to the document.

    This line of text will render as underlined.

    This line of text is meant to be treated as fine print.

    This line rendered as bold text.

    -

    This line rendered as italicized text.

    - -
    - html -
    - - -
    -
    <p>You can use the mark tag to <mark>highlight</mark> text.</p>
    -<p><del>This line of text is meant to be treated as deleted text.</del></p>
    -<p><s>This line of text is meant to be treated as no longer accurate.</s></p>
    -<p><ins>This line of text is meant to be treated as an addition to the document.</ins></p>
    -<p><u>This line of text will render as underlined.</u></p>
    -<p><small>This line of text is meant to be treated as fine print.</small></p>
    -<p><strong>This line rendered as bold text.</strong></p>
    -<p><em>This line rendered as italicized text.</em></p>
    -
    - +

    This line rendered as italicized text.

    html
    <p>You can use the mark tag to <mark>highlight</mark> text.</p>
    +<p><del>This line of text is meant to be treated as deleted text.</del></p>
    +<p><s>This line of text is meant to be treated as no longer accurate.</s></p>
    +<p><ins>This line of text is meant to be treated as an addition to the document.</ins></p>
    +<p><u>This line of text will render as underlined.</u></p>
    +<p><small>This line of text is meant to be treated as fine print.</small></p>
    +<p><strong>This line rendered as bold text.</strong></p>
    +<p><em>This line rendered as italicized text.</em></p>

    Beware that those tags should be used for semantic purpose:

    • <mark> represents text which is marked or highlighted for reference or notation purposes.
    • @@ -805,165 +160,77 @@
    • .text-decoration-line-through will apply the same styles as <s>.

    While not shown above, feel free to use <b> and <i> in HTML5. <b> is meant to highlight words or phrases without conveying additional importance, while <i> is mostly for voice, technical terms, etc.

    -

    Text utilities

    -

    Change text alignment, transform, style, weight, line-height, decoration and color with our text utilities and color utilities.

    -

    Abbreviations

    -

    Stylized implementation of HTML’s <abbr> element for abbreviations and acronyms to show the expanded version on hover. Abbreviations have a default underline and gain a help cursor to provide additional context on hover and to users of assistive technologies.

    +

    Text utilities

    +

    Change text alignment, transform, style, weight, line-height, decoration and color with our text utilities and color utilities.

    +

    Abbreviations

    +

    Stylized implementation of HTML’s <abbr> element for abbreviations and acronyms to show the expanded version on hover. Abbreviations have a default underline and gain a help cursor to provide additional context on hover and to users of assistive technologies.

    Add .initialism to an abbreviation for a slightly smaller font-size.

    -
    -
    - -

    attr

    -

    HTML

    - -
    - html -
    - - -
    -
    <p><abbr title="attribute">attr</abbr></p>
    -<p><abbr title="HyperText Markup Language" class="initialism">HTML</abbr></p>
    -
    - -

    Blockquotes

    +

    attr

    +

    HTML

    html
    <p><abbr title="attribute">attr</abbr></p>
    +<p><abbr title="HyperText Markup Language" class="initialism">HTML</abbr></p>
    +

    Blockquotes

    For quoting blocks of content from another source within your document. Wrap <blockquote class="blockquote"> around any HTML as the quote.

    -
    -
    - -
    +

    A well-known quote, contained in a blockquote element.

    -
    - -
    - html -
    - - -
    -
    <blockquote class="blockquote">
    -  <p>A well-known quote, contained in a blockquote element.</p>
    -</blockquote>
    -
    - -

    Naming a source

    +
    html
    <blockquote class="blockquote">
    +  <p>A well-known quote, contained in a blockquote element.</p>
    +</blockquote>
    +

    Naming a source

    The HTML spec requires that blockquote attribution be placed outside the <blockquote>. When providing attribution, wrap your <blockquote> in a <figure> and use a <figcaption> or a block level element (e.g., <p>) with the .blockquote-footer class. Be sure to wrap the name of the source work in <cite> as well.

    -
    -
    - -
    +

    A well-known quote, contained in a blockquote element.

    -
    - -
    - html -
    - - -
    -
    <figure>
    -  <blockquote class="blockquote">
    -    <p>A well-known quote, contained in a blockquote element.</p>
    -  </blockquote>
    -  <figcaption class="blockquote-footer">
    -    Someone famous in <cite title="Source Title">Source Title</cite>
    -  </figcaption>
    -</figure>
    -
    - -

    Alignment

    +
    html
    <figure>
    +  <blockquote class="blockquote">
    +    <p>A well-known quote, contained in a blockquote element.</p>
    +  </blockquote>
    +  <figcaption class="blockquote-footer">
    +    Someone famous in <cite title="Source Title">Source Title</cite>
    +  </figcaption>
    +</figure>
    +

    Alignment

    Use text utilities as needed to change the alignment of your blockquote.

    -
    -
    - -
    +

    A well-known quote, contained in a blockquote element.

    -
    - -
    - html -
    - - -
    -
    <figure class="text-center">
    -  <blockquote class="blockquote">
    -    <p>A well-known quote, contained in a blockquote element.</p>
    -  </blockquote>
    -  <figcaption class="blockquote-footer">
    -    Someone famous in <cite title="Source Title">Source Title</cite>
    -  </figcaption>
    -</figure>
    -
    - -
    -
    - -
    +
    html
    <figure class="text-center">
    +  <blockquote class="blockquote">
    +    <p>A well-known quote, contained in a blockquote element.</p>
    +  </blockquote>
    +  <figcaption class="blockquote-footer">
    +    Someone famous in <cite title="Source Title">Source Title</cite>
    +  </figcaption>
    +</figure>
    +

    A well-known quote, contained in a blockquote element.

    -
    - -
    - html -
    - - -
    -
    <figure class="text-end">
    -  <blockquote class="blockquote">
    -    <p>A well-known quote, contained in a blockquote element.</p>
    -  </blockquote>
    -  <figcaption class="blockquote-footer">
    -    Someone famous in <cite title="Source Title">Source Title</cite>
    -  </figcaption>
    -</figure>
    -
    - -

    Lists

    -

    Unstyled

    +
    html
    <figure class="text-end">
    +  <blockquote class="blockquote">
    +    <p>A well-known quote, contained in a blockquote element.</p>
    +  </blockquote>
    +  <figcaption class="blockquote-footer">
    +    Someone famous in <cite title="Source Title">Source Title</cite>
    +  </figcaption>
    +</figure>
    +

    Lists

    +

    Unstyled

    Remove the default list-style and left margin on list items (immediate children only). This only applies to immediate children list items, meaning you will need to add the class for any nested lists as well.

    -
    -
    - -
      +
      • This is a list.
      • It appears completely unstyled.
      • -
      • Structurally, it's still a list.
      • +
      • Structurally, it’s still a list.
      • However, this style only applies to immediate child elements.
      • Nested lists:
          @@ -973,68 +240,34 @@
      • This may still come in handy in some situations.
      • -
      - -
      - html -
      - - -
      -
      <ul class="list-unstyled">
      -  <li>This is a list.</li>
      -  <li>It appears completely unstyled.</li>
      -  <li>Structurally, it's still a list.</li>
      -  <li>However, this style only applies to immediate child elements.</li>
      -  <li>Nested lists:
      -    <ul>
      -      <li>are unaffected by this style</li>
      -      <li>will still show a bullet</li>
      -      <li>and have appropriate left margin</li>
      -    </ul>
      -  </li>
      -  <li>This may still come in handy in some situations.</li>
      -</ul>
      -
      - -

      Inline

      -

      Remove a list’s bullets and apply some light margin with a combination of two classes, .list-inline and .list-inline-item.

      -
      -
      - -
        +
      html
      <ul class="list-unstyled">
      +  <li>This is a list.</li>
      +  <li>It appears completely unstyled.</li>
      +  <li>Structurally, it’s still a list.</li>
      +  <li>However, this style only applies to immediate child elements.</li>
      +  <li>Nested lists:
      +    <ul>
      +      <li>are unaffected by this style</li>
      +      <li>will still show a bullet</li>
      +      <li>and have appropriate left margin</li>
      +    </ul>
      +  </li>
      +  <li>This may still come in handy in some situations.</li>
      +</ul>
      +

      Inline

      +

      Remove a list’s bullets and apply some light margin with a combination of two classes, .list-inline and .list-inline-item.

      +
      • This is a list item.
      • And another one.
      • -
      • But they're displayed inline.
      • -
      - -
      - html -
      - - -
      -
      <ul class="list-inline">
      -  <li class="list-inline-item">This is a list item.</li>
      -  <li class="list-inline-item">And another one.</li>
      -  <li class="list-inline-item">But they're displayed inline.</li>
      -</ul>
      -
      - -

      Description list alignment

      -

      Align terms and descriptions horizontally by using our grid system’s predefined classes (or semantic mixins). For longer terms, you can optionally add a .text-truncate class to truncate the text with an ellipsis.

      -
      -
      - -
      +
    • But they’re displayed inline.
    • +
    html
    <ul class="list-inline">
    +  <li class="list-inline-item">This is a list item.</li>
    +  <li class="list-inline-item">And another one.</li>
    +  <li class="list-inline-item">But they’re displayed inline.</li>
    +</ul>
    +

    Description list alignment

    +

    Align terms and descriptions horizontally by using our grid system’s predefined classes (or semantic mixins). For longer terms, you can optionally add a .text-truncate class to truncate the text with an ellipsis.

    +
    Description lists
    A description list is perfect for defining terms.
    @@ -1057,193 +290,92 @@
    I heard you like definition lists. Let me put a definition list inside your definition list.
    - +
    html
    <dl class="row">
    +  <dt class="col-sm-3">Description lists</dt>
    +  <dd class="col-sm-9">A description list is perfect for defining terms.</dd>
     
    -  
    - html -
    - - -
    -
    <dl class="row">
    -  <dt class="col-sm-3">Description lists</dt>
    -  <dd class="col-sm-9">A description list is perfect for defining terms.</dd>
    -
    -  <dt class="col-sm-3">Term</dt>
    -  <dd class="col-sm-9">
    -    <p>Definition for the term.</p>
    -    <p>And some more placeholder definition text.</p>
    -  </dd>
    -
    -  <dt class="col-sm-3">Another term</dt>
    -  <dd class="col-sm-9">This definition is short, so no extra paragraphs or anything.</dd>
    -
    -  <dt class="col-sm-3 text-truncate">Truncated term is truncated</dt>
    -  <dd class="col-sm-9">This can be useful when space is tight. Adds an ellipsis at the end.</dd>
    -
    -  <dt class="col-sm-3">Nesting</dt>
    -  <dd class="col-sm-9">
    -    <dl class="row">
    -      <dt class="col-sm-4">Nested definition list</dt>
    -      <dd class="col-sm-8">I heard you like definition lists. Let me put a definition list inside your definition list.</dd>
    -    </dl>
    -  </dd>
    -</dl>
    -
    + <dt class="col-sm-3">Term</dt> + <dd class="col-sm-9"> + <p>Definition for the term.</p> + <p>And some more placeholder definition text.</p> + </dd> -

    Responsive font sizes

    -

    In Bootstrap 5, we’ve enabled responsive font sizes by default, allowing text to scale more naturally across device and viewport sizes. Have a look at the RFS page to find out how this works.

    -

    CSS

    -

    Sass variables

    + <dt class="col-sm-3">Another term</dt> + <dd class="col-sm-9">This definition is short, so no extra paragraphs or anything.</dd> + + <dt class="col-sm-3 text-truncate">Truncated term is truncated</dt> + <dd class="col-sm-9">This can be useful when space is tight. Adds an ellipsis at the end.</dd> + + <dt class="col-sm-3">Nesting</dt> + <dd class="col-sm-9"> + <dl class="row"> + <dt class="col-sm-4">Nested definition list</dt> + <dd class="col-sm-8">I heard you like definition lists. Let me put a definition list inside your definition list.</dd> + </dl> + </dd> +</dl>
    +

    Responsive font sizes

    +

    In Bootstrap 5, we’ve enabled responsive font sizes by default, allowing text to scale more naturally across device and viewport sizes. Have a look at the RFS page to find out how this works.

    +

    CSS

    +

    Sass variables

    Headings have some dedicated variables for sizing and spacing.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $headings-margin-bottom:      $spacer * .5;
    -$headings-font-family:        null;
    -$headings-font-style:         null;
    -$headings-font-weight:        500;
    -$headings-line-height:        1.2;
    -$headings-color:              inherit;
    -
    -

    Miscellaneous typography elements covered here and in Reboot also have dedicated variables.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $lead-font-size:              $font-size-base * 1.25;
    -$lead-font-weight:            300;
    -
    -$small-font-size:             .875em;
    -
    -$sub-sup-font-size:           .75em;
    -
    -// fusv-disable
    -$text-muted:                  var(--#{$prefix}secondary-color); // Deprecated in 5.3.0
    -// fusv-enable
    -
    -$initialism-font-size:        $small-font-size;
    -
    -$blockquote-margin-y:         $spacer;
    -$blockquote-font-size:        $font-size-base * 1.25;
    -$blockquote-footer-color:     $gray-600;
    -$blockquote-footer-font-size: $small-font-size;
    -
    -$hr-margin-y:                 $spacer;
    -$hr-color:                    inherit;
    -
    -// fusv-disable
    -$hr-bg-color:                 null; // Deprecated in v5.2.0
    -$hr-height:                   null; // Deprecated in v5.2.0
    -// fusv-enable
    -
    -$hr-border-color:             null; // Allows for inherited colors
    -$hr-border-width:             var(--#{$prefix}border-width);
    -$hr-opacity:                  .25;
    -
    -$vr-border-width:             var(--#{$prefix}border-width);
    -
    -$legend-margin-bottom:        .5rem;
    -$legend-font-size:            1.5rem;
    -$legend-font-weight:          null;
    -
    -$dt-font-weight:              $font-weight-bold;
    -
    -$list-inline-padding:         .5rem;
    -
    -$mark-padding:                .1875em;
    -$mark-color:                  $body-color;
    -$mark-bg:                     $yellow-100;
    -
    -

    Sass mixins

    -

    There are no dedicated mixins for typography, but Bootstrap does use Responsive Font Sizing (RFS).

    +
    $headings-margin-bottom:      $spacer * .5;
    +$headings-font-family:        null;
    +$headings-font-style:         null;
    +$headings-font-weight:        500;
    +$headings-line-height:        1.2;
    +$headings-color:              inherit;
    +
    +

    Miscellaneous typography elements covered here and in Reboot also have dedicated variables.

    +
    $lead-font-size:              $font-size-base * 1.25;
    +$lead-font-weight:            300;
     
    -      
    -
    -
    +$small-font-size: .875em; +$sub-sup-font-size: .75em; - +// fusv-disable +$text-muted: var(--#{$prefix}secondary-color); // Deprecated in 5.3.0 +// fusv-enable - +$initialism-font-size: $small-font-size; - - - +$blockquote-margin-y: $spacer; +$blockquote-font-size: $font-size-base * 1.25; +$blockquote-footer-color: $gray-600; +$blockquote-footer-font-size: $small-font-size; - - +$hr-margin-y: $spacer; +$hr-color: inherit; - - +// fusv-disable +$hr-bg-color: null; // Deprecated in v5.2.0 +$hr-height: null; // Deprecated in v5.2.0 +// fusv-enable + +$hr-border-color: null; // Allows for inherited colors +$hr-border-width: var(--#{$prefix}border-width); +$hr-opacity: .25; + +// scss-docs-start vr-variables +$vr-border-width: var(--#{$prefix}border-width); +// scss-docs-end vr-variables + +$legend-margin-bottom: .5rem; +$legend-font-size: 1.5rem; +$legend-font-weight: null; + +$dt-font-weight: $font-weight-bold; + +$list-inline-padding: .5rem; + +$mark-padding: .1875em; +$mark-color: $body-color; +$mark-bg: $yellow-100; + +

    Sass mixins

    +

    There are no dedicated mixins for typography, but Bootstrap does use Responsive Font Sizing (RFS).

    \ No newline at end of file diff --git a/docs/5.3/customize/color-modes/index.html b/docs/5.3/customize/color-modes/index.html index 291d76f20a..96a126a045 100644 --- a/docs/5.3/customize/color-modes/index.html +++ b/docs/5.3/customize/color-modes/index.html @@ -1,590 +1,28 @@ - - - - - - - - - - - - - - - - -Color modes · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    -
    Added in v5.3 - View on GitHub - -
    -

    Color modes

    -
    -

    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.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -
    -Try it yourself! Download the source code and working demo for using Bootstrap with Stylelint, and the color modes from the twbs/examples repository. You can also open the example in StackBlitz. -
    - -

    Dark mode

    -

    Bootstrap now supports color modes, starting with dark mode! With v5.3.0 you can implement your own color mode toggler (see below for an example from Bootstrap’s docs) and apply the different color modes as you see fit. We support a light mode (default) and now dark mode. Color modes can be toggled globally on the <html> element, or on specific components and elements, thanks to the data-bs-theme attribute.

    + Color modes · Bootstrap v5.3
    +Added in v5.3 +View on GitHub +

    Color modes

    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.

    +

    Try it yourself! Download the source code and working demo for using Bootstrap with Stylelint, and the color modes from the twbs/examples repository. You can also open the example in StackBlitz.

    +

    Dark mode

    +

    Bootstrap now supports color modes, starting with dark mode! With v5.3.0 you can implement your own color mode toggler (see below for an example from Bootstrap’s docs) and apply the different color modes as you see fit. We support a light mode (default) and now dark mode. Color modes can be toggled globally on the <html> element, or on specific components and elements, thanks to the data-bs-theme attribute.

    Alternatively, you can also switch to a media query implementation thanks to our color mode mixin—see the usage section for details. Heads up though—this eliminates your ability to change themes on a per-component basis as shown below.

    -

    Example

    +

    Example

    For example, to change the color mode of a dropdown menu, add data-bs-theme="light" or data-bs-theme="dark" to the parent .dropdown. Now, no matter the global color mode, these dropdowns will display with the specified theme value.

    -
    -
    - - - -

    How it works

    +<div class="dropdown" data-bs-theme="dark"> + <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButtonDark" data-bs-toggle="dropdown" aria-expanded="false"> + Dark dropdown + </button> + <ul class="dropdown-menu" aria-labelledby="dropdownMenuButtonDark"> + <li><a class="dropdown-item active" href="#">Action</a></li> + <li><a class="dropdown-item" href="#">Action</a></li> + <li><a class="dropdown-item" href="#">Another action</a></li> + <li><a class="dropdown-item" href="#">Something else here</a></li> + <li><hr class="dropdown-divider"></li> + <li><a class="dropdown-item" href="#">Separated link</a></li> + </ul> +</div>
    +

    How it works

    • As shown above, color mode styles are controlled by the data-bs-theme attribute. This attribute can be applied to the <html> element, or to any other element or Bootstrap component. If applied to the <html> element, it will apply to everything. If applied to a component or element, it will be scoped to that specific component or element.

    • -

      For each color mode you wish to support, you’ll need to add new overrides for the shared global CSS variables. We do this already in our _root.scss stylesheet for dark mode, with light mode being the default values. In writing color mode specific styles, use the mixin:

      -
      // Color mode variables in _root.scss
      -@include color-mode(dark) {
      -  // CSS variable overrides here...
      -}
      -
    • +

      For each color mode you wish to support, you’ll need to add new overrides for the shared global CSS variables. We do this already in our _root.scss stylesheet for dark mode, with light mode being the default values. In writing color mode specific styles, use the mixin:

      +
      // Color mode variables in _root.scss
      +@include color-mode(dark) {
      +  // CSS variable overrides here...
      +}
      +
      +
    • -

      We use a custom _variables-dark.scss to power those shared global CSS variable overrides for dark mode. This file isn’t required for your own custom color modes, but it’s required for our dark mode for two reasons. First, it’s better to have a single place to reset global colors. Second, some Sass variables had to be overridden for background images embedded in our CSS for accordions, form components, and more.

      +

      We use a custom _variables-dark.scss to power those shared global CSS variable overrides for dark mode. This file isn’t required for your own custom color modes, but it’s required for our dark mode for two reasons. First, it’s better to have a single place to reset global colors. Second, some Sass variables had to be overridden for background images embedded in our CSS for accordions, form components, and more.

    -

    Usage

    -

    Enable dark mode

    -

    Enable the built in dark color mode across your entire project by adding the data-bs-theme="dark" attribute to the <html> element. This will apply the dark color mode to all components and elements, other than those with a specific data-bs-theme attribute applied. Building on the quick start template:

    -
    <!doctype html>
    -<html lang="en" data-bs-theme="dark">
    -  <head>
    -    <meta charset="utf-8">
    -    <meta name="viewport" content="width=device-width, initial-scale=1">
    -    <title>Bootstrap demo</title>
    -    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-SgOJa3DmI69IUzQ2PVdRZhwQ+dy64/BUtbMJw1MZ8t5HZApcHrRKUc4W0kG879m7" crossorigin="anonymous">
    -  </head>
    -  <body>
    -    <h1>Hello, world!</h1>
    -    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.bundle.min.js" integrity="sha384-k6d4wzSIapyDyv1kpU366/PK5hCdSbCRGRCMv+eplOQJWyd1fbcAu9OCUj5zNLiq" crossorigin="anonymous"></script>
    -  </body>
    -</html>
    -

    Bootstrap does not yet ship with a built-in color mode picker, but you can use the one from our own documentation if you like. Learn more in the JavaScript section.

    -

    Building with Sass

    -

    Our new dark mode option is available to use for all users of Bootstrap, but it’s controlled via data attributes instead of media queries and does not automatically toggle your project’s color mode. You can disable our dark mode entirely via Sass by changing $enable-dark-mode to false.

    +

    Usage

    +

    Enable dark mode

    +

    Enable the built in dark color mode across your entire project by adding the data-bs-theme="dark" attribute to the <html> element. This will apply the dark color mode to all components and elements, other than those with a specific data-bs-theme attribute applied. Building on the quick start template:

    +
    <!doctype html>
    +<html lang="en" data-bs-theme="dark">
    +  <head>
    +    <meta charset="utf-8">
    +    <meta name="viewport" content="width=device-width, initial-scale=1">
    +    <title>Bootstrap demo</title>
    +    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-SgOJa3DmI69IUzQ2PVdRZhwQ+dy64/BUtbMJw1MZ8t5HZApcHrRKUc4W0kG879m7" crossorigin="anonymous">
    +  </head>
    +  <body>
    +    <h1>Hello, world!</h1>
    +    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.bundle.min.js" integrity="sha384-k6d4wzSIapyDyv1kpU366/PK5hCdSbCRGRCMv+eplOQJWyd1fbcAu9OCUj5zNLiq" crossorigin="anonymous"></script>
    +  </body>
    +</html>
    +
    +

    Bootstrap does not yet ship with a built-in color mode picker, but you can use the one from our own documentation if you like. Learn more in the JavaScript section.

    +

    Building with Sass

    +

    Our new dark mode option is available to use for all users of Bootstrap, but it’s controlled via data attributes instead of media queries and does not automatically toggle your project’s color mode. You can disable our dark mode entirely via Sass by changing $enable-dark-mode to false.

    We use a custom Sass mixin, color-mode(), to help you control how color modes are applied. By default, we use a data attribute approach, allowing you to create more user-friendly experiences where your visitors can choose to have an automatic dark mode or control their preference (like in our own docs here). This is also an easy and scalable way to add different themes and more custom color modes beyond light and dark.

    -

    In case you want to use media queries and only make color modes automatic, you can change the mixin’s default type via Sass variable. Consider the following snippet and its compiled CSS output.

    -
    $color-mode-type: data;
    -
    -@include color-mode(dark) {
    -  .element {
    -    color: var(--bs-primary-text-emphasis);
    -    background-color: var(--bs-primary-bg-subtle);
    -  }
    -}
    -

    Outputs to:

    -
    [data-bs-theme=dark] .element {
    -  color: var(--bs-primary-text-emphasis);
    -  background-color: var(--bs-primary-bg-subtle);
    -}
    -

    And when setting to media-query:

    -
    $color-mode-type: media-query;
    -
    -@include color-mode(dark) {
    -  .element {
    -    color: var(--bs-primary-text-emphasis);
    -    background-color: var(--bs-primary-bg-subtle);
    -  }
    -}
    -

    Outputs to:

    -
    @media (prefers-color-scheme: dark) {
    -  .element {
    -    color: var(--bs-primary-text-emphasis);
    -    background-color: var(--bs-primary-bg-subtle);
    -  }
    -}
    -

    Custom color modes

    -

    While the primary use case for color modes is light and dark mode, custom color modes are also possible. Create your own data-bs-theme selector with a custom value as the name of your color mode, then modify our Sass and CSS variables as needed. We opted to create a separate _variables-dark.scss stylesheet to house Bootstrap’s dark mode specific Sass variables, but that’s not required for you.

    -

    For example, you can create a “blue theme” with the selector data-bs-theme="blue". In your custom Sass or CSS file, add the new selector and override any global or component CSS variables as needed. If you’re using Sass, you can also use Sass’s functions within your CSS variable overrides.

    -
    -
    [data-bs-theme="blue"] {
    -  --bs-body-color: var(--bs-white);
    -  --bs-body-color-rgb: #{to-rgb($white)};
    -  --bs-body-bg: var(--bs-blue);
    -  --bs-body-bg-rgb: #{to-rgb($blue)};
    -  --bs-tertiary-bg: #{$blue-600};
    -
    -  .dropdown-menu {
    -    --bs-dropdown-bg: #{mix($blue-500, $blue-600)};
    -    --bs-dropdown-link-active-bg: #{$blue-700};
    -  }
    -
    -  .btn-secondary {
    -    --bs-btn-bg: #{mix($gray-600, $blue-400, .5)};
    -    --bs-btn-border-color: #{rgba($white, .25)};
    -    --bs-btn-hover-bg: #{darken(mix($gray-600, $blue-400, .5), 5%)};
    -    --bs-btn-hover-border-color: #{rgba($white, .25)};
    -    --bs-btn-active-bg: #{darken(mix($gray-600, $blue-400, .5), 10%)};
    -    --bs-btn-active-border-color: #{rgba($white, .5)};
    -    --bs-btn-focus-border-color: #{rgba($white, .5)};
    -    --bs-btn-focus-box-shadow: 0 0 0 .25rem rgba(255, 255, 255, .2);
    -  }
    -}
    -
    -
    -
    Example blue theme
    -

    Some paragraph text to show how the blue theme might look with written copy.

    -
    - -
    -
    <div data-bs-theme="blue">
    -  ...
    -</div>
    -

    JavaScript

    -

    To allow visitors or users to toggle color modes, you’ll need to create a toggle element to control the data-bs-theme attribute on the root element, <html>. We’ve built a toggler in our documentation that initially defers to a user’s current system color mode, but provides an option to override that and pick a specific color mode.

    -

    Here’s a look at the JavaScript that powers it. Feel free to inspect our own documentation navbar to see how it’s implemented using HTML and CSS from our own components. It is suggested to include the JavaScript at the top of your page to reduce potential screen flickering during reloading of your site. Note that if you decide to use media queries for your color modes, your JavaScript may need to be modified or removed if you prefer an implicit control.

    -
    /*!
    - * Color mode toggler for Bootstrap's docs (https://getbootstrap.com/)
    - * Copyright 2011-2025 The Bootstrap Authors
    - * Licensed under the Creative Commons Attribution 3.0 Unported License.
    - */
    -
    -(() => {
    -  'use strict'
    -
    -  const getStoredTheme = () => localStorage.getItem('theme')
    -  const setStoredTheme = theme => localStorage.setItem('theme', theme)
    -
    -  const getPreferredTheme = () => {
    -    const storedTheme = getStoredTheme()
    -    if (storedTheme) {
    -      return storedTheme
    -    }
    -
    -    return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
    -  }
    -
    -  const setTheme = 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)
    -    }
    -  }
    -
    -  setTheme(getPreferredTheme())
    -
    -  const showActiveTheme = (theme, focus = false) => {
    -    const themeSwitcher = document.querySelector('#bd-theme')
    -
    -    if (!themeSwitcher) {
    -      return
    -    }
    -
    -    const themeSwitcherText = document.querySelector('#bd-theme-text')
    -    const activeThemeIcon = document.querySelector('.theme-icon-active use')
    -    const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`)
    -    const svgOfActiveBtn = btnToActive.querySelector('svg use').getAttribute('href')
    -
    -    document.querySelectorAll('[data-bs-theme-value]').forEach(element => {
    -      element.classList.remove('active')
    -      element.setAttribute('aria-pressed', 'false')
    -    })
    -
    -    btnToActive.classList.add('active')
    -    btnToActive.setAttribute('aria-pressed', 'true')
    -    activeThemeIcon.setAttribute('href', svgOfActiveBtn)
    -    const themeSwitcherLabel = `${themeSwitcherText.textContent} (${btnToActive.dataset.bsThemeValue})`
    -    themeSwitcher.setAttribute('aria-label', themeSwitcherLabel)
    -
    -    if (focus) {
    -      themeSwitcher.focus()
    -    }
    -  }
    -
    -  window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
    -    const storedTheme = getStoredTheme()
    -    if (storedTheme !== 'light' && storedTheme !== 'dark') {
    -      setTheme(getPreferredTheme())
    -    }
    -  })
    -
    -  window.addEventListener('DOMContentLoaded', () => {
    -    showActiveTheme(getPreferredTheme())
    -
    -    document.querySelectorAll('[data-bs-theme-value]')
    -      .forEach(toggle => {
    -        toggle.addEventListener('click', () => {
    -          const theme = toggle.getAttribute('data-bs-theme-value')
    -          setStoredTheme(theme)
    -          setTheme(theme)
    -          showActiveTheme(theme, true)
    -        })
    -      })
    -  })
    -})()
    -
    +

    In case you want to use media queries and only make color modes automatic, you can change the mixin’s default type via Sass variable. Consider the following snippet and its compiled CSS output.

    +
    $color-mode-type: data;
     
    -

    Adding theme colors

    -

    Adding a new color in $theme-colors is not enough for some of our components like alerts and list groups. New colors must also be defined in $theme-colors-text, $theme-colors-bg-subtle, and $theme-colors-border-subtle for light theme; but also in $theme-colors-text-dark, $theme-colors-bg-subtle-dark, and $theme-colors-border-subtle-dark for dark theme.

    -

    This is a manual process because Sass cannot generate its own Sass variables from an existing variable or map. In future versions of Bootstrap, we’ll revisit this setup to reduce the duplication.

    -
    // Required
    -@import "functions";
    -@import "variables";
    -@import "variables-dark";
    -
    -// Add a custom color to $theme-colors
    -$custom-colors: (
    -  "custom-color": #712cf9
    -);
    -$theme-colors: map-merge($theme-colors, $custom-colors);
    -
    -@import "maps";
    -@import "mixins";
    -@import "utilities";
    -
    -// Add a custom color to new theme maps
    -
    -// Light mode
    -$custom-colors-text: ("custom-color": #712cf9);
    -$custom-colors-bg-subtle: ("custom-color": #e1d2fe);
    -$custom-colors-border-subtle: ("custom-color": #bfa1fc);
    -
    -$theme-colors-text: map-merge($theme-colors-text, $custom-colors-text);
    -$theme-colors-bg-subtle: map-merge($theme-colors-bg-subtle, $custom-colors-bg-subtle);
    -$theme-colors-border-subtle: map-merge($theme-colors-border-subtle, $custom-colors-border-subtle);
    -
    -// Dark mode
    -$custom-colors-text-dark: ("custom-color": #e1d2f2);
    -$custom-colors-bg-subtle-dark: ("custom-color": #8951fa);
    -$custom-colors-border-subtle-dark: ("custom-color": #e1d2f2);
    -
    -$theme-colors-text-dark: map-merge($theme-colors-text-dark, $custom-colors-text-dark);
    -$theme-colors-bg-subtle-dark: map-merge($theme-colors-bg-subtle-dark, $custom-colors-bg-subtle-dark);
    -$theme-colors-border-subtle-dark: map-merge($theme-colors-border-subtle-dark, $custom-colors-border-subtle-dark);
    -
    -// Remainder of Bootstrap imports
    -@import "root";
    -@import "reboot";
    -// etc
    -

    CSS

    -

    Variables

    +@include color-mode(dark) { + .element { + color: var(--bs-primary-text-emphasis); + background-color: var(--bs-primary-bg-subtle); + } +} +
    +

    Outputs to:

    +
    [data-bs-theme=dark] .element {
    +  color: var(--bs-primary-text-emphasis);
    +  background-color: var(--bs-primary-bg-subtle);
    +}
    +
    +

    And when setting to media-query:

    +
    $color-mode-type: media-query;
    +
    +@include color-mode(dark) {
    +  .element {
    +    color: var(--bs-primary-text-emphasis);
    +    background-color: var(--bs-primary-bg-subtle);
    +  }
    +}
    +
    +

    Outputs to:

    +
    @media (prefers-color-scheme: dark) {
    +  .element {
    +    color: var(--bs-primary-text-emphasis);
    +    background-color: var(--bs-primary-bg-subtle);
    +  }
    +}
    +
    +

    Custom color modes

    +

    While the primary use case for color modes is light and dark mode, custom color modes are also possible. Create your own data-bs-theme selector with a custom value as the name of your color mode, then modify our Sass and CSS variables as needed. We opted to create a separate _variables-dark.scss stylesheet to house Bootstrap’s dark mode specific Sass variables, but that’s not required for you.

    +

    For example, you can create a “blue theme” with the selector data-bs-theme="blue". In your custom Sass or CSS file, add the new selector and override any global or component CSS variables as needed. If you’re using Sass, you can also use Sass’s functions within your CSS variable overrides.

    +
    [data-bs-theme="blue"] {
    +  --bs-body-color: var(--bs-white);
    +  --bs-body-color-rgb: #{to-rgb($white)};
    +  --bs-body-bg: var(--bs-blue);
    +  --bs-body-bg-rgb: #{to-rgb($blue)};
    +  --bs-tertiary-bg: #{$blue-600};
    +
    +  .dropdown-menu {
    +    --bs-dropdown-bg: #{mix($blue-500, $blue-600)};
    +    --bs-dropdown-link-active-bg: #{$blue-700};
    +  }
    +
    +  .btn-secondary {
    +    --bs-btn-bg: #{mix($gray-600, $blue-400, .5)};
    +    --bs-btn-border-color: #{rgba($white, .25)};
    +    --bs-btn-hover-bg: #{darken(mix($gray-600, $blue-400, .5), 5%)};
    +    --bs-btn-hover-border-color: #{rgba($white, .25)};
    +    --bs-btn-active-bg: #{darken(mix($gray-600, $blue-400, .5), 10%)};
    +    --bs-btn-active-border-color: #{rgba($white, .5)};
    +    --bs-btn-focus-border-color: #{rgba($white, .5)};
    +    --bs-btn-focus-box-shadow: 0 0 0 .25rem rgba(255, 255, 255, .2);
    +  }
    +}
    +
    +
    +
    Example blue theme
    +

    Some paragraph text to show how the blue theme might look with written copy.

    + +
    + + +
    +
    <div data-bs-theme="blue">
    +  ...
    +</div>
    +
    +

    JavaScript

    +

    To allow visitors or users to toggle color modes, you’ll need to create a toggle element to control the data-bs-theme attribute on the root element, <html>. We’ve built a toggler in our documentation that initially defers to a user’s current system color mode, but provides an option to override that and pick a specific color mode.

    +

    Here’s a look at the JavaScript that powers it. Feel free to inspect our own documentation navbar to see how it’s implemented using HTML and CSS from our own components. It is suggested to include the JavaScript at the top of your page to reduce potential screen flickering during reloading of your site. Note that if you decide to use media queries for your color modes, your JavaScript may need to be modified or removed if you prefer an implicit control.

    +
    /*!
    + * Color mode toggler for Bootstrap's docs (https://getbootstrap.com/)
    + * Copyright 2011-2025 The Bootstrap Authors
    + * Licensed under the Creative Commons Attribution 3.0 Unported License.
    + */
    +
    +(() => {
    +  'use strict'
    +
    +  const getStoredTheme = () => localStorage.getItem('theme')
    +  const setStoredTheme = theme => localStorage.setItem('theme', theme)
    +
    +  const getPreferredTheme = () => {
    +    const storedTheme = getStoredTheme()
    +    if (storedTheme) {
    +      return storedTheme
    +    }
    +
    +    return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
    +  }
    +
    +  const setTheme = 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)
    +    }
    +  }
    +
    +  setTheme(getPreferredTheme())
    +
    +  const showActiveTheme = (theme, focus = false) => {
    +    const themeSwitcher = document.querySelector('#bd-theme')
    +
    +    if (!themeSwitcher) {
    +      return
    +    }
    +
    +    const themeSwitcherText = document.querySelector('#bd-theme-text')
    +    const activeThemeIcon = document.querySelector('.theme-icon-active use')
    +    const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`)
    +    const svgOfActiveBtn = btnToActive.querySelector('svg use').getAttribute('href')
    +
    +    document.querySelectorAll('[data-bs-theme-value]').forEach(element => {
    +      element.classList.remove('active')
    +      element.setAttribute('aria-pressed', 'false')
    +    })
    +
    +    btnToActive.classList.add('active')
    +    btnToActive.setAttribute('aria-pressed', 'true')
    +    activeThemeIcon.setAttribute('href', svgOfActiveBtn)
    +    const themeSwitcherLabel = `${themeSwitcherText.textContent} (${btnToActive.dataset.bsThemeValue})`
    +    themeSwitcher.setAttribute('aria-label', themeSwitcherLabel)
    +
    +    if (focus) {
    +      themeSwitcher.focus()
    +    }
    +  }
    +
    +  window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
    +    const storedTheme = getStoredTheme()
    +    if (storedTheme !== 'light' && storedTheme !== 'dark') {
    +      setTheme(getPreferredTheme())
    +    }
    +  })
    +
    +  window.addEventListener('DOMContentLoaded', () => {
    +    showActiveTheme(getPreferredTheme())
    +
    +    document.querySelectorAll('[data-bs-theme-value]')
    +      .forEach(toggle => {
    +        toggle.addEventListener('click', () => {
    +          const theme = toggle.getAttribute('data-bs-theme-value')
    +          setStoredTheme(theme)
    +          setTheme(theme)
    +          showActiveTheme(theme, true)
    +        })
    +      })
    +  })
    +})()
    +
    +

    Adding theme colors

    +

    Adding a new color in $theme-colors is not enough for some of our components like alerts and list groups. New colors must also be defined in $theme-colors-text, $theme-colors-bg-subtle, and $theme-colors-border-subtle for light theme; but also in $theme-colors-text-dark, $theme-colors-bg-subtle-dark, and $theme-colors-border-subtle-dark for dark theme.

    +

    This is a manual process because Sass cannot generate its own Sass variables from an existing variable or map. In future versions of Bootstrap, we'll revisit this setup to reduce the duplication.

    +
    // Required
    +@import "functions";
    +@import "variables";
    +@import "variables-dark";
    +
    +// Add a custom color to $theme-colors
    +$custom-colors: (
    +  "custom-color": #712cf9
    +);
    +$theme-colors: map-merge($theme-colors, $custom-colors);
    +
    +@import "maps";
    +@import "mixins";
    +@import "utilities";
    +
    +// Add a custom color to new theme maps
    +
    +// Light mode
    +$custom-colors-text: ("custom-color": #712cf9);
    +$custom-colors-bg-subtle: ("custom-color": #e1d2fe);
    +$custom-colors-border-subtle: ("custom-color": #bfa1fc);
    +
    +$theme-colors-text: map-merge($theme-colors-text, $custom-colors-text);
    +$theme-colors-bg-subtle: map-merge($theme-colors-bg-subtle, $custom-colors-bg-subtle);
    +$theme-colors-border-subtle: map-merge($theme-colors-border-subtle, $custom-colors-border-subtle);
    +
    +// Dark mode
    +$custom-colors-text-dark: ("custom-color": #e1d2f2);
    +$custom-colors-bg-subtle-dark: ("custom-color": #8951fa);
    +$custom-colors-border-subtle-dark: ("custom-color": #e1d2f2);
    +
    +$theme-colors-text-dark: map-merge($theme-colors-text-dark, $custom-colors-text-dark);
    +$theme-colors-bg-subtle-dark: map-merge($theme-colors-bg-subtle-dark, $custom-colors-bg-subtle-dark);
    +$theme-colors-border-subtle-dark: map-merge($theme-colors-border-subtle-dark, $custom-colors-border-subtle-dark);
    +
    +// Remainder of Bootstrap imports
    +@import "root";
    +@import "reboot";
    +// etc
    +
    +

    CSS

    +

    Variables

    Dozens of root level CSS variables are repeated as overrides for dark mode. These are scoped to the color mode selector, which defaults to data-bs-theme but can be configured to use a prefers-color-scheme media query. Use these variables as a guideline for generating your own new color modes.

    -
    -
    - scss/_root.scss -
    - -
    -
    --#{$prefix}body-color: #{$body-color-dark};
    ---#{$prefix}body-color-rgb: #{to-rgb($body-color-dark)};
    ---#{$prefix}body-bg: #{$body-bg-dark};
    ---#{$prefix}body-bg-rgb: #{to-rgb($body-bg-dark)};
    -
    ---#{$prefix}emphasis-color: #{$body-emphasis-color-dark};
    ---#{$prefix}emphasis-color-rgb: #{to-rgb($body-emphasis-color-dark)};
    -
    ---#{$prefix}secondary-color: #{$body-secondary-color-dark};
    ---#{$prefix}secondary-color-rgb: #{to-rgb($body-secondary-color-dark)};
    ---#{$prefix}secondary-bg: #{$body-secondary-bg-dark};
    ---#{$prefix}secondary-bg-rgb: #{to-rgb($body-secondary-bg-dark)};
    -
    ---#{$prefix}tertiary-color: #{$body-tertiary-color-dark};
    ---#{$prefix}tertiary-color-rgb: #{to-rgb($body-tertiary-color-dark)};
    ---#{$prefix}tertiary-bg: #{$body-tertiary-bg-dark};
    ---#{$prefix}tertiary-bg-rgb: #{to-rgb($body-tertiary-bg-dark)};
    -
    -@each $color, $value in $theme-colors-text-dark {
    -  --#{$prefix}#{$color}-text-emphasis: #{$value};
    -}
    -
    -@each $color, $value in $theme-colors-bg-subtle-dark {
    -  --#{$prefix}#{$color}-bg-subtle: #{$value};
    -}
    -
    -@each $color, $value in $theme-colors-border-subtle-dark {
    -  --#{$prefix}#{$color}-border-subtle: #{$value};
    -}
    -
    ---#{$prefix}heading-color: #{$headings-color-dark};
    -
    ---#{$prefix}link-color: #{$link-color-dark};
    ---#{$prefix}link-hover-color: #{$link-hover-color-dark};
    ---#{$prefix}link-color-rgb: #{to-rgb($link-color-dark)};
    ---#{$prefix}link-hover-color-rgb: #{to-rgb($link-hover-color-dark)};
    -
    ---#{$prefix}code-color: #{$code-color-dark};
    ---#{$prefix}highlight-color: #{$mark-color-dark};
    ---#{$prefix}highlight-bg: #{$mark-bg-dark};
    -
    ---#{$prefix}border-color: #{$border-color-dark};
    ---#{$prefix}border-color-translucent: #{$border-color-translucent-dark};
    -
    ---#{$prefix}form-valid-color: #{$form-valid-color-dark};
    ---#{$prefix}form-valid-border-color: #{$form-valid-border-color-dark};
    ---#{$prefix}form-invalid-color: #{$form-invalid-color-dark};
    ---#{$prefix}form-invalid-border-color: #{$form-invalid-border-color-dark};
    -

    Sass variables

    +
    --#{$prefix}body-color: #{$body-color-dark};
    +--#{$prefix}body-color-rgb: #{to-rgb($body-color-dark)};
    +--#{$prefix}body-bg: #{$body-bg-dark};
    +--#{$prefix}body-bg-rgb: #{to-rgb($body-bg-dark)};
    +
    +--#{$prefix}emphasis-color: #{$body-emphasis-color-dark};
    +--#{$prefix}emphasis-color-rgb: #{to-rgb($body-emphasis-color-dark)};
    +
    +--#{$prefix}secondary-color: #{$body-secondary-color-dark};
    +--#{$prefix}secondary-color-rgb: #{to-rgb($body-secondary-color-dark)};
    +--#{$prefix}secondary-bg: #{$body-secondary-bg-dark};
    +--#{$prefix}secondary-bg-rgb: #{to-rgb($body-secondary-bg-dark)};
    +
    +--#{$prefix}tertiary-color: #{$body-tertiary-color-dark};
    +--#{$prefix}tertiary-color-rgb: #{to-rgb($body-tertiary-color-dark)};
    +--#{$prefix}tertiary-bg: #{$body-tertiary-bg-dark};
    +--#{$prefix}tertiary-bg-rgb: #{to-rgb($body-tertiary-bg-dark)};
    +
    +@each $color, $value in $theme-colors-text-dark {
    +  --#{$prefix}#{$color}-text-emphasis: #{$value};
    +}
    +
    +@each $color, $value in $theme-colors-bg-subtle-dark {
    +  --#{$prefix}#{$color}-bg-subtle: #{$value};
    +}
    +
    +@each $color, $value in $theme-colors-border-subtle-dark {
    +  --#{$prefix}#{$color}-border-subtle: #{$value};
    +}
    +
    +--#{$prefix}heading-color: #{$headings-color-dark};
    +
    +--#{$prefix}link-color: #{$link-color-dark};
    +--#{$prefix}link-hover-color: #{$link-hover-color-dark};
    +--#{$prefix}link-color-rgb: #{to-rgb($link-color-dark)};
    +--#{$prefix}link-hover-color-rgb: #{to-rgb($link-hover-color-dark)};
    +
    +--#{$prefix}code-color: #{$code-color-dark};
    +--#{$prefix}highlight-color: #{$mark-color-dark};
    +--#{$prefix}highlight-bg: #{$mark-bg-dark};
    +
    +--#{$prefix}border-color: #{$border-color-dark};
    +--#{$prefix}border-color-translucent: #{$border-color-translucent-dark};
    +
    +--#{$prefix}form-valid-color: #{$form-valid-color-dark};
    +--#{$prefix}form-valid-border-color: #{$form-valid-border-color-dark};
    +--#{$prefix}form-invalid-color: #{$form-invalid-color-dark};
    +--#{$prefix}form-invalid-border-color: #{$form-invalid-border-color-dark};
    +
    +

    Sass variables

    CSS variables for our dark color mode are partially generated from dark mode specific Sass variables in _variables-dark.scss. This also includes some custom overrides for changing the colors of embedded SVGs used throughout our components.

    -
    -
    $primary-text-emphasis-dark:        tint-color($primary, 40%);
    -$secondary-text-emphasis-dark:      tint-color($secondary, 40%);
    -$success-text-emphasis-dark:        tint-color($success, 40%);
    -$info-text-emphasis-dark:           tint-color($info, 40%);
    -$warning-text-emphasis-dark:        tint-color($warning, 40%);
    -$danger-text-emphasis-dark:         tint-color($danger, 40%);
    -$light-text-emphasis-dark:          $gray-100;
    -$dark-text-emphasis-dark:           $gray-300;
    -
    -$primary-bg-subtle-dark:            shade-color($primary, 80%);
    -$secondary-bg-subtle-dark:          shade-color($secondary, 80%);
    -$success-bg-subtle-dark:            shade-color($success, 80%);
    -$info-bg-subtle-dark:               shade-color($info, 80%);
    -$warning-bg-subtle-dark:            shade-color($warning, 80%);
    -$danger-bg-subtle-dark:             shade-color($danger, 80%);
    -$light-bg-subtle-dark:              $gray-800;
    -$dark-bg-subtle-dark:               mix($gray-800, $black);
    -
    -$primary-border-subtle-dark:        shade-color($primary, 40%);
    -$secondary-border-subtle-dark:      shade-color($secondary, 40%);
    -$success-border-subtle-dark:        shade-color($success, 40%);
    -$info-border-subtle-dark:           shade-color($info, 40%);
    -$warning-border-subtle-dark:        shade-color($warning, 40%);
    -$danger-border-subtle-dark:         shade-color($danger, 40%);
    -$light-border-subtle-dark:          $gray-700;
    -$dark-border-subtle-dark:           $gray-800;
    -
    -$body-color-dark:                   $gray-300;
    -$body-bg-dark:                      $gray-900;
    -$body-secondary-color-dark:         rgba($body-color-dark, .75);
    -$body-secondary-bg-dark:            $gray-800;
    -$body-tertiary-color-dark:          rgba($body-color-dark, .5);
    -$body-tertiary-bg-dark:             mix($gray-800, $gray-900, 50%);
    -$body-emphasis-color-dark:          $white;
    -$border-color-dark:                 $gray-700;
    -$border-color-translucent-dark:     rgba($white, .15);
    -$headings-color-dark:               inherit;
    -$link-color-dark:                   tint-color($primary, 40%);
    -$link-hover-color-dark:             shift-color($link-color-dark, -$link-shade-percentage);
    -$code-color-dark:                   tint-color($code-color, 40%);
    -$mark-color-dark:                   $body-color-dark;
    -$mark-bg-dark:                      $yellow-800;
    -
    -
    -//
    -// Forms
    -//
    -
    -$form-select-indicator-color-dark:  $body-color-dark;
    -$form-select-indicator-dark:        url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='#{$form-select-indicator-color-dark}' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/></svg>");
    -
    -$form-switch-color-dark:            rgba($white, .25);
    -$form-switch-bg-image-dark:         url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='#{$form-switch-color-dark}'/></svg>");
    -
    -$form-valid-color-dark:             $green-300;
    -$form-valid-border-color-dark:      $green-300;
    -$form-invalid-color-dark:           $red-300;
    -$form-invalid-border-color-dark:    $red-300;
    -
    -
    -//
    -// Accordion
    -//
    -
    -$accordion-icon-color-dark:         $primary-text-emphasis-dark;
    -$accordion-icon-active-color-dark:  $primary-text-emphasis-dark;
    -
    -$accordion-button-icon-dark:         url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='#{$accordion-icon-color-dark}'><path fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/></svg>");
    -$accordion-button-active-icon-dark:  url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='#{$accordion-icon-active-color-dark}'><path fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/></svg>");
    -
    -

    Sass mixins

    +
    // scss-docs-start theme-text-dark-variables
    +$primary-text-emphasis-dark:        tint-color($primary, 40%);
    +$secondary-text-emphasis-dark:      tint-color($secondary, 40%);
    +$success-text-emphasis-dark:        tint-color($success, 40%);
    +$info-text-emphasis-dark:           tint-color($info, 40%);
    +$warning-text-emphasis-dark:        tint-color($warning, 40%);
    +$danger-text-emphasis-dark:         tint-color($danger, 40%);
    +$light-text-emphasis-dark:          $gray-100;
    +$dark-text-emphasis-dark:           $gray-300;
    +// scss-docs-end theme-text-dark-variables
    +
    +// scss-docs-start theme-bg-subtle-dark-variables
    +$primary-bg-subtle-dark:            shade-color($primary, 80%);
    +$secondary-bg-subtle-dark:          shade-color($secondary, 80%);
    +$success-bg-subtle-dark:            shade-color($success, 80%);
    +$info-bg-subtle-dark:               shade-color($info, 80%);
    +$warning-bg-subtle-dark:            shade-color($warning, 80%);
    +$danger-bg-subtle-dark:             shade-color($danger, 80%);
    +$light-bg-subtle-dark:              $gray-800;
    +$dark-bg-subtle-dark:               mix($gray-800, $black);
    +// scss-docs-end theme-bg-subtle-dark-variables
    +
    +// scss-docs-start theme-border-subtle-dark-variables
    +$primary-border-subtle-dark:        shade-color($primary, 40%);
    +$secondary-border-subtle-dark:      shade-color($secondary, 40%);
    +$success-border-subtle-dark:        shade-color($success, 40%);
    +$info-border-subtle-dark:           shade-color($info, 40%);
    +$warning-border-subtle-dark:        shade-color($warning, 40%);
    +$danger-border-subtle-dark:         shade-color($danger, 40%);
    +$light-border-subtle-dark:          $gray-700;
    +$dark-border-subtle-dark:           $gray-800;
    +// scss-docs-end theme-border-subtle-dark-variables
    +
    +$body-color-dark:                   $gray-300;
    +$body-bg-dark:                      $gray-900;
    +$body-secondary-color-dark:         rgba($body-color-dark, .75);
    +$body-secondary-bg-dark:            $gray-800;
    +$body-tertiary-color-dark:          rgba($body-color-dark, .5);
    +$body-tertiary-bg-dark:             mix($gray-800, $gray-900, 50%);
    +$body-emphasis-color-dark:          $white;
    +$border-color-dark:                 $gray-700;
    +$border-color-translucent-dark:     rgba($white, .15);
    +$headings-color-dark:               inherit;
    +$link-color-dark:                   tint-color($primary, 40%);
    +$link-hover-color-dark:             shift-color($link-color-dark, -$link-shade-percentage);
    +$code-color-dark:                   tint-color($code-color, 40%);
    +$mark-color-dark:                   $body-color-dark;
    +$mark-bg-dark:                      $yellow-800;
    +
    +
    +//
    +// Forms
    +//
    +
    +$form-select-indicator-color-dark:  $body-color-dark;
    +$form-select-indicator-dark:        url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='#{$form-select-indicator-color-dark}' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/></svg>");
    +
    +$form-switch-color-dark:            rgba($white, .25);
    +$form-switch-bg-image-dark:         url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='#{$form-switch-color-dark}'/></svg>");
    +
    +// scss-docs-start form-validation-colors-dark
    +$form-valid-color-dark:             $green-300;
    +$form-valid-border-color-dark:      $green-300;
    +$form-invalid-color-dark:           $red-300;
    +$form-invalid-border-color-dark:    $red-300;
    +// scss-docs-end form-validation-colors-dark
    +
    +
    +//
    +// Accordion
    +//
    +
    +$accordion-icon-color-dark:         $primary-text-emphasis-dark;
    +$accordion-icon-active-color-dark:  $primary-text-emphasis-dark;
    +
    +$accordion-button-icon-dark:         url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='#{$accordion-icon-color-dark}'><path fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/></svg>");
    +$accordion-button-active-icon-dark:  url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='#{$accordion-icon-active-color-dark}'><path fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/></svg>");
    +
    +

    Sass mixins

    Styles for dark mode, and any custom color modes you create, can be scoped appropriately to the data-bs-theme attribute selector or media query with the customizable color-mode() mixin. See the Sass usage section for more details.

    -
    -
    @mixin color-mode($mode: light, $root: false) {
    -  @if $color-mode-type == "media-query" {
    -    @if $root == true {
    -      @media (prefers-color-scheme: $mode) {
    -        :root {
    -          @content;
    -        }
    -      }
    -    } @else {
    -      @media (prefers-color-scheme: $mode) {
    -        @content;
    -      }
    -    }
    -  } @else {
    -    [data-bs-theme="#{$mode}"] {
    -      @content;
    -    }
    -  }
    -}
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    @mixin color-mode($mode: light, $root: false) {
    +  @if $color-mode-type == "media-query" {
    +    @if $root == true {
    +      @media (prefers-color-scheme: $mode) {
    +        :root {
    +          @content;
    +        }
    +      }
    +    } @else {
    +      @media (prefers-color-scheme: $mode) {
    +        @content;
    +      }
    +    }
    +  } @else {
    +    [data-bs-theme="#{$mode}"] {
    +      @content;
    +    }
    +  }
    +}
    +
    \ No newline at end of file diff --git a/docs/5.3/customize/color/index.html b/docs/5.3/customize/color/index.html index 1b08e80bcb..e48fc090cb 100644 --- a/docs/5.3/customize/color/index.html +++ b/docs/5.3/customize/color/index.html @@ -1,1457 +1,139 @@ - - - - - - - - - - - - - - - - -Color · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Color

    -
    -

    Bootstrap is supported by an extensive color system that themes our styles and components. This enables more comprehensive customization and extension for any project.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Colors

    + Color · Bootstrap v5.3

    Bootstrap is supported by an extensive color system that themes our styles and components. This enables more comprehensive customization and extension for any project.

    +

    Colors

    Added in v5.3.0 - -

    Bootstrap’s color palette has continued to expand and become more nuanced in v5.3.0. We’ve added new variables for secondary and tertiary text and background colors, plus {color}-bg-subtle, {color}-border-subtle, and {color}-text-emphasis for our theme colors. These new colors are available through Sass and CSS variables (but not our color maps or utility classes) with the express goal of making it easier to customize across multiple colors modes like light and dark. These new variables are globally set on :root and are adapted for our new dark color mode while our original theme colors remain unchanged.

    +

    Bootstrap’s color palette has continued to expand and become more nuanced in v5.3.0. We’ve added new variables for secondary and tertiary text and background colors, plus {color}-bg-subtle, {color}-border-subtle, and {color}-text-emphasis for our theme colors. These new colors are available through Sass and CSS variables (but not our color maps or utility classes) with the express goal of making it easier to customize across multiple colors modes like light and dark. These new variables are globally set on :root and are adapted for our new dark color mode while our original theme colors remain unchanged.

    Colors ending in -rgb provide the red, green, blue values for use in rgb() and rgba() color modes. For example, rgba(var(--bs-secondary-bg-rgb), .5).

    -
    -Heads up! There’s some potential confusion with our new secondary and tertiary colors, and our existing secondary theme color, as well as our light and dark theme colors. Expect this to be ironed out in v6. -
    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    DescriptionSwatchVariables
    - Body — Default foreground (color) and background, including components. - -
     
    -
    - --bs-body-color
    --bs-body-color-rgb -
    -
     
    -
    - --bs-body-bg
    --bs-body-bg-rgb -
    - Secondary — Use the color option for lighter text. Use the bg option for dividers and to indicate disabled component states. - -
     
    -
    - --bs-secondary-color
    --bs-secondary-color-rgb -
    -
     
    -
    - --bs-secondary-bg
    --bs-secondary-bg-rgb -
    - Tertiary — Use the color option for even lighter text. Use the bg option to style backgrounds for hover states, accents, and wells. - -
     
    -
    - --bs-tertiary-color
    --bs-tertiary-color-rgb -
    -
     
    -
    - --bs-tertiary-bg
    --bs-tertiary-bg-rgb -
    - Emphasis — For higher contrast text. Not applicable for backgrounds. - -
     
    -
    - --bs-emphasis-color
    --bs-emphasis-color-rgb -
    - Border — For component borders, dividers, and rules. Use --bs-border-color-translucent to blend with backgrounds with an rgba() value. - -
     
    -
    - --bs-border-color
    --bs-border-color-rgb -
    - Primary — Main theme color, used for hyperlinks, focus styles, and component and form active states. - -
     
    -
    - --bs-primary
    --bs-primary-rgb -
    -
     
    -
    - --bs-primary-bg-subtle -
    -
     
    -
    - --bs-primary-border-subtle -
    -
    Text
    -
    - --bs-primary-text-emphasis -
    - Success — Theme color used for positive or successful actions and information. - -
     
    -
    - --bs-success
    --bs-success-rgb -
    -
     
    -
    - --bs-success-bg-subtle -
    -
     
    -
    - --bs-success-border-subtle -
    -
    Text
    -
    - --bs-success-text-emphasis -
    - Danger — Theme color used for errors and dangerous actions. - -
     
    -
    - --bs-danger
    --bs-danger-rgb -
    -
     
    -
    - --bs-danger-bg-subtle -
    -
     
    -
    - --bs-danger-border-subtle -
    -
    Text
    -
    - --bs-danger-text-emphasis -
    - Warning — Theme color used for non-destructive warning messages. - -
     
    -
    - --bs-warning
    --bs-warning-rgb -
    -
     
    -
    - --bs-warning-bg-subtle -
    -
     
    -
    - --bs-warning-border-subtle -
    -
    Text
    -
    - --bs-warning-text-emphasis -
    - Info — Theme color used for neutral and informative content. - -
     
    -
    - --bs-info
    --bs-info-rgb -
    -
     
    -
    - --bs-info-bg-subtle -
    -
     
    -
    - --bs-info-border-subtle -
    -
    Text
    -
    - --bs-info-text-emphasis -
    - Light — Additional theme option for less contrasting colors. - -
     
    -
    - --bs-light
    --bs-light-rgb -
    -
     
    -
    - --bs-light-bg-subtle -
    -
     
    -
    - --bs-light-border-subtle -
    -
    Text
    -
    - --bs-light-text-emphasis -
    - Dark — Additional theme option for higher contrasting colors. - -
     
    -
    - --bs-dark
    --bs-dark-rgb -
    -
     
    -
    - --bs-dark-bg-subtle -
    -
     
    -
    - --bs-dark-border-subtle -
    -
    Text
    -
    - --bs-dark-text-emphasis -
    -
    -

    Using the new colors

    -

    These new colors are accessible via CSS variables and utility classes—like --bs-primary-bg-subtle and .bg-primary-subtle—allowing you to compose your own CSS rules with the variables, or to quickly apply styles via classes. The utilities are built with the color’s associated CSS variables, and since we customize those CSS variables for dark mode, they are also adaptive to color mode by default.

    -
    -
    - -
    +

    Heads up! There’s some potential confusion with our new secondary and tertiary colors, and our existing secondary theme color, as well as our light and dark theme colors. Expect this to be ironed out in v6.

    +
    DescriptionSwatchVariables

    Body — Default foreground (color) and background, including components.

     

    --bs-body-color
    --bs-body-color-rgb

     

    --bs-body-bg
    --bs-body-bg-rgb

    Secondary — Use the color option for lighter text. Use the bg option for dividers and to indicate disabled component states.

     

    --bs-secondary-color
    --bs-secondary-color-rgb

     

    --bs-secondary-bg
    --bs-secondary-bg-rgb

    Tertiary — Use the color option for even lighter text. Use the bg option to style backgrounds for hover states, accents, and wells.

     

    --bs-tertiary-color
    --bs-tertiary-color-rgb

     

    --bs-tertiary-bg
    --bs-tertiary-bg-rgb

    Emphasis — For higher contrast text. Not applicable for backgrounds.

     

    --bs-emphasis-color
    --bs-emphasis-color-rgb

    Border — For component borders, dividers, and rules. Use --bs-border-color-translucent to blend with backgrounds with an rgba() value.

     

    --bs-border-color
    --bs-border-color-rgb

    Primary — Main theme color, used for hyperlinks, focus styles, and component and form active states.

     

    --bs-primary
    --bs-primary-rgb

     

    --bs-primary-bg-subtle

     

    --bs-primary-border-subtle

    Text

    --bs-primary-text-emphasis

    Success — Theme color used for positive or successful actions and information.

     

    --bs-success
    --bs-success-rgb

     

    --bs-success-bg-subtle

     

    --bs-success-border-subtle

    Text

    --bs-success-text-emphasis

    Danger — Theme color used for errors and dangerous actions.

     

    --bs-danger
    --bs-danger-rgb

     

    --bs-danger-bg-subtle

     

    --bs-danger-border-subtle

    Text

    --bs-danger-text-emphasis

    Warning — Theme color used for non-destructive warning messages.

     

    --bs-warning
    --bs-warning-rgb

     

    --bs-warning-bg-subtle

     

    --bs-warning-border-subtle

    Text

    --bs-warning-text-emphasis

    Info — Theme color used for neutral and informative content.

     

    --bs-info
    --bs-info-rgb

     

    --bs-info-bg-subtle

     

    --bs-info-border-subtle

    Text

    --bs-info-text-emphasis

    Light — Additional theme option for less contrasting colors.

     

    --bs-light
    --bs-light-rgb

     

    --bs-light-bg-subtle

     

    --bs-light-border-subtle

    Text

    --bs-light-text-emphasis

    Dark — Additional theme option for higher contrasting colors.

     

    --bs-dark
    --bs-dark-rgb

     

    --bs-dark-bg-subtle

     

    --bs-dark-border-subtle

    Text

    --bs-dark-text-emphasis

    +

    Using the new colors

    +

    These new colors are accessible via CSS variables and utility classes—like --bs-primary-bg-subtle and .bg-primary-subtle—allowing you to compose your own CSS rules with the variables, or to quickly apply styles via classes. The utilities are built with the color’s associated CSS variables, and since we customize those CSS variables for dark mode, they are also adaptive to color mode by default.

    +
    Example element with utilities -
    - -
    - html -
    - - -
    -
    <div class="p-3 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3">
    -  Example element with utilities
    -</div>
    -
    - -

    Theme colors

    -

    We use a subset of all colors to create a smaller color palette for generating color schemes, also available as Sass variables and a Sass map in Bootstrap’s scss/_variables.scss file.

    -
    - -
    -
    Primary
    -
    - -
    -
    Secondary
    -
    - -
    -
    Success
    -
    - -
    -
    Danger
    -
    - -
    -
    Warning
    -
    - -
    -
    Info
    -
    - -
    -
    Light
    -
    - -
    -
    Dark
    -
    - -
    +
    html
    <div class="p-3 text-primary-emphasis bg-primary-subtle border border-primary-subtle rounded-3">
    +  Example element with utilities
    +</div>
    +

    Theme colors

    +

    We use a subset of all colors to create a smaller color palette for generating color schemes, also available as Sass variables and a Sass map in Bootstrap’s scss/_variables.scss file.

    +
    Primary
    Secondary
    Success
    Danger
    Warning
    Info
    Light
    Dark

    All these colors are available as a Sass map, $theme-colors.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $theme-colors: (
    -  "primary":    $primary,
    -  "secondary":  $secondary,
    -  "success":    $success,
    -  "info":       $info,
    -  "warning":    $warning,
    -  "danger":     $danger,
    -  "light":      $light,
    -  "dark":       $dark
    -);
    -
    -

    Check out our Sass maps and loops docs for how to modify these colors.

    -

    All colors

    -

    All Bootstrap colors are available as Sass variables and a Sass map in scss/_variables.scss file. To avoid increased file sizes, we don’t create text or background color classes for each of these variables. Instead, we choose a subset of these colors for a theme palette.

    -

    Be sure to monitor contrast ratios as you customize colors. As shown below, we’ve added three contrast ratios to each of the main colors—one for the swatch’s current colors, one for against white, and one for against black.

    -
    - -
    -
    - $blue - #0d6efd -
    - -
    $blue-100
    - -
    $blue-200
    - -
    $blue-300
    - -
    $blue-400
    - -
    $blue-500
    - -
    $blue-600
    - -
    $blue-700
    - -
    $blue-800
    - -
    $blue-900
    - -
    - -
    -
    - $indigo - #6610f2 -
    - -
    $indigo-100
    - -
    $indigo-200
    - -
    $indigo-300
    - -
    $indigo-400
    - -
    $indigo-500
    - -
    $indigo-600
    - -
    $indigo-700
    - -
    $indigo-800
    - -
    $indigo-900
    - -
    - -
    -
    - $purple - #6f42c1 -
    - -
    $purple-100
    - -
    $purple-200
    - -
    $purple-300
    - -
    $purple-400
    - -
    $purple-500
    - -
    $purple-600
    - -
    $purple-700
    - -
    $purple-800
    - -
    $purple-900
    - -
    - -
    -
    - $pink - #d63384 -
    - -
    $pink-100
    - -
    $pink-200
    - -
    $pink-300
    - -
    $pink-400
    - -
    $pink-500
    - -
    $pink-600
    - -
    $pink-700
    - -
    $pink-800
    - -
    $pink-900
    - -
    - -
    -
    - $red - #dc3545 -
    - -
    $red-100
    - -
    $red-200
    - -
    $red-300
    - -
    $red-400
    - -
    $red-500
    - -
    $red-600
    - -
    $red-700
    - -
    $red-800
    - -
    $red-900
    - -
    - -
    -
    - $orange - #fd7e14 -
    - -
    $orange-100
    - -
    $orange-200
    - -
    $orange-300
    - -
    $orange-400
    - -
    $orange-500
    - -
    $orange-600
    - -
    $orange-700
    - -
    $orange-800
    - -
    $orange-900
    - -
    - -
    -
    - $yellow - #ffc107 -
    - -
    $yellow-100
    - -
    $yellow-200
    - -
    $yellow-300
    - -
    $yellow-400
    - -
    $yellow-500
    - -
    $yellow-600
    - -
    $yellow-700
    - -
    $yellow-800
    - -
    $yellow-900
    - -
    - -
    -
    - $green - #198754 -
    - -
    $green-100
    - -
    $green-200
    - -
    $green-300
    - -
    $green-400
    - -
    $green-500
    - -
    $green-600
    - -
    $green-700
    - -
    $green-800
    - -
    $green-900
    - -
    - -
    -
    - $teal - #20c997 -
    - -
    $teal-100
    - -
    $teal-200
    - -
    $teal-300
    - -
    $teal-400
    - -
    $teal-500
    - -
    $teal-600
    - -
    $teal-700
    - -
    $teal-800
    - -
    $teal-900
    - -
    - -
    -
    - $cyan - #0dcaf0 -
    - -
    $cyan-100
    - -
    $cyan-200
    - -
    $cyan-300
    - -
    $cyan-400
    - -
    $cyan-500
    - -
    $cyan-600
    - -
    $cyan-700
    - -
    $cyan-800
    - -
    $cyan-900
    - -
    -
    -
    - $gray-500 - #adb5bd -
    -
    $gray-100
    - -
    $gray-200
    - -
    $gray-300
    - -
    $gray-400
    - -
    $gray-500
    - -
    $gray-600
    - -
    $gray-700
    - -
    $gray-800
    - -
    $gray-900
    -
    - -
    -
    - $black - #000 -
    -
    - $white - #fff -
    -
    -
    -

    Notes on Sass

    -

    Sass cannot programmatically generate variables, so we manually created variables for every tint and shade ourselves. We specify the midpoint value (e.g., $blue-500) and use custom color functions to tint (lighten) or shade (darken) our colors via Sass’s mix() color function.

    +
    $theme-colors: (
    +  "primary":    $primary,
    +  "secondary":  $secondary,
    +  "success":    $success,
    +  "info":       $info,
    +  "warning":    $warning,
    +  "danger":     $danger,
    +  "light":      $light,
    +  "dark":       $dark
    +);
    +
    +

    Check out our Sass maps and loops docs for how to modify these colors.

    +

    All colors

    +

    All Bootstrap colors are available as Sass variables and a Sass map in scss/_variables.scss file. To avoid increased file sizes, we don’t create text or background color classes for each of these variables. Instead, we choose a subset of these colors for a theme palette.

    +

    Be sure to monitor contrast ratios as you customize colors. As shown below, we’ve added three contrast ratios to each of the main colors—one for the swatch’s current colors, one for against white, and one for against black.

    +
    $blue#0d6efd
    $blue-100
    $blue-200
    $blue-300
    $blue-400
    $blue-500
    $blue-600
    $blue-700
    $blue-800
    $blue-900
    $indigo#6610f2
    $indigo-100
    $indigo-200
    $indigo-300
    $indigo-400
    $indigo-500
    $indigo-600
    $indigo-700
    $indigo-800
    $indigo-900
    $purple#6f42c1
    $purple-100
    $purple-200
    $purple-300
    $purple-400
    $purple-500
    $purple-600
    $purple-700
    $purple-800
    $purple-900
    $pink#d63384
    $pink-100
    $pink-200
    $pink-300
    $pink-400
    $pink-500
    $pink-600
    $pink-700
    $pink-800
    $pink-900
    $red#dc3545
    $red-100
    $red-200
    $red-300
    $red-400
    $red-500
    $red-600
    $red-700
    $red-800
    $red-900
    $orange#fd7e14
    $orange-100
    $orange-200
    $orange-300
    $orange-400
    $orange-500
    $orange-600
    $orange-700
    $orange-800
    $orange-900
    $yellow#ffc107
    $yellow-100
    $yellow-200
    $yellow-300
    $yellow-400
    $yellow-500
    $yellow-600
    $yellow-700
    $yellow-800
    $yellow-900
    $green#198754
    $green-100
    $green-200
    $green-300
    $green-400
    $green-500
    $green-600
    $green-700
    $green-800
    $green-900
    $teal#20c997
    $teal-100
    $teal-200
    $teal-300
    $teal-400
    $teal-500
    $teal-600
    $teal-700
    $teal-800
    $teal-900
    $cyan#0dcaf0
    $cyan-100
    $cyan-200
    $cyan-300
    $cyan-400
    $cyan-500
    $cyan-600
    $cyan-700
    $cyan-800
    $cyan-900
    $gray-500#adb5bd
    $gray-100
    $gray-200
    $gray-300
    $gray-400
    $gray-500
    $gray-600
    $gray-700
    $gray-800
    $gray-900

    $black +#000

    $white +#fff

    +

    Notes on Sass

    +

    Sass cannot programmatically generate variables, so we manually created variables for every tint and shade ourselves. We specify the midpoint value (e.g., $blue-500) and use custom color functions to tint (lighten) or shade (darken) our colors via Sass’s mix() color function.

    Using mix() is not the same as lighten() and darken()—the former blends the specified color with white or black, while the latter only adjusts the lightness value of each color. The result is a much more complete suite of colors, as shown in this CodePen demo.

    Our tint-color() and shade-color() functions use mix() alongside our $theme-color-interval variable, which specifies a stepped percentage value for each mixed color we produce. See the scss/_functions.scss and scss/_variables.scss files for the full source code.

    -

    Color Sass maps

    -

    Bootstrap’s source Sass files include three maps to help you quickly and easily loop over a list of colors and their hex values.

    +

    Color Sass maps

    +

    Bootstrap’s source Sass files include three maps to help you quickly and easily loop over a list of colors and their hex values.

    • $colors lists all our available base (500) colors
    • $theme-colors lists all semantically named theme colors (shown below)
    • $grays lists all tints and shades of gray
    -

    Within scss/_variables.scss, you’ll find Bootstrap’s color variables and Sass map. Here’s an example of the $colors Sass map:

    -
    -
    - scss/_variables.scss -
    - -
    -
    $colors: (
    -  "blue":       $blue,
    -  "indigo":     $indigo,
    -  "purple":     $purple,
    -  "pink":       $pink,
    -  "red":        $red,
    -  "orange":     $orange,
    -  "yellow":     $yellow,
    -  "green":      $green,
    -  "teal":       $teal,
    -  "cyan":       $cyan,
    -  "black":      $black,
    -  "white":      $white,
    -  "gray":       $gray-600,
    -  "gray-dark":  $gray-800
    -);
    -
    -

    Add, remove, or modify values within the map to update how they’re used in many other components. Unfortunately at this time, not every component utilizes this Sass map. Future updates will strive to improve upon this. Until then, plan on making use of the ${color} variables and this Sass map.

    -

    Example

    -

    Here’s how you can use these in your Sass:

    -
    .alpha { color: $purple; }
    -.beta {
    -  color: $yellow-300;
    -  background-color: $indigo-900;
    -}
    -

    Color and background utility classes are also available for setting color and background-color using the 500 color values.

    -

    Generating utilities

    +

    Within scss/_variables.scss, you’ll find Bootstrap’s color variables and Sass map. Here’s an example of the $colors Sass map:

    +
    $colors: (
    +  "blue":       $blue,
    +  "indigo":     $indigo,
    +  "purple":     $purple,
    +  "pink":       $pink,
    +  "red":        $red,
    +  "orange":     $orange,
    +  "yellow":     $yellow,
    +  "green":      $green,
    +  "teal":       $teal,
    +  "cyan":       $cyan,
    +  "black":      $black,
    +  "white":      $white,
    +  "gray":       $gray-600,
    +  "gray-dark":  $gray-800
    +);
    +
    +

    Add, remove, or modify values within the map to update how they’re used in many other components. Unfortunately at this time, not every component utilizes this Sass map. Future updates will strive to improve upon this. Until then, plan on making use of the ${color} variables and this Sass map.

    +

    Example

    +

    Here’s how you can use these in your Sass:

    +
    .alpha { color: $purple; }
    +.beta {
    +  color: $yellow-300;
    +  background-color: $indigo-900;
    +}
    +
    +

    Color and background utility classes are also available for setting color and background-color using the 500 color values.

    +

    Generating utilities

    Added in v5.1.0 - -

    Bootstrap doesn’t include color and background-color utilities for every color variable, but you can generate these yourself with our utility API and our extended Sass maps added in v5.1.0.

    +

    Bootstrap doesn’t include color and background-color utilities for every color variable, but you can generate these yourself with our utility API and our extended Sass maps added in v5.1.0.

      -
    1. To start, make sure you’ve imported our functions, variables, mixins, and utilities.
    2. +
    3. To start, make sure you’ve imported our functions, variables, mixins, and utilities.
    4. Use our map-merge-multiple() function to quickly merge multiple Sass maps together in a new map.
    5. Merge this new combined map to extend any utility with a {color}-{level} class name.
    -

    Here’s an example that generates text color utilities (e.g., .text-purple-500) using the above steps.

    -
    @import "bootstrap/scss/functions";
    -@import "bootstrap/scss/variables";
    -@import "bootstrap/scss/variables-dark";
    -@import "bootstrap/scss/maps";
    -@import "bootstrap/scss/mixins";
    -@import "bootstrap/scss/utilities";
    -
    -$all-colors: map-merge-multiple($blues, $indigos, $purples, $pinks, $reds, $oranges, $yellows, $greens, $teals, $cyans);
    -
    -$utilities: map-merge(
    -  $utilities,
    -  (
    -    "color": map-merge(
    -      map-get($utilities, "color"),
    -      (
    -        values: map-merge(
    -          map-get(map-get($utilities, "color"), "values"),
    -          (
    -            $all-colors
    -          ),
    -        ),
    -      ),
    -    ),
    -  )
    -);
    -
    -@import "bootstrap/scss/utilities/api";
    -

    This will generate new .text-{color}-{level} utilities for every color and level. You can do the same for any other utility and property as well.

    +

    Here’s an example that generates text color utilities (e.g., .text-purple-500) using the above steps.

    +
    @import "bootstrap/scss/functions";
    +@import "bootstrap/scss/variables";
    +@import "bootstrap/scss/variables-dark";
    +@import "bootstrap/scss/maps";
    +@import "bootstrap/scss/mixins";
    +@import "bootstrap/scss/utilities";
     
    -      
    -
    -
    +$all-colors: map-merge-multiple($blues, $indigos, $purples, $pinks, $reds, $oranges, $yellows, $greens, $teals, $cyans); +$utilities: map-merge( + $utilities, + ( + "color": map-merge( + map-get($utilities, "color"), + ( + values: map-merge( + map-get(map-get($utilities, "color"), "values"), + ( + $all-colors + ), + ), + ), + ), + ) +); - - - - - - - - - - - - - +@import "bootstrap/scss/utilities/api"; +
    +

    This will generate new .text-{color}-{level} utilities for every color and level. You can do the same for any other utility and property as well.

    \ No newline at end of file diff --git a/docs/5.3/customize/components/index.html b/docs/5.3/customize/components/index.html index 974b2f5731..293baf1a05 100644 --- a/docs/5.3/customize/components/index.html +++ b/docs/5.3/customize/components/index.html @@ -1,774 +1,122 @@ - - - - - - - - - - - - - - - - -Components · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Components

    -
    -

    Learn how and why we build nearly all our components responsively and with base and modifier classes.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Base classes

    -

    Bootstrap’s components are largely built with a base-modifier nomenclature. We group as many shared properties as possible into a base class, like .btn, and then group individual styles for each variant into modifier classes, like .btn-primary or .btn-success.

    -

    To build our modifier classes, we use Sass’s @each loops to iterate over a Sass map. This is especially helpful for generating variants of a component by our $theme-colors and creating responsive variants for each breakpoint. As you customize these Sass maps and recompile, you’ll automatically see your changes reflected in these loops.

    -

    Check out our Sass maps and loops docs for how to customize these loops and extend Bootstrap’s base-modifier approach to your own code.

    -

    Modifiers

    -

    Many of Bootstrap’s components are built with a base-modifier class approach. This means the bulk of the styling is contained to a base class (e.g., .btn) while style variations are confined to modifier classes (e.g., .btn-danger). These modifier classes are built from the $theme-colors map to make customizing the number and name of our modifier classes.

    + Components · Bootstrap v5.3

    Components

    Learn how and why we build nearly all our components responsively and with base and modifier classes.

    +
    On this page

    Base classes

    +

    Bootstrap’s components are largely built with a base-modifier nomenclature. We group as many shared properties as possible into a base class, like .btn, and then group individual styles for each variant into modifier classes, like .btn-primary or .btn-success.

    +

    To build our modifier classes, we use Sass’s @each loops to iterate over a Sass map. This is especially helpful for generating variants of a component by our $theme-colors and creating responsive variants for each breakpoint. As you customize these Sass maps and recompile, you’ll automatically see your changes reflected in these loops.

    +

    Check out our Sass maps and loops docs for how to customize these loops and extend Bootstrap’s base-modifier approach to your own code.

    +

    Modifiers

    +

    Many of Bootstrap’s components are built with a base-modifier class approach. This means the bulk of the styling is contained to a base class (e.g., .btn) while style variations are confined to modifier classes (e.g., .btn-danger). These modifier classes are built from the $theme-colors map to make customizing the number and name of our modifier classes.

    Here are two examples of how we loop over the $theme-colors map to generate modifiers to the .alert and .list-group components.

    -
    -
    - scss/_alert.scss -
    - -
    -
    // Generate contextual modifier classes for colorizing the alert
    -@each $state in map-keys($theme-colors) {
    -  .alert-#{$state} {
    -    --#{$prefix}alert-color: var(--#{$prefix}#{$state}-text-emphasis);
    -    --#{$prefix}alert-bg: var(--#{$prefix}#{$state}-bg-subtle);
    -    --#{$prefix}alert-border-color: var(--#{$prefix}#{$state}-border-subtle);
    -    --#{$prefix}alert-link-color: var(--#{$prefix}#{$state}-text-emphasis);
    -  }
    -}
    -
    -
    -
    - scss/_list-group.scss -
    - -
    -
    // List group contextual variants
    -//
    -// Add modifier classes to change text and background color on individual items.
    -// Organizationally, this must come after the `:hover` states.
    -
    -@each $state in map-keys($theme-colors) {
    -  .list-group-item-#{$state} {
    -    --#{$prefix}list-group-color: var(--#{$prefix}#{$state}-text-emphasis);
    -    --#{$prefix}list-group-bg: var(--#{$prefix}#{$state}-bg-subtle);
    -    --#{$prefix}list-group-border-color: var(--#{$prefix}#{$state}-border-subtle);
    -    --#{$prefix}list-group-action-hover-color: var(--#{$prefix}emphasis-color);
    -    --#{$prefix}list-group-action-hover-bg: var(--#{$prefix}#{$state}-border-subtle);
    -    --#{$prefix}list-group-action-active-color: var(--#{$prefix}emphasis-color);
    -    --#{$prefix}list-group-action-active-bg: var(--#{$prefix}#{$state}-border-subtle);
    -    --#{$prefix}list-group-active-color: var(--#{$prefix}#{$state}-bg-subtle);
    -    --#{$prefix}list-group-active-bg: var(--#{$prefix}#{$state}-text-emphasis);
    -    --#{$prefix}list-group-active-border-color: var(--#{$prefix}#{$state}-text-emphasis);
    -  }
    -}
    -
    -

    Responsive

    -

    These Sass loops aren’t limited to color maps, either. You can also generate responsive variations of your components. Take for example our responsive alignment of the dropdowns where we mix an @each loop for the $grid-breakpoints Sass map with a media query include.

    -
    -
    - scss/_dropdown.scss -
    - -
    -
    // We deliberately hardcode the `bs-` prefix because we check
    -// this custom property in JS to determine Popper's positioning
    -
    -@each $breakpoint in map-keys($grid-breakpoints) {
    -  @include media-breakpoint-up($breakpoint) {
    -    $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
    -
    -    .dropdown-menu#{$infix}-start {
    -      --bs-position: start;
    -
    -      &[data-bs-popper] {
    -        right: auto;
    -        left: 0;
    -      }
    -    }
    -
    -    .dropdown-menu#{$infix}-end {
    -      --bs-position: end;
    -
    -      &[data-bs-popper] {
    -        right: 0;
    -        left: auto;
    -      }
    -    }
    -  }
    -}
    -
    +
    // Generate contextual modifier classes for colorizing the alert
    +@each $state in map-keys($theme-colors) {
    +  .alert-#{$state} {
    +    --#{$prefix}alert-color: var(--#{$prefix}#{$state}-text-emphasis);
    +    --#{$prefix}alert-bg: var(--#{$prefix}#{$state}-bg-subtle);
    +    --#{$prefix}alert-border-color: var(--#{$prefix}#{$state}-border-subtle);
    +    --#{$prefix}alert-link-color: var(--#{$prefix}#{$state}-text-emphasis);
    +  }
    +}
    +
    +
    // List group contextual variants
    +//
    +// Add modifier classes to change text and background color on individual items.
    +// Organizationally, this must come after the `:hover` states.
    +
    +@each $state in map-keys($theme-colors) {
    +  .list-group-item-#{$state} {
    +    --#{$prefix}list-group-color: var(--#{$prefix}#{$state}-text-emphasis);
    +    --#{$prefix}list-group-bg: var(--#{$prefix}#{$state}-bg-subtle);
    +    --#{$prefix}list-group-border-color: var(--#{$prefix}#{$state}-border-subtle);
    +    --#{$prefix}list-group-action-hover-color: var(--#{$prefix}emphasis-color);
    +    --#{$prefix}list-group-action-hover-bg: var(--#{$prefix}#{$state}-border-subtle);
    +    --#{$prefix}list-group-action-active-color: var(--#{$prefix}emphasis-color);
    +    --#{$prefix}list-group-action-active-bg: var(--#{$prefix}#{$state}-border-subtle);
    +    --#{$prefix}list-group-active-color: var(--#{$prefix}#{$state}-bg-subtle);
    +    --#{$prefix}list-group-active-bg: var(--#{$prefix}#{$state}-text-emphasis);
    +    --#{$prefix}list-group-active-border-color: var(--#{$prefix}#{$state}-text-emphasis);
    +  }
    +}
    +
    +

    Responsive

    +

    These Sass loops aren’t limited to color maps, either. You can also generate responsive variations of your components. Take for example our responsive alignment of the dropdowns where we mix an @each loop for the $grid-breakpoints Sass map with a media query include.

    +
    // We deliberately hardcode the `bs-` prefix because we check
    +// this custom property in JS to determine Popper's positioning
    +
    +@each $breakpoint in map-keys($grid-breakpoints) {
    +  @include media-breakpoint-up($breakpoint) {
    +    $infix: breakpoint-infix($breakpoint, $grid-breakpoints);
    +
    +    .dropdown-menu#{$infix}-start {
    +      --bs-position: start;
    +
    +      &[data-bs-popper] {
    +        right: auto;
    +        left: 0;
    +      }
    +    }
    +
    +    .dropdown-menu#{$infix}-end {
    +      --bs-position: end;
    +
    +      &[data-bs-popper] {
    +        right: 0;
    +        left: auto;
    +      }
    +    }
    +  }
    +}
    +

    Should you modify your $grid-breakpoints, your changes will apply to all the loops iterating over that map.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $grid-breakpoints: (
    -  xs: 0,
    -  sm: 576px,
    -  md: 768px,
    -  lg: 992px,
    -  xl: 1200px,
    -  xxl: 1400px
    -);
    -
    -

    For more information and examples on how to modify our Sass maps and variables, please refer to the CSS section of the Grid documentation.

    -

    Creating your own

    -

    We encourage you to adopt these guidelines when building with Bootstrap to create your own components. We’ve extended this approach ourselves to the custom components in our documentation and examples. Components like our callouts are built just like our provided components with base and modifier classes.

    -
    -
    - This is a callout. We built it custom for our docs so our messages to you stand out. It has three variants via modifier classes. -
    -
    -
    <div class="callout">...</div>
    -

    In your CSS, you’d have something like the following where the bulk of the styling is done via .callout. Then, the unique styles between each variant is controlled via modifier class.

    -
    // Base class
    -.callout {}
    -
    -// Modifier classes
    -.callout-info {}
    -.callout-warning {}
    -.callout-danger {}
    -

    For the callouts, that unique styling is just a border-left-color. When you combine that base class with one of those modifier classes, you get your complete component family:

    -
    -This is an info callout. Example text to show it in action. -
    +
    $grid-breakpoints: (
    +  xs: 0,
    +  sm: 576px,
    +  md: 768px,
    +  lg: 992px,
    +  xl: 1200px,
    +  xxl: 1400px
    +);
    +
    +

    For more information and examples on how to modify our Sass maps and variables, please refer to the CSS section of the Grid documentation.

    +

    Creating your own

    +

    We encourage you to adopt these guidelines when building with Bootstrap to create your own components. We’ve extended this approach ourselves to the custom components in our documentation and examples. Components like our callouts are built just like our provided components with base and modifier classes.

    +

    This is a callout. We built it custom for our docs so our messages to you stand out. It has three variants via modifier classes.

    +
    <div class="callout">...</div>
    +
    +

    In your CSS, you’d have something like the following where the bulk of the styling is done via .callout. Then, the unique styles between each variant is controlled via modifier class.

    +
    // Base class
    +.callout {}
     
    -
    -This is a warning callout. Example text to show it in action. -
    - -
    -This is a danger callout. Example text to show it in action. -
    - - -
    -
    -
    - - - - - - - - - - - - - - - +// Modifier classes +.callout-info {} +.callout-warning {} +.callout-danger {} +
    +

    For the callouts, that unique styling is just a border-left-color. When you combine that base class with one of those modifier classes, you get your complete component family:

    +

    This is an info callout. Example text to show it in action.

    +

    This is a warning callout. Example text to show it in action.

    +

    This is a danger callout. Example text to show it in action.

    \ No newline at end of file diff --git a/docs/5.3/customize/css-variables/index.html b/docs/5.3/customize/css-variables/index.html index 43fe87cf61..8e2aa6b235 100644 --- a/docs/5.3/customize/css-variables/index.html +++ b/docs/5.3/customize/css-variables/index.html @@ -1,874 +1,243 @@ - - - - - - - - - - - - - - - - -CSS variables · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    CSS variables

    -
    -

    Use Bootstrap’s CSS custom properties for fast and forward-looking design and development.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Bootstrap includes many CSS custom properties (variables) in its compiled CSS for real-time customization without the need to recompile Sass. These provide easy access to commonly used values like our theme colors, breakpoints, and primary font stacks when working in your browser’s inspector, a code sandbox, or general prototyping.

    + CSS variables · Bootstrap v5.3

    CSS variables

    Use Bootstrap’s CSS custom properties for fast and forward-looking design and development.

    +

    Bootstrap includes many CSS custom properties (variables) in its compiled CSS for real-time customization without the need to recompile Sass. These provide easy access to commonly used values like our theme colors, breakpoints, and primary font stacks when working in your browser’s inspector, a code sandbox, or general prototyping.

    All our custom properties are prefixed with bs- to avoid conflicts with third party CSS.

    -

    Root variables

    -

    Here are the variables we include (note that the :root is required) that can be accessed anywhere Bootstrap’s CSS is loaded. They’re located in our _root.scss file and included in our compiled dist files.

    -

    Default

    +

    Root variables

    +

    Here are the variables we include (note that the :root is required) that can be accessed anywhere Bootstrap’s CSS is loaded. They’re located in our _root.scss file and included in our compiled dist files.

    +

    Default

    These CSS variables are available everywhere, regardless of color mode.

    -
    :root,
    -[data-bs-theme=light] {
    -  --bs-blue: #0d6efd;
    -  --bs-indigo: #6610f2;
    -  --bs-purple: #6f42c1;
    -  --bs-pink: #d63384;
    -  --bs-red: #dc3545;
    -  --bs-orange: #fd7e14;
    -  --bs-yellow: #ffc107;
    -  --bs-green: #198754;
    -  --bs-teal: #20c997;
    -  --bs-cyan: #0dcaf0;
    -  --bs-black: #000;
    -  --bs-white: #fff;
    -  --bs-gray: #6c757d;
    -  --bs-gray-dark: #343a40;
    -  --bs-gray-100: #f8f9fa;
    -  --bs-gray-200: #e9ecef;
    -  --bs-gray-300: #dee2e6;
    -  --bs-gray-400: #ced4da;
    -  --bs-gray-500: #adb5bd;
    -  --bs-gray-600: #6c757d;
    -  --bs-gray-700: #495057;
    -  --bs-gray-800: #343a40;
    -  --bs-gray-900: #212529;
    -  --bs-primary: #0d6efd;
    -  --bs-secondary: #6c757d;
    -  --bs-success: #198754;
    -  --bs-info: #0dcaf0;
    -  --bs-warning: #ffc107;
    -  --bs-danger: #dc3545;
    -  --bs-light: #f8f9fa;
    -  --bs-dark: #212529;
    -  --bs-primary-rgb: 13, 110, 253;
    -  --bs-secondary-rgb: 108, 117, 125;
    -  --bs-success-rgb: 25, 135, 84;
    -  --bs-info-rgb: 13, 202, 240;
    -  --bs-warning-rgb: 255, 193, 7;
    -  --bs-danger-rgb: 220, 53, 69;
    -  --bs-light-rgb: 248, 249, 250;
    -  --bs-dark-rgb: 33, 37, 41;
    -  --bs-primary-text-emphasis: #052c65;
    -  --bs-secondary-text-emphasis: #2b2f32;
    -  --bs-success-text-emphasis: #0a3622;
    -  --bs-info-text-emphasis: #055160;
    -  --bs-warning-text-emphasis: #664d03;
    -  --bs-danger-text-emphasis: #58151c;
    -  --bs-light-text-emphasis: #495057;
    -  --bs-dark-text-emphasis: #495057;
    -  --bs-primary-bg-subtle: #cfe2ff;
    -  --bs-secondary-bg-subtle: #e2e3e5;
    -  --bs-success-bg-subtle: #d1e7dd;
    -  --bs-info-bg-subtle: #cff4fc;
    -  --bs-warning-bg-subtle: #fff3cd;
    -  --bs-danger-bg-subtle: #f8d7da;
    -  --bs-light-bg-subtle: #fcfcfd;
    -  --bs-dark-bg-subtle: #ced4da;
    -  --bs-primary-border-subtle: #9ec5fe;
    -  --bs-secondary-border-subtle: #c4c8cb;
    -  --bs-success-border-subtle: #a3cfbb;
    -  --bs-info-border-subtle: #9eeaf9;
    -  --bs-warning-border-subtle: #ffe69c;
    -  --bs-danger-border-subtle: #f1aeb5;
    -  --bs-light-border-subtle: #e9ecef;
    -  --bs-dark-border-subtle: #adb5bd;
    -  --bs-white-rgb: 255, 255, 255;
    -  --bs-black-rgb: 0, 0, 0;
    -  --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    -  --bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    -  --bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
    -  --bs-body-font-family: var(--bs-font-sans-serif);
    -  --bs-body-font-size: 1rem;
    -  --bs-body-font-weight: 400;
    -  --bs-body-line-height: 1.5;
    -  --bs-body-color: #212529;
    -  --bs-body-color-rgb: 33, 37, 41;
    -  --bs-body-bg: #fff;
    -  --bs-body-bg-rgb: 255, 255, 255;
    -  --bs-emphasis-color: #000;
    -  --bs-emphasis-color-rgb: 0, 0, 0;
    -  --bs-secondary-color: rgba(33, 37, 41, 0.75);
    -  --bs-secondary-color-rgb: 33, 37, 41;
    -  --bs-secondary-bg: #e9ecef;
    -  --bs-secondary-bg-rgb: 233, 236, 239;
    -  --bs-tertiary-color: rgba(33, 37, 41, 0.5);
    -  --bs-tertiary-color-rgb: 33, 37, 41;
    -  --bs-tertiary-bg: #f8f9fa;
    -  --bs-tertiary-bg-rgb: 248, 249, 250;
    -  --bs-heading-color: inherit;
    -  --bs-link-color: #0d6efd;
    -  --bs-link-color-rgb: 13, 110, 253;
    -  --bs-link-decoration: underline;
    -  --bs-link-hover-color: #0a58ca;
    -  --bs-link-hover-color-rgb: 10, 88, 202;
    -  --bs-code-color: #d63384;
    -  --bs-highlight-color: #212529;
    -  --bs-highlight-bg: #fff3cd;
    -  --bs-border-width: 1px;
    -  --bs-border-style: solid;
    -  --bs-border-color: #dee2e6;
    -  --bs-border-color-translucent: rgba(0, 0, 0, 0.175);
    -  --bs-border-radius: 0.375rem;
    -  --bs-border-radius-sm: 0.25rem;
    -  --bs-border-radius-lg: 0.5rem;
    -  --bs-border-radius-xl: 1rem;
    -  --bs-border-radius-xxl: 2rem;
    -  --bs-border-radius-2xl: var(--bs-border-radius-xxl);
    -  --bs-border-radius-pill: 50rem;
    -  --bs-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    -  --bs-box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    -  --bs-box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    -  --bs-box-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.075);
    -  --bs-focus-ring-width: 0.25rem;
    -  --bs-focus-ring-opacity: 0.25;
    -  --bs-focus-ring-color: rgba(13, 110, 253, 0.25);
    -  --bs-form-valid-color: #198754;
    -  --bs-form-valid-border-color: #198754;
    -  --bs-form-invalid-color: #dc3545;
    -  --bs-form-invalid-border-color: #dc3545;
    -}
    -

    Dark mode

    +
    :root,
    +[data-bs-theme=light] {
    +  --bs-blue: #0d6efd;
    +  --bs-indigo: #6610f2;
    +  --bs-purple: #6f42c1;
    +  --bs-pink: #d63384;
    +  --bs-red: #dc3545;
    +  --bs-orange: #fd7e14;
    +  --bs-yellow: #ffc107;
    +  --bs-green: #198754;
    +  --bs-teal: #20c997;
    +  --bs-cyan: #0dcaf0;
    +  --bs-black: #000;
    +  --bs-white: #fff;
    +  --bs-gray: #6c757d;
    +  --bs-gray-dark: #343a40;
    +  --bs-gray-100: #f8f9fa;
    +  --bs-gray-200: #e9ecef;
    +  --bs-gray-300: #dee2e6;
    +  --bs-gray-400: #ced4da;
    +  --bs-gray-500: #adb5bd;
    +  --bs-gray-600: #6c757d;
    +  --bs-gray-700: #495057;
    +  --bs-gray-800: #343a40;
    +  --bs-gray-900: #212529;
    +  --bs-primary: #0d6efd;
    +  --bs-secondary: #6c757d;
    +  --bs-success: #198754;
    +  --bs-info: #0dcaf0;
    +  --bs-warning: #ffc107;
    +  --bs-danger: #dc3545;
    +  --bs-light: #f8f9fa;
    +  --bs-dark: #212529;
    +  --bs-primary-rgb: 13, 110, 253;
    +  --bs-secondary-rgb: 108, 117, 125;
    +  --bs-success-rgb: 25, 135, 84;
    +  --bs-info-rgb: 13, 202, 240;
    +  --bs-warning-rgb: 255, 193, 7;
    +  --bs-danger-rgb: 220, 53, 69;
    +  --bs-light-rgb: 248, 249, 250;
    +  --bs-dark-rgb: 33, 37, 41;
    +  --bs-primary-text-emphasis: #052c65;
    +  --bs-secondary-text-emphasis: #2b2f32;
    +  --bs-success-text-emphasis: #0a3622;
    +  --bs-info-text-emphasis: #055160;
    +  --bs-warning-text-emphasis: #664d03;
    +  --bs-danger-text-emphasis: #58151c;
    +  --bs-light-text-emphasis: #495057;
    +  --bs-dark-text-emphasis: #495057;
    +  --bs-primary-bg-subtle: #cfe2ff;
    +  --bs-secondary-bg-subtle: #e2e3e5;
    +  --bs-success-bg-subtle: #d1e7dd;
    +  --bs-info-bg-subtle: #cff4fc;
    +  --bs-warning-bg-subtle: #fff3cd;
    +  --bs-danger-bg-subtle: #f8d7da;
    +  --bs-light-bg-subtle: #fcfcfd;
    +  --bs-dark-bg-subtle: #ced4da;
    +  --bs-primary-border-subtle: #9ec5fe;
    +  --bs-secondary-border-subtle: #c4c8cb;
    +  --bs-success-border-subtle: #a3cfbb;
    +  --bs-info-border-subtle: #9eeaf9;
    +  --bs-warning-border-subtle: #ffe69c;
    +  --bs-danger-border-subtle: #f1aeb5;
    +  --bs-light-border-subtle: #e9ecef;
    +  --bs-dark-border-subtle: #adb5bd;
    +  --bs-white-rgb: 255, 255, 255;
    +  --bs-black-rgb: 0, 0, 0;
    +  --bs-font-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    +  --bs-font-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    +  --bs-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0));
    +  --bs-body-font-family: var(--bs-font-sans-serif);
    +  --bs-body-font-size: 1rem;
    +  --bs-body-font-weight: 400;
    +  --bs-body-line-height: 1.5;
    +  --bs-body-color: #212529;
    +  --bs-body-color-rgb: 33, 37, 41;
    +  --bs-body-bg: #fff;
    +  --bs-body-bg-rgb: 255, 255, 255;
    +  --bs-emphasis-color: #000;
    +  --bs-emphasis-color-rgb: 0, 0, 0;
    +  --bs-secondary-color: rgba(33, 37, 41, 0.75);
    +  --bs-secondary-color-rgb: 33, 37, 41;
    +  --bs-secondary-bg: #e9ecef;
    +  --bs-secondary-bg-rgb: 233, 236, 239;
    +  --bs-tertiary-color: rgba(33, 37, 41, 0.5);
    +  --bs-tertiary-color-rgb: 33, 37, 41;
    +  --bs-tertiary-bg: #f8f9fa;
    +  --bs-tertiary-bg-rgb: 248, 249, 250;
    +  --bs-heading-color: inherit;
    +  --bs-link-color: #0d6efd;
    +  --bs-link-color-rgb: 13, 110, 253;
    +  --bs-link-decoration: underline;
    +  --bs-link-hover-color: #0a58ca;
    +  --bs-link-hover-color-rgb: 10, 88, 202;
    +  --bs-code-color: #d63384;
    +  --bs-highlight-color: #212529;
    +  --bs-highlight-bg: #fff3cd;
    +  --bs-border-width: 1px;
    +  --bs-border-style: solid;
    +  --bs-border-color: #dee2e6;
    +  --bs-border-color-translucent: rgba(0, 0, 0, 0.175);
    +  --bs-border-radius: 0.375rem;
    +  --bs-border-radius-sm: 0.25rem;
    +  --bs-border-radius-lg: 0.5rem;
    +  --bs-border-radius-xl: 1rem;
    +  --bs-border-radius-xxl: 2rem;
    +  --bs-border-radius-2xl: var(--bs-border-radius-xxl);
    +  --bs-border-radius-pill: 50rem;
    +  --bs-box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    +  --bs-box-shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    +  --bs-box-shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
    +  --bs-box-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.075);
    +  --bs-focus-ring-width: 0.25rem;
    +  --bs-focus-ring-opacity: 0.25;
    +  --bs-focus-ring-color: rgba(13, 110, 253, 0.25);
    +  --bs-form-valid-color: #198754;
    +  --bs-form-valid-border-color: #198754;
    +  --bs-form-invalid-color: #dc3545;
    +  --bs-form-invalid-border-color: #dc3545;
    +}
    +

    Dark mode

    These variables are scoped to our built-in dark mode.

    -
    [data-bs-theme=dark] {
    -  color-scheme: dark;
    -  --bs-body-color: #dee2e6;
    -  --bs-body-color-rgb: 222, 226, 230;
    -  --bs-body-bg: #212529;
    -  --bs-body-bg-rgb: 33, 37, 41;
    -  --bs-emphasis-color: #fff;
    -  --bs-emphasis-color-rgb: 255, 255, 255;
    -  --bs-secondary-color: rgba(222, 226, 230, 0.75);
    -  --bs-secondary-color-rgb: 222, 226, 230;
    -  --bs-secondary-bg: #343a40;
    -  --bs-secondary-bg-rgb: 52, 58, 64;
    -  --bs-tertiary-color: rgba(222, 226, 230, 0.5);
    -  --bs-tertiary-color-rgb: 222, 226, 230;
    -  --bs-tertiary-bg: #2b3035;
    -  --bs-tertiary-bg-rgb: 43, 48, 53;
    -  --bs-primary-text-emphasis: #6ea8fe;
    -  --bs-secondary-text-emphasis: #a7acb1;
    -  --bs-success-text-emphasis: #75b798;
    -  --bs-info-text-emphasis: #6edff6;
    -  --bs-warning-text-emphasis: #ffda6a;
    -  --bs-danger-text-emphasis: #ea868f;
    -  --bs-light-text-emphasis: #f8f9fa;
    -  --bs-dark-text-emphasis: #dee2e6;
    -  --bs-primary-bg-subtle: #031633;
    -  --bs-secondary-bg-subtle: #161719;
    -  --bs-success-bg-subtle: #051b11;
    -  --bs-info-bg-subtle: #032830;
    -  --bs-warning-bg-subtle: #332701;
    -  --bs-danger-bg-subtle: #2c0b0e;
    -  --bs-light-bg-subtle: #343a40;
    -  --bs-dark-bg-subtle: #1a1d20;
    -  --bs-primary-border-subtle: #084298;
    -  --bs-secondary-border-subtle: #41464b;
    -  --bs-success-border-subtle: #0f5132;
    -  --bs-info-border-subtle: #087990;
    -  --bs-warning-border-subtle: #997404;
    -  --bs-danger-border-subtle: #842029;
    -  --bs-light-border-subtle: #495057;
    -  --bs-dark-border-subtle: #343a40;
    -  --bs-heading-color: inherit;
    -  --bs-link-color: #6ea8fe;
    -  --bs-link-hover-color: #8bb9fe;
    -  --bs-link-color-rgb: 110, 168, 254;
    -  --bs-link-hover-color-rgb: 139, 185, 254;
    -  --bs-code-color: #e685b5;
    -  --bs-highlight-color: #dee2e6;
    -  --bs-highlight-bg: #664d03;
    -  --bs-border-color: #495057;
    -  --bs-border-color-translucent: rgba(255, 255, 255, 0.15);
    -  --bs-form-valid-color: #75b798;
    -  --bs-form-valid-border-color: #75b798;
    -  --bs-form-invalid-color: #ea868f;
    -  --bs-form-invalid-border-color: #ea868f;
    -}
    -

    Component variables

    -

    Bootstrap 5 is increasingly making use of custom properties as local variables for various components. This way we reduce our compiled CSS, ensure styles aren’t inherited in places like nested tables, and allow some basic restyling and extending of Bootstrap components after Sass compilation.

    -

    Have a look at our table documentation for some insight into how we’re using CSS variables. Our navbars also use CSS variables as of v5.2.0. We’re also using CSS variables across our grids—primarily for gutters the new opt-in CSS grid—with more component usage coming in the future.

    -

    Whenever possible, we’ll assign CSS variables at the base component level (e.g., .navbar for navbar and its sub-components). This reduces guessing on where and how to customize, and allows for easy modifications by our team in future updates.

    -

    Prefix

    -

    Most CSS variables use a prefix to avoid collisions with your own codebase. This prefix is in addition to the -- that’s required on every CSS variable.

    -

    Customize the prefix via the $prefix Sass variable. By default, it’s set to bs- (note the trailing dash).

    -

    Examples

    -

    CSS variables offer similar flexibility to Sass’s variables, but without the need for compilation before being served to the browser. For example, here we’re resetting our page’s font and link styles with CSS variables.

    -
    body {
    -  font: 1rem/1.5 var(--bs-font-sans-serif);
    -}
    -a {
    -  color: var(--bs-blue);
    -}
    -

    Focus variables

    +
    [data-bs-theme=dark] {
    +  color-scheme: dark;
    +  --bs-body-color: #dee2e6;
    +  --bs-body-color-rgb: 222, 226, 230;
    +  --bs-body-bg: #212529;
    +  --bs-body-bg-rgb: 33, 37, 41;
    +  --bs-emphasis-color: #fff;
    +  --bs-emphasis-color-rgb: 255, 255, 255;
    +  --bs-secondary-color: rgba(222, 226, 230, 0.75);
    +  --bs-secondary-color-rgb: 222, 226, 230;
    +  --bs-secondary-bg: #343a40;
    +  --bs-secondary-bg-rgb: 52, 58, 64;
    +  --bs-tertiary-color: rgba(222, 226, 230, 0.5);
    +  --bs-tertiary-color-rgb: 222, 226, 230;
    +  --bs-tertiary-bg: #2b3035;
    +  --bs-tertiary-bg-rgb: 43, 48, 53;
    +  --bs-primary-text-emphasis: #6ea8fe;
    +  --bs-secondary-text-emphasis: #a7acb1;
    +  --bs-success-text-emphasis: #75b798;
    +  --bs-info-text-emphasis: #6edff6;
    +  --bs-warning-text-emphasis: #ffda6a;
    +  --bs-danger-text-emphasis: #ea868f;
    +  --bs-light-text-emphasis: #f8f9fa;
    +  --bs-dark-text-emphasis: #dee2e6;
    +  --bs-primary-bg-subtle: #031633;
    +  --bs-secondary-bg-subtle: #161719;
    +  --bs-success-bg-subtle: #051b11;
    +  --bs-info-bg-subtle: #032830;
    +  --bs-warning-bg-subtle: #332701;
    +  --bs-danger-bg-subtle: #2c0b0e;
    +  --bs-light-bg-subtle: #343a40;
    +  --bs-dark-bg-subtle: #1a1d20;
    +  --bs-primary-border-subtle: #084298;
    +  --bs-secondary-border-subtle: #41464b;
    +  --bs-success-border-subtle: #0f5132;
    +  --bs-info-border-subtle: #087990;
    +  --bs-warning-border-subtle: #997404;
    +  --bs-danger-border-subtle: #842029;
    +  --bs-light-border-subtle: #495057;
    +  --bs-dark-border-subtle: #343a40;
    +  --bs-heading-color: inherit;
    +  --bs-link-color: #6ea8fe;
    +  --bs-link-hover-color: #8bb9fe;
    +  --bs-link-color-rgb: 110, 168, 254;
    +  --bs-link-hover-color-rgb: 139, 185, 254;
    +  --bs-code-color: #e685b5;
    +  --bs-highlight-color: #dee2e6;
    +  --bs-highlight-bg: #664d03;
    +  --bs-border-color: #495057;
    +  --bs-border-color-translucent: rgba(255, 255, 255, 0.15);
    +  --bs-form-valid-color: #75b798;
    +  --bs-form-valid-border-color: #75b798;
    +  --bs-form-invalid-color: #ea868f;
    +  --bs-form-invalid-border-color: #ea868f;
    +}
    +

    Component variables

    +

    Bootstrap 5 is increasingly making use of custom properties as local variables for various components. This way we reduce our compiled CSS, ensure styles aren’t inherited in places like nested tables, and allow some basic restyling and extending of Bootstrap components after Sass compilation.

    +

    Have a look at our table documentation for some insight into how we’re using CSS variables. Our navbars also use CSS variables as of v5.2.0. We’re also using CSS variables across our grids—primarily for gutters the new opt-in CSS grid—with more component usage coming in the future.

    +

    Whenever possible, we'll assign CSS variables at the base component level (e.g., .navbar for navbar and its sub-components). This reduces guessing on where and how to customize, and allows for easy modifications by our team in future updates.

    +

    Prefix

    +

    Most CSS variables use a prefix to avoid collisions with your own codebase. This prefix is in addition to the -- that’s required on every CSS variable.

    +

    Customize the prefix via the $prefix Sass variable. By default, it’s set to bs- (note the trailing dash).

    +

    Examples

    +

    CSS variables offer similar flexibility to Sass’s variables, but without the need for compilation before being served to the browser. For example, here we’re resetting our page’s font and link styles with CSS variables.

    +
    body {
    +  font: 1rem/1.5 var(--bs-font-sans-serif);
    +}
    +a {
    +  color: var(--bs-blue);
    +}
    +
    +

    Focus variables

    Added in v5.3.0 -

    Bootstrap provides custom :focus styles using a combination of Sass and CSS variables that can be optionally added to specific components and elements. We do not yet globally override all :focus styles.

    In our Sass, we set default values that can be customized before compiling.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $focus-ring-width:      .25rem;
    -$focus-ring-opacity:    .25;
    -$focus-ring-color:      rgba($primary, $focus-ring-opacity);
    -$focus-ring-blur:       0;
    -$focus-ring-box-shadow: 0 0 $focus-ring-blur $focus-ring-width $focus-ring-color;
    -
    +
    $focus-ring-width:      .25rem;
    +$focus-ring-opacity:    .25;
    +$focus-ring-color:      rgba($primary, $focus-ring-opacity);
    +$focus-ring-blur:       0;
    +$focus-ring-box-shadow: 0 0 $focus-ring-blur $focus-ring-width $focus-ring-color;
    +

    Those variables are then reassigned to :root level CSS variables that can be customized in real-time, including with options for x and y offsets (which default to their fallback value of 0).

    -
    -
    - scss/_root.scss -
    - -
    -
    --#{$prefix}focus-ring-width: #{$focus-ring-width};
    ---#{$prefix}focus-ring-opacity: #{$focus-ring-opacity};
    ---#{$prefix}focus-ring-color: #{$focus-ring-color};
    -

    Grid breakpoints

    -

    While we include our grid breakpoints as CSS variables (except for xs), be aware that CSS variables do not work in media queries. This is by design in the CSS spec for variables, but may change in coming years with support for env() variables. Check out this Stack Overflow answer for some helpful links. In the meantime, you can use these variables in other CSS situations, as well as in your JavaScript.

    - -
    -
    -
    - - - - - - - - - - - - - - - +
    --#{$prefix}focus-ring-width: #{$focus-ring-width};
    +--#{$prefix}focus-ring-opacity: #{$focus-ring-opacity};
    +--#{$prefix}focus-ring-color: #{$focus-ring-color};
    +
    +

    Grid breakpoints

    +

    While we include our grid breakpoints as CSS variables (except for xs), be aware that CSS variables do not work in media queries. This is by design in the CSS spec for variables, but may change in coming years with support for env() variables. Check out this Stack Overflow answer for some helpful links. In the meantime, you can use these variables in other CSS situations, as well as in your JavaScript.

    \ No newline at end of file diff --git a/docs/5.3/customize/index.html b/docs/5.3/customize/index.html index 1c8a749b55..d89c43a367 100644 --- a/docs/5.3/customize/index.html +++ b/docs/5.3/customize/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/customize/overview/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/customize/optimize/index.html b/docs/5.3/customize/optimize/index.html index e58fd6ef06..f014924df9 100644 --- a/docs/5.3/customize/optimize/index.html +++ b/docs/5.3/customize/optimize/index.html @@ -1,749 +1,124 @@ - - - - - - - - - - - - - - - - -Optimize · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Optimize

    -
    -

    Keep your projects lean, responsive, and maintainable so you can deliver the best experience and focus on more important jobs.

    - - -
    - - - - - -
    - - -

    Lean Sass imports

    + Optimize · Bootstrap v5.3

    Keep your projects lean, responsive, and maintainable so you can deliver the best experience and focus on more important jobs.

    +

    Lean Sass imports

    When using Sass in your asset pipeline, make sure you optimize Bootstrap by only @importing the components you need. Your largest optimizations will likely come from the Layout & Components section of our bootstrap.scss.

    -
    -
    - scss/bootstrap.scss -
    - -
    -
    // Configuration
    -@import "functions";
    -@import "variables";
    -@import "variables-dark";
    -@import "maps";
    -@import "mixins";
    -@import "utilities";
    -
    -// Layout & components
    -@import "root";
    -@import "reboot";
    -@import "type";
    -@import "images";
    -@import "containers";
    -@import "grid";
    -@import "tables";
    -@import "forms";
    -@import "buttons";
    -@import "transitions";
    -@import "dropdown";
    -@import "button-group";
    -@import "nav";
    -@import "navbar";
    -@import "card";
    -@import "accordion";
    -@import "breadcrumb";
    -@import "pagination";
    -@import "badge";
    -@import "alert";
    -@import "progress";
    -@import "list-group";
    -@import "close";
    -@import "toasts";
    -@import "modal";
    -@import "tooltip";
    -@import "popover";
    -@import "carousel";
    -@import "spinners";
    -@import "offcanvas";
    -@import "placeholders";
    -
    -// Helpers
    -@import "helpers";
    -
    -// Utilities
    -@import "utilities/api";
    -
    -

    If you’re not using a component, comment it out or delete it entirely. For example, if you’re not using the carousel, remove that import to save some file size in your compiled CSS. Keep in mind there are some dependencies across Sass imports that may make it more difficult to omit a file.

    -

    Lean JavaScript

    -

    Bootstrap’s JavaScript includes every component in our primary dist files (bootstrap.js and bootstrap.min.js), and even our primary dependency (Popper) with our bundle files (bootstrap.bundle.js and bootstrap.bundle.min.js). While you’re customizing via Sass, be sure to remove related JavaScript.

    -

    For instance, assuming you’re using your own JavaScript bundler like Webpack, Parcel, or Vite, you’d only import the JavaScript you plan on using. In the example below, we show how to just include our modal JavaScript:

    - -
    // Import just what we need
    -
    -// import 'bootstrap/js/dist/alert';
    -// import 'bootstrap/js/dist/button';
    -// import 'bootstrap/js/dist/carousel';
    -// import 'bootstrap/js/dist/collapse';
    -// import 'bootstrap/js/dist/dropdown';
    -import 'bootstrap/js/dist/modal';
    -// import 'bootstrap/js/dist/offcanvas';
    -// import 'bootstrap/js/dist/popover';
    -// import 'bootstrap/js/dist/scrollspy';
    -// import 'bootstrap/js/dist/tab';
    -// import 'bootstrap/js/dist/toast';
    -// import 'bootstrap/js/dist/tooltip';
    -

    This way, you’re not including any JavaScript you don’t intend to use for components like buttons, carousels, and tooltips. If you’re importing dropdowns, tooltips or popovers, be sure to list the Popper dependency in your package.json file.

    -
    -

    Heads up! Files in bootstrap/js/dist use the default export. To use them, do the following:

    - -
    import Modal from 'bootstrap/js/dist/modal'
    -const modal = new Modal(document.getElementById('myModal'))
    -
    -
    +
    // Configuration
    +@import "functions";
    +@import "variables";
    +@import "variables-dark";
    +@import "maps";
    +@import "mixins";
    +@import "utilities";
     
    -

    Autoprefixer .browserslistrc

    +// Layout & components +@import "root"; +@import "reboot"; +@import "type"; +@import "images"; +@import "containers"; +@import "grid"; +@import "tables"; +@import "forms"; +@import "buttons"; +@import "transitions"; +@import "dropdown"; +@import "button-group"; +@import "nav"; +@import "navbar"; +@import "card"; +@import "accordion"; +@import "breadcrumb"; +@import "pagination"; +@import "badge"; +@import "alert"; +@import "progress"; +@import "list-group"; +@import "close"; +@import "toasts"; +@import "modal"; +@import "tooltip"; +@import "popover"; +@import "carousel"; +@import "spinners"; +@import "offcanvas"; +@import "placeholders"; + +// Helpers +@import "helpers"; + +// Utilities +@import "utilities/api"; +
    +

    If you’re not using a component, comment it out or delete it entirely. For example, if you’re not using the carousel, remove that import to save some file size in your compiled CSS. Keep in mind there are some dependencies across Sass imports that may make it more difficult to omit a file.

    +

    Lean JavaScript

    +

    Bootstrap’s JavaScript includes every component in our primary dist files (bootstrap.js and bootstrap.min.js), and even our primary dependency (Popper) with our bundle files (bootstrap.bundle.js and bootstrap.bundle.min.js). While you’re customizing via Sass, be sure to remove related JavaScript.

    +

    For instance, assuming you’re using your own JavaScript bundler like Webpack, Parcel, or Vite, you’d only import the JavaScript you plan on using. In the example below, we show how to just include our modal JavaScript:

    +
    // Import just what we need
    +
    +// import 'bootstrap/js/dist/alert';
    +// import 'bootstrap/js/dist/button';
    +// import 'bootstrap/js/dist/carousel';
    +// import 'bootstrap/js/dist/collapse';
    +// import 'bootstrap/js/dist/dropdown';
    +import 'bootstrap/js/dist/modal';
    +// import 'bootstrap/js/dist/offcanvas';
    +// import 'bootstrap/js/dist/popover';
    +// import 'bootstrap/js/dist/scrollspy';
    +// import 'bootstrap/js/dist/tab';
    +// import 'bootstrap/js/dist/toast';
    +// import 'bootstrap/js/dist/tooltip';
    +
    +

    This way, you’re not including any JavaScript you don’t intend to use for components like buttons, carousels, and tooltips. If you’re importing dropdowns, tooltips or popovers, be sure to list the Popper dependency in your package.json file.

    +

    Heads up! Files in bootstrap/js/dist use the default export. To use them, do the following:

    import Modal from 'bootstrap/js/dist/modal'
    +const modal = new Modal(document.getElementById('myModal'))
    +
    +

    Autoprefixer .browserslistrc

    Bootstrap depends on Autoprefixer to automatically add browser prefixes to certain CSS properties. Prefixes are dictated by our .browserslistrc file, found in the root of the Bootstrap repo. Customizing this list of browsers and recompiling the Sass will automatically remove some CSS from your compiled CSS, if there are vendor prefixes unique to that browser or version.

    -

    Unused CSS

    +

    Unused CSS

    Help wanted with this section, please consider opening a PR. Thanks!

    -

    While we don’t have a prebuilt example for using PurgeCSS with Bootstrap, there are some helpful articles and walkthroughs that the community has written. Here are some options:

    +

    While we don’t have a prebuilt example for using PurgeCSS with Bootstrap, there are some helpful articles and walkthroughs that the community has written. Here are some options:

    Lastly, this CSS Tricks article on unused CSS shows how to use PurgeCSS and other similar tools.

    -

    Minify and gzip

    -

    Whenever possible, be sure to compress all the code you serve to your visitors. If you’re using Bootstrap dist files, try to stick to the minified versions (indicated by the .min.css and .min.js extensions). If you’re building Bootstrap from the source with your own build system, be sure to implement your own minifiers for HTML, CSS, and JS.

    -

    Non-blocking files

    +

    Minify and gzip

    +

    Whenever possible, be sure to compress all the code you serve to your visitors. If you’re using Bootstrap dist files, try to stick to the minified versions (indicated by the .min.css and .min.js extensions). If you’re building Bootstrap from the source with your own build system, be sure to implement your own minifiers for HTML, CSS, and JS.

    +

    Non-blocking files

    While minifying and using compression might seem like enough, making your files non-blocking ones is also a big step in making your site well-optimized and fast enough.

    -

    If you are using a Lighthouse plugin in Google Chrome, you may have stumbled over FCP. The First Contentful Paint metric measures the time from when the page starts loading to when any part of the page’s content is rendered on the screen.

    -

    You can improve FCP by deferring non-critical JavaScript or CSS. What does that mean? Simply, JavaScript or stylesheets that don’t need to be present on the first paint of your page should be marked with async or defer attributes.

    +

    If you are using a Lighthouse plugin in Google Chrome, you may have stumbled over FCP. The First Contentful Paint metric measures the time from when the page starts loading to when any part of the page’s content is rendered on the screen.

    +

    You can improve FCP by deferring non-critical JavaScript or CSS. What does that mean? Simply, JavaScript or stylesheets that don’t need to be present on the first paint of your page should be marked with async or defer attributes.

    This ensures that the less important resources are loaded later and not blocking the first paint. On the other hand, critical resources can be included as inline scripts or styles.

    If you want to learn more about this, there are already a lot of great articles about it:

    -

    Always use HTTPS

    +

    Always use HTTPS

    Your website should only be available over HTTPS connections in production. HTTPS improves the security, privacy, and availability of all sites, and there is no such thing as non-sensitive web traffic. The steps to configure your website to be served exclusively over HTTPS vary widely depending on your architecture and web hosting provider, and thus are beyond the scope of these docs.

    -

    Sites served over HTTPS should also access all stylesheets, scripts, and other assets over HTTPS connections. Otherwise, you’ll be sending users mixed active content, leading to potential vulnerabilities where a site can be compromised by altering a dependency. This can lead to security issues and in-browser warnings displayed to users. Whether you’re getting Bootstrap from a CDN or serving it yourself, ensure that you only access it over HTTPS connections.

    - -
    -
    -
    - - - - - - - - - - - - - - - +

    Sites served over HTTPS should also access all stylesheets, scripts, and other assets over HTTPS connections. Otherwise, you’ll be sending users mixed active content, leading to potential vulnerabilities where a site can be compromised by altering a dependency. This can lead to security issues and in-browser warnings displayed to users. Whether you’re getting Bootstrap from a CDN or serving it yourself, ensure that you only access it over HTTPS connections.

    \ No newline at end of file diff --git a/docs/5.3/customize/options/index.html b/docs/5.3/customize/options/index.html index b3f992be03..392d942d17 100644 --- a/docs/5.3/customize/options/index.html +++ b/docs/5.3/customize/options/index.html @@ -1,721 +1,128 @@ - - - - - - - - - - - - - - - - -Options · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + Options · Bootstrap v5.3

    Quickly customize Bootstrap with built-in variables to easily toggle global CSS preferences for controlling style and behavior.

    +

    Customize Bootstrap with our built-in custom variables file and easily toggle global CSS preferences with new $enable-* Sass variables. Override a variable’s value and recompile with npm run test as needed.

    +

    You can find and customize these variables for key global options in Bootstrap’s scss/_variables.scss file.

    +
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Options

    -
    -

    Quickly customize Bootstrap with built-in variables to easily toggle global CSS preferences for controlling style and behavior.

    - - -
    - - - -
    - - -

    Customize Bootstrap with our built-in custom variables file and easily toggle global CSS preferences with new $enable-* Sass variables. Override a variable’s value and recompile with npm run test as needed.

    -

    You can find and customize these variables for key global options in Bootstrap’s scss/_variables.scss file.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    VariableValuesDescription
    $spacer1rem (default), or any value > 0Specifies the default spacer value to programmatically generate our spacer utilities.
    $enable-dark-modetrue (default) or falseEnables built-in dark mode support across the project and its components.
    $enable-roundedtrue (default) or falseEnables predefined border-radius styles on various components.
    $enable-shadowstrue or false (default)Enables predefined decorative box-shadow styles on various components. Does not affect box-shadows used for focus states.
    $enable-gradientstrue or false (default)Enables predefined gradients via background-image styles on various components.
    $enable-transitionstrue (default) or falseEnables predefined transitions on various components.
    $enable-reduced-motiontrue (default) or falseEnables the prefers-reduced-motion media query, which suppresses certain animations/transitions based on the users’ browser/operating system preferences.
    $enable-grid-classestrue (default) or falseEnables the generation of CSS classes for the grid system (e.g. .row, .col-md-1, etc.).
    $enable-cssgridtrue or false (default)Enables the experimental CSS Grid system (e.g. .grid, .g-col-md-1, etc.).
    $enable-container-classestrue (default) or falseEnables the generation of CSS classes for layout containers. (New in v5.2.0)
    $enable-carettrue (default) or falseEnables pseudo element caret on .dropdown-toggle.
    $enable-button-pointerstrue (default) or falseAdd “hand” cursor to non-disabled button elements.
    $enable-rfstrue (default) or falseGlobally enables RFS.
    $enable-validation-iconstrue (default) or falseEnables background-image icons within textual inputs and some custom forms for validation states.
    $enable-negative-marginstrue or false (default)Enables the generation of negative margin utilities.
    $enable-deprecation-messagestrue (default) or falseSet to false to hide warnings when using any of the deprecated mixins and functions that are planned to be removed in v6.
    $enable-important-utilitiestrue (default) or falseEnables the !important suffix in utility classes.
    $enable-smooth-scrolltrue (default) or falseApplies scroll-behavior: smooth globally, except for users asking for reduced motion through prefers-reduced-motion media query
    -
    -
    -
    - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    VariableValuesDescription
    $spacer1rem (default), or any value > 0Specifies the default spacer value to programmatically generate our spacer utilities.
    $enable-dark-modetrue (default) or falseEnables built-in dark mode support across the project and its components.
    $enable-roundedtrue (default) or falseEnables predefined border-radius styles on various components.
    $enable-shadowstrue or false (default)Enables predefined decorative box-shadow styles on various components. Does not affect box-shadows used for focus states.
    $enable-gradientstrue or false (default)Enables predefined gradients via background-image styles on various components.
    $enable-transitionstrue (default) or falseEnables predefined transitions on various components.
    $enable-reduced-motiontrue (default) or falseEnables the prefers-reduced-motion media query, which suppresses certain animations/transitions based on the users’ browser/operating system preferences.
    $enable-grid-classestrue (default) or falseEnables the generation of CSS classes for the grid system (e.g. .row, .col-md-1, etc.).
    $enable-cssgridtrue or false (default)Enables the experimental CSS Grid system (e.g. .grid, .g-col-md-1, etc.).
    $enable-container-classestrue (default) or falseEnables the generation of CSS classes for layout containers. (New in v5.2.0)
    $enable-carettrue (default) or falseEnables pseudo element caret on .dropdown-toggle.
    $enable-button-pointerstrue (default) or falseAdd “hand” cursor to non-disabled button elements.
    $enable-rfstrue (default) or falseGlobally enables RFS.
    $enable-validation-iconstrue (default) or falseEnables background-image icons within textual inputs and some custom forms for validation states.
    $enable-negative-marginstrue or false (default)Enables the generation of negative margin utilities.
    $enable-deprecation-messagestrue (default) or falseSet to false to hide warnings when using any of the deprecated mixins and functions that are planned to be removed in v6.
    $enable-important-utilitiestrue (default) or falseEnables the !important suffix in utility classes.
    $enable-smooth-scrolltrue (default) or falseApplies scroll-behavior: smooth globally, except for users asking for reduced motion through prefers-reduced-motion media query
    \ No newline at end of file diff --git a/docs/5.3/customize/overview/index.html b/docs/5.3/customize/overview/index.html index 0187b4d19a..3b80b56b24 100644 --- a/docs/5.3/customize/overview/index.html +++ b/docs/5.3/customize/overview/index.html @@ -1,693 +1,48 @@ - - - - - - - - - - - - - - - - -Customize · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Customize

    -
    -

    Learn how to theme, customize, and extend Bootstrap with Sass, a boatload of global options, an expansive color system, and more.

    - - -
    - - - -
    - - - - -

    Overview

    -

    There are multiple ways to customize Bootstrap. Your best path can depend on your project, the complexity of your build tools, the version of Bootstrap you’re using, browser support, and more.

    + Customize · Bootstrap v5.3

    Learn how to theme, customize, and extend Bootstrap with Sass, a boatload of global options, an expansive color system, and more.

    +

    Overview

    +

    There are multiple ways to customize Bootstrap. Your best path can depend on your project, the complexity of your build tools, the version of Bootstrap you’re using, browser support, and more.

    Our two preferred methods are:

      -
    1. Using Bootstrap via package manager so you can use and extend our source files.
    2. -
    3. Using Bootstrap’s compiled distribution files or jsDelivr so you can add onto or override Bootstrap’s styles.
    4. +
    5. Using Bootstrap via package manager so you can use and extend our source files.
    6. +
    7. Using Bootstrap’s compiled distribution files or jsDelivr so you can add onto or override Bootstrap’s styles.
    -

    While we cannot go into details here on how to use every package manager, we can give some guidance on using Bootstrap with your own Sass compiler.

    -

    For those who want to use the distribution files, review the getting started page for how to include those files and an example HTML page. From there, consult the docs for the layout, components, and behaviors you’d like to use.

    +

    While we cannot go into details here on how to use every package manager, we can give some guidance on using Bootstrap with your own Sass compiler.

    +

    For those who want to use the distribution files, review the getting started page for how to include those files and an example HTML page. From there, consult the docs for the layout, components, and behaviors you’d like to use.

    As you familiarize yourself with Bootstrap, continue exploring this section for more details on how to utilize our global options, making use of and changing our color system, how we build our components, how to use our growing list of CSS custom properties, and how to optimize your code when building with Bootstrap.

    -

    CSPs and embedded SVGs

    -

    Several Bootstrap components include embedded SVGs in our CSS to style components consistently and easily across browsers and devices. For organizations with more strict CSP configurations, we’ve documented all instances of our embedded SVGs (all of which are applied via background-image) so you can more thoroughly review your options.

    +

    CSPs and embedded SVGs

    +

    Several Bootstrap components include embedded SVGs in our CSS to style components consistently and easily across browsers and devices. For organizations with more strict CSP configurations, we’ve documented all instances of our embedded SVGs (all of which are applied via background-image) so you can more thoroughly review your options.

    -

    Based on community conversation, some options for addressing this in your own codebase include replacing the URLs with locally hosted assets, removing the images and using inline images (not possible in all components), and modifying your CSP. Our recommendation is to carefully review your own security policies and decide on the best path forward, if necessary.

    - -
    -
    -
    - - - - - - - - - - - - - - - +

    Based on community conversation, some options for addressing this in your own codebase include replacing the URLs with locally hosted assets, removing the images and using inline images (not possible in all components), and modifying your CSP. Our recommendation is to carefully review your own security policies and decide on the best path forward, if necessary.

    \ No newline at end of file diff --git a/docs/5.3/customize/sass/index.html b/docs/5.3/customize/sass/index.html index 1997d1506d..75974aeb3b 100644 --- a/docs/5.3/customize/sass/index.html +++ b/docs/5.3/customize/sass/index.html @@ -1,935 +1,303 @@ - - - - - - - - + Sass · Bootstrap v5.3

    Utilize our source Sass files to take advantage of variables, maps, mixins, and functions to help you build faster and customize your project.

    +

    Utilize our source Sass files to take advantage of variables, maps, mixins, and more.

    +

    Sass deprecation warnings are shown when compiling source Sass files with the latest versions of Dart Sass. This does not prevent compilation or usage of Bootstrap. We’re working on a long-term fix, but in the meantime these deprecation notices can be ignored.

    +

    File structure

    +

    Whenever possible, avoid modifying Bootstrap’s core files. For Sass, that means creating your own stylesheet that imports Bootstrap so you can modify and extend it. Assuming you’re using a package manager like npm, you’ll have a file structure that looks like this:

    +
    your-project/
    +├── scss/
    +│   └── custom.scss
    +└── node_modules/
    +│   └── bootstrap/
    +│       ├── js/
    +│       └── scss/
    +└── index.html
    +
    +

    If you’ve downloaded our source files and aren’t using a package manager, you’ll want to manually create something similar to that structure, keeping Bootstrap’s source files separate from your own.

    +
    your-project/
    +├── scss/
    +│   └── custom.scss
    +├── bootstrap/
    +│   ├── js/
    +│   └── scss/
    +└── index.html
    +
    +

    Importing

    +

    In your custom.scss, you’ll import Bootstrap’s source Sass files. You have two options: include all of Bootstrap, or pick the parts you need. We encourage the latter, though be aware there are some requirements and dependencies across our components. You also will need to include some JavaScript for our plugins.

    +
    // Custom.scss
    +// Option A: Include all of Bootstrap
     
    -
    -
    +// Include any default variable overrides here (though functions won’t be available)
     
    -
    +@import "../node_modules/bootstrap/scss/bootstrap";
     
    -
    +// Then add additional custom code here
    +
    +
    // Custom.scss
    +// Option B: Include parts of Bootstrap
     
    -Sass · Bootstrap v5.3
    +// 1. Include functions first (so you can manipulate colors, SVGs, calc, etc)
    +@import "../node_modules/bootstrap/scss/functions";
     
    -
    +// 2. Include any default variable overrides here
     
    -
    -
    +// 3. Include remainder of required Bootstrap stylesheets (including any separate color mode stylesheets)
    +@import "../node_modules/bootstrap/scss/variables";
    +@import "../node_modules/bootstrap/scss/variables-dark";
     
    -
    -
    -
    -
    -
    -
    -
    +// 4. Include any default map overrides here
     
    -
    -
    -
    -
    -
    -
    +// 5. Include remainder of required parts
    +@import "../node_modules/bootstrap/scss/maps";
    +@import "../node_modules/bootstrap/scss/mixins";
    +@import "../node_modules/bootstrap/scss/root";
     
    -
    -
    -
    -
    -
    -
    -
    -
    +// 6. Include any other optional stylesheet partials as desired; list below is not inclusive of all available stylesheets
    +@import "../node_modules/bootstrap/scss/utilities";
    +@import "../node_modules/bootstrap/scss/reboot";
    +@import "../node_modules/bootstrap/scss/type";
    +@import "../node_modules/bootstrap/scss/images";
    +@import "../node_modules/bootstrap/scss/containers";
    +@import "../node_modules/bootstrap/scss/grid";
    +@import "../node_modules/bootstrap/scss/helpers";
    +// ...
     
    -
    +// 7. Optionally include utilities API last to generate classes based on the Sass map in `_utilities.scss`
    +@import "../node_modules/bootstrap/scss/utilities/api";
     
    -
    -  
    -  
    -    
    -
    -    
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -    
    -  
    -  
    -    
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -
    -
    -
    -    
    -
    -
    -    
    -  
    - - -
    -
    - -

    Utilize our source Sass files to take advantage of variables, maps, mixins, and functions to help you build faster and customize your project.

    - - -
    - - - - - -
    - - -

    Utilize our source Sass files to take advantage of variables, maps, mixins, and more.

    -

    File structure

    -

    Whenever possible, avoid modifying Bootstrap’s core files. For Sass, that means creating your own stylesheet that imports Bootstrap so you can modify and extend it. Assuming you’re using a package manager like npm, you’ll have a file structure that looks like this:

    -
    your-project/
    -├── scss/
    -│   └── custom.scss
    -└── node_modules/
    -│   └── bootstrap/
    -│       ├── js/
    -│       └── scss/
    -└── index.html
    -

    If you’ve downloaded our source files and aren’t using a package manager, you’ll want to manually create something similar to that structure, keeping Bootstrap’s source files separate from your own.

    -
    your-project/
    -├── scss/
    -│   └── custom.scss
    -├── bootstrap/
    -│   ├── js/
    -│   └── scss/
    -└── index.html
    -

    Importing

    -

    In your custom.scss, you’ll import Bootstrap’s source Sass files. You have two options: include all of Bootstrap, or pick the parts you need. We encourage the latter, though be aware there are some requirements and dependencies across our components. You also will need to include some JavaScript for our plugins.

    -
    // Custom.scss
    -// Option A: Include all of Bootstrap
    -
    -// Include any default variable overrides here (though functions won't be available)
    -
    -@import "../node_modules/bootstrap/scss/bootstrap";
    -
    -// Then add additional custom code here
    -
    // Custom.scss
    -// Option B: Include parts of Bootstrap
    -
    -// 1. Include functions first (so you can manipulate colors, SVGs, calc, etc)
    -@import "../node_modules/bootstrap/scss/functions";
    -
    -// 2. Include any default variable overrides here
    -
    -// 3. Include remainder of required Bootstrap stylesheets (including any separate color mode stylesheets)
    -@import "../node_modules/bootstrap/scss/variables";
    -@import "../node_modules/bootstrap/scss/variables-dark";
    -
    -// 4. Include any default map overrides here
    -
    -// 5. Include remainder of required parts
    -@import "../node_modules/bootstrap/scss/maps";
    -@import "../node_modules/bootstrap/scss/mixins";
    -@import "../node_modules/bootstrap/scss/root";
    -
    -// 6. Optionally include any other parts as needed
    -@import "../node_modules/bootstrap/scss/utilities";
    -@import "../node_modules/bootstrap/scss/reboot";
    -@import "../node_modules/bootstrap/scss/type";
    -@import "../node_modules/bootstrap/scss/images";
    -@import "../node_modules/bootstrap/scss/containers";
    -@import "../node_modules/bootstrap/scss/grid";
    -@import "../node_modules/bootstrap/scss/helpers";
    -
    -// 7. Optionally include utilities API last to generate classes based on the Sass map in `_utilities.scss`
    -@import "../node_modules/bootstrap/scss/utilities/api";
    -
    -// 8. Add additional custom code here
    -

    With that setup in place, you can begin to modify any of the Sass variables and maps in your custom.scss. You can also start to add parts of Bootstrap under the // Optional section as needed. We suggest using the full import stack from our bootstrap.scss file as your starting point.

    -

    Compiling

    +// 8. Add additional custom code here +
    +

    With that setup in place, you can begin to modify any of the Sass variables and maps in your custom.scss. You can also start to add parts of Bootstrap under the // Optional section as needed. We suggest using the full import stack from our bootstrap.scss file as your starting point.

    +

    Compiling

    In order to use your custom Sass code as CSS in the browser, you need a Sass compiler. Sass ships as a CLI package, but you can also compile it with other build tools like Gulp or Webpack, or with GUI applications. Some IDEs also have Sass compilers built in or as downloadable extensions.

    We like to use the CLI to compile our Sass, but you can use whichever method you prefer. From the command line, run the following:

    -
    # Install Sass globally
    -npm install -g sass
    -
    -# Watch your custom Sass for changes and compile it to CSS
    -sass --watch ./scss/custom.scss ./css/custom.css
    -

    Learn more about your options at sass-lang.com/install and compiling with VS Code.

    -
    -Using Bootstrap with another build tool? Consider reading our guides for compiling with Webpack, Parcel, or Vite. We also have production-ready demos in our examples repository on GitHub. -
    - -

    Including

    -

    Once your CSS is compiled, you can include it in your HTML files. Inside your index.html you’ll want to include your compiled CSS file. Be sure to update the path to your compiled CSS file if you’ve changed it.

    -
    <!doctype html>
    -<html lang="en">
    -  <head>
    -    <meta charset="utf-8">
    -    <meta name="viewport" content="width=device-width, initial-scale=1">
    -    <title>Custom Bootstrap</title>
    -    <link href="/css/custom.css" rel="stylesheet">
    -  </head>
    -  <body>
    -    <h1>Hello, world!</h1>
    -  </body>
    -</html>
    -

    Variable defaults

    -

    Every Sass variable in Bootstrap includes the !default flag allowing you to override the variable’s default value in your own Sass without modifying Bootstrap’s source code. Copy and paste variables as needed, modify their values, and remove the !default flag. If a variable has already been assigned, then it won’t be re-assigned by the default values in Bootstrap.

    -

    You will find the complete list of Bootstrap’s variables in scss/_variables.scss. Some variables are set to null, these variables don’t output the property unless they are overridden in your configuration.

    +
    # Install Sass globally
    +npm install -g sass
    +
    +# Watch your custom Sass for changes and compile it to CSS
    +sass --watch ./scss/custom.scss ./css/custom.css
    +
    +

    Learn more about your options at sass-lang.com/install and compiling with VS Code.

    +

    Using Bootstrap with another build tool? Consider reading our guides for compiling with Webpack, Parcel, or Vite. We also have production-ready demos in our examples repository on GitHub.

    +

    Including

    +

    Once your CSS is compiled, you can include it in your HTML files. Inside your index.html you’ll want to include your compiled CSS file. Be sure to update the path to your compiled CSS file if you’ve changed it.

    +
    <!doctype html>
    +<html lang="en">
    +  <head>
    +    <meta charset="utf-8">
    +    <meta name="viewport" content="width=device-width, initial-scale=1">
    +    <title>Custom Bootstrap</title>
    +    <link href="/css/custom.css" rel="stylesheet">
    +  </head>
    +  <body>
    +    <h1>Hello, world!</h1>
    +  </body>
    +</html>
    +
    +

    Variable defaults

    +

    Every Sass variable in Bootstrap includes the !default flag allowing you to override the variable’s default value in your own Sass without modifying Bootstrap’s source code. Copy and paste variables as needed, modify their values, and remove the !default flag. If a variable has already been assigned, then it won’t be re-assigned by the default values in Bootstrap.

    +

    You will find the complete list of Bootstrap’s variables in scss/_variables.scss. Some variables are set to null, these variables don’t output the property unless they are overridden in your configuration.

    Variable overrides must come after our functions are imported, but before the rest of the imports.

    -

    Here’s an example that changes the background-color and color for the <body> when importing and compiling Bootstrap via npm:

    -
    // Required
    -@import "../node_modules/bootstrap/scss/functions";
    -
    -// Default variable overrides
    -$body-bg: #000;
    -$body-color: #111;
    -
    -// Required
    -@import "../node_modules/bootstrap/scss/variables";
    -@import "../node_modules/bootstrap/scss/variables-dark";
    -@import "../node_modules/bootstrap/scss/maps";
    -@import "../node_modules/bootstrap/scss/mixins";
    -@import "../node_modules/bootstrap/scss/root";
    -
    -// Optional Bootstrap components here
    -@import "../node_modules/bootstrap/scss/reboot";
    -@import "../node_modules/bootstrap/scss/type";
    -// etc
    -

    Repeat as necessary for any variable in Bootstrap, including the global options below.

    -
    -Get started with Bootstrap via npm with our starter project! Head to the Sass & JS example template repository to see how to build and customize Bootstrap in your own npm project. Includes Sass compiler, Autoprefixer, Stylelint, PurgeCSS, and Bootstrap Icons. -
    +

    Here’s an example that changes the background-color and color for the <body> when importing and compiling Bootstrap via npm:

    +
    // Required
    +@import "../node_modules/bootstrap/scss/functions";
     
    -

    Maps and loops

    +// Default variable overrides +$body-bg: #000; +$body-color: #111; + +// Required +@import "../node_modules/bootstrap/scss/variables"; +@import "../node_modules/bootstrap/scss/variables-dark"; +@import "../node_modules/bootstrap/scss/maps"; +@import "../node_modules/bootstrap/scss/mixins"; +@import "../node_modules/bootstrap/scss/root"; + +// Optional Bootstrap components here +@import "../node_modules/bootstrap/scss/reboot"; +@import "../node_modules/bootstrap/scss/type"; +// etc +
    +

    Repeat as necessary for any variable in Bootstrap, including the global options below.

    +

    Get started with Bootstrap via npm with our starter project! Head to the Sass & JS example template repository to see how to build and customize Bootstrap in your own npm project. Includes Sass compiler, Autoprefixer, Stylelint, PurgeCSS, and Bootstrap Icons.

    +

    Maps and loops

    Bootstrap includes a handful of Sass maps, key value pairs that make it easier to generate families of related CSS. We use Sass maps for our colors, grid breakpoints, and more. Just like Sass variables, all Sass maps include the !default flag and can be overridden and extended.

    Some of our Sass maps are merged into empty ones by default. This is done to allow easy expansion of a given Sass map, but comes at the cost of making removing items from a map slightly more difficult.

    -

    Modify map

    +

    Modify map

    All variables in the $theme-colors map are defined as standalone variables. To modify an existing color in our $theme-colors map, add the following to your custom Sass file:

    -
    $primary: #0074d9;
    -$danger: #ff4136;
    -

    Later on, these variables are set in Bootstrap’s $theme-colors map:

    -
    $theme-colors: (
    -  "primary": $primary,
    -  "danger": $danger
    -);
    -

    Add to map

    -

    Add new colors to $theme-colors, or any other map, by creating a new Sass map with your custom values and merging it with the original map. In this case, we’ll create a new $custom-colors map and merge it with $theme-colors.

    -
    // Create your own map
    -$custom-colors: (
    -  "custom-color": #900
    -);
    -
    -// Merge the maps
    -$theme-colors: map-merge($theme-colors, $custom-colors);
    -

    Remove from map

    +
    $primary: #0074d9;
    +$danger: #ff4136;
    +
    +

    Later on, these variables are set in Bootstrap’s $theme-colors map:

    +
    $theme-colors: (
    +  "primary": $primary,
    +  "danger": $danger
    +);
    +
    +

    Add to map

    +

    Add new colors to $theme-colors, or any other map, by creating a new Sass map with your custom values and merging it with the original map. In this case, we'll create a new $custom-colors map and merge it with $theme-colors.

    +
    // Create your own map
    +$custom-colors: (
    +  "custom-color": #900
    +);
    +
    +// Merge the maps
    +$theme-colors: map-merge($theme-colors, $custom-colors);
    +
    +

    Remove from map

    To remove colors from $theme-colors, or any other map, use map-remove. Be aware you must insert $theme-colors between our requirements just after its definition in variables and before its usage in maps:

    -
    // Required
    -@import "../node_modules/bootstrap/scss/functions";
    -@import "../node_modules/bootstrap/scss/variables";
    -@import "../node_modules/bootstrap/scss/variables-dark";
    -
    -$theme-colors: map-remove($theme-colors, "info", "light", "dark");
    -
    -@import "../node_modules/bootstrap/scss/maps";
    -@import "../node_modules/bootstrap/scss/mixins";
    -@import "../node_modules/bootstrap/scss/root";
    -
    -// Optional
    -@import "../node_modules/bootstrap/scss/reboot";
    -@import "../node_modules/bootstrap/scss/type";
    -// etc
    -

    Required keys

    -

    Bootstrap assumes the presence of some specific keys within Sass maps as we used and extend these ourselves. As you customize the included maps, you may encounter errors where a specific Sass map’s key is being used.

    -

    For example, we use the primary, success, and danger keys from $theme-colors for links, buttons, and form states. Replacing the values of these keys should present no issues, but removing them may cause Sass compilation issues. In these instances, you’ll need to modify the Sass code that makes use of those values.

    -

    Functions

    -

    Colors

    -

    Next to the Sass maps we have, theme colors can also be used as standalone variables, like $primary.

    -
    .custom-element {
    -  color: $gray-100;
    -  background-color: $dark;
    -}
    -

    You can lighten or darken colors with Bootstrap’s tint-color() and shade-color() functions. These functions will mix colors with black or white, unlike Sass’ native lighten() and darken() functions which will change the lightness by a fixed amount, which often doesn’t lead to the desired effect.

    +
    // Required
    +@import "../node_modules/bootstrap/scss/functions";
    +@import "../node_modules/bootstrap/scss/variables";
    +@import "../node_modules/bootstrap/scss/variables-dark";
    +
    +$theme-colors: map-remove($theme-colors, "info", "light", "dark");
    +
    +@import "../node_modules/bootstrap/scss/maps";
    +@import "../node_modules/bootstrap/scss/mixins";
    +@import "../node_modules/bootstrap/scss/root";
    +
    +// Optional
    +@import "../node_modules/bootstrap/scss/reboot";
    +@import "../node_modules/bootstrap/scss/type";
    +// etc
    +
    +

    Required keys

    +

    Bootstrap assumes the presence of some specific keys within Sass maps as we used and extend these ourselves. As you customize the included maps, you may encounter errors where a specific Sass map’s key is being used.

    +

    For example, we use the primary, success, and danger keys from $theme-colors for links, buttons, and form states. Replacing the values of these keys should present no issues, but removing them may cause Sass compilation issues. In these instances, you’ll need to modify the Sass code that makes use of those values.

    +

    Functions

    +

    Colors

    +

    Next to the Sass maps we have, theme colors can also be used as standalone variables, like $primary.

    +
    .custom-element {
    +  color: $gray-100;
    +  background-color: $dark;
    +}
    +
    +

    You can lighten or darken colors with Bootstrap’s tint-color() and shade-color() functions. These functions will mix colors with black or white, unlike Sass’ native lighten() and darken() functions which will change the lightness by a fixed amount, which often doesn’t lead to the desired effect.

    shift-color() combines these two functions by shading the color if the weight is positive and tinting the color if the weight is negative.

    -
    -
    - scss/_functions.scss -
    - -
    -
    // Tint a color: mix a color with white
    -@function tint-color($color, $weight) {
    -  @return mix(white, $color, $weight);
    -}
    -
    -// Shade a color: mix a color with black
    -@function shade-color($color, $weight) {
    -  @return mix(black, $color, $weight);
    -}
    -
    -// Shade the color if the weight is positive, else tint it
    -@function shift-color($color, $weight) {
    -  @return if($weight > 0, shade-color($color, $weight), tint-color($color, -$weight));
    -}
    -
    -

    In practice, you’d call the function and pass in the color and weight parameters.

    -
    .custom-element {
    -  color: tint-color($primary, 10%);
    -}
    -
    -.custom-element-2 {
    -  color: shade-color($danger, 30%);
    -}
    -
    -.custom-element-3 {
    -  color: shift-color($success, 40%);
    -  background-color: shift-color($success, -60%);
    -}
    -

    Color contrast

    +
    // Tint a color: mix a color with white
    +@function tint-color($color, $weight) {
    +  @return mix(white, $color, $weight);
    +}
    +
    +// Shade a color: mix a color with black
    +@function shade-color($color, $weight) {
    +  @return mix(black, $color, $weight);
    +}
    +
    +// Shade the color if the weight is positive, else tint it
    +@function shift-color($color, $weight) {
    +  @return if($weight > 0, shade-color($color, $weight), tint-color($color, -$weight));
    +}
    +
    +

    In practice, you’d call the function and pass in the color and weight parameters.

    +
    .custom-element {
    +  color: tint-color($primary, 10%);
    +}
    +
    +.custom-element-2 {
    +  color: shade-color($danger, 30%);
    +}
    +
    +.custom-element-3 {
    +  color: shift-color($success, 40%);
    +  background-color: shift-color($success, -60%);
    +}
    +
    +

    Color contrast

    In order to meet the Web Content Accessibility Guidelines (WCAG) contrast requirements, authors must provide a minimum text color contrast of 4.5:1 and a minimum non-text color contrast of 3:1, with very few exceptions.

    -

    To help with this, we included the color-contrast function in Bootstrap. It uses the WCAG contrast ratio algorithm for calculating contrast thresholds based on relative luminance in an sRGB color space to automatically return a light (#fff), dark (#212529) or black (#000) contrast color based on the specified base color. This function is especially useful for mixins or loops where you’re generating multiple classes.

    +

    To help with this, we included the color-contrast function in Bootstrap. It uses the WCAG contrast ratio algorithm for calculating contrast thresholds based on relative luminance in an sRGB color space to automatically return a light (#fff), dark (#212529) or black (#000) contrast color based on the specified base color. This function is especially useful for mixins or loops where you’re generating multiple classes.

    For example, to generate color swatches from our $theme-colors map:

    -
    @each $color, $value in $theme-colors {
    -  .swatch-#{$color} {
    -    color: color-contrast($value);
    -  }
    -}
    -

    It can also be used for one-off contrast needs:

    -
    .custom-element {
    -  color: color-contrast(#000); // returns `color: #fff`
    -}
    -

    You can also specify a base color with our color map functions:

    -
    .custom-element {
    -  color: color-contrast($dark); // returns `color: #fff`
    -}
    -

    Escape SVG

    +
    @each $color, $value in $theme-colors {
    +  .swatch-#{$color} {
    +    color: color-contrast($value);
    +  }
    +}
    +
    +

    It can also be used for one-off contrast needs:

    +
    .custom-element {
    +  color: color-contrast(#000); // returns `color: #fff`
    +}
    +
    +

    You can also specify a base color with our color map functions:

    +
    .custom-element {
    +  color: color-contrast($dark); // returns `color: #fff`
    +}
    +
    +

    Escape SVG

    We use the escape-svg function to escape the <, > and # characters for SVG background images. When using the escape-svg function, data URIs must be quoted.

    -

    Add and Subtract functions

    -

    We use the add and subtract functions to wrap the CSS calc function. The primary purpose of these functions is to avoid errors when a “unitless” 0 value is passed into a calc expression. Expressions like calc(10px - 0) will return an error in all browsers, despite being mathematically correct.

    +

    Add and Subtract functions

    +

    We use the add and subtract functions to wrap the CSS calc function. The primary purpose of these functions is to avoid errors when a “unitless” 0 value is passed into a calc expression. Expressions like calc(10px - 0) will return an error in all browsers, despite being mathematically correct.

    Example where the calc is valid:

    -
    $border-radius: .25rem;
    -$border-width: 1px;
    -
    -.element {
    -  // Output calc(.25rem - 1px) is valid
    -  border-radius: calc($border-radius - $border-width);
    -}
    -
    -.element {
    -  // Output the same calc(.25rem - 1px) as above
    -  border-radius: subtract($border-radius, $border-width);
    -}
    -

    Example where the calc is invalid:

    -
    $border-radius: .25rem;
    -$border-width: 0;
    -
    -.element {
    -  // Output calc(.25rem - 0) is invalid
    -  border-radius: calc($border-radius - $border-width);
    -}
    -
    -.element {
    -  // Output .25rem
    -  border-radius: subtract($border-radius, $border-width);
    -}
    -

    Mixins

    +
    $border-radius: .25rem;
    +$border-width: 1px;
    +
    +.element {
    +  // Output calc(.25rem - 1px) is valid
    +  border-radius: calc($border-radius - $border-width);
    +}
    +
    +.element {
    +  // Output the same calc(.25rem - 1px) as above
    +  border-radius: subtract($border-radius, $border-width);
    +}
    +
    +

    Example where the calc is invalid:

    +
    $border-radius: .25rem;
    +$border-width: 0;
    +
    +.element {
    +  // Output calc(.25rem - 0) is invalid
    +  border-radius: calc($border-radius - $border-width);
    +}
    +
    +.element {
    +  // Output .25rem
    +  border-radius: subtract($border-radius, $border-width);
    +}
    +
    +

    Mixins

    Our scss/mixins/ directory has a ton of mixins that power parts of Bootstrap and can also be used across your own project.

    -

    Color schemes

    -

    A shorthand mixin for the prefers-color-scheme media query is available with support for light and dark color schemes. See the color modes documentation for information on our color mode mixin.

    -
    -
    @mixin color-scheme($name) {
    -  @media (prefers-color-scheme: #{$name}) {
    -    @content;
    -  }
    -}
    -
    -
    .custom-element {
    -  @include color-scheme(light) {
    -    // Insert light mode styles here
    -  }
    -
    -  @include color-scheme(dark) {
    -    // Insert dark mode styles here
    -  }
    -}
    -
    -
    -
    -
    +

    Color schemes

    +

    A shorthand mixin for the prefers-color-scheme media query is available with support for light and dark color schemes. See the color modes documentation for information on our color mode mixin.

    +
    @mixin color-scheme($name) {
    +  @media (prefers-color-scheme: #{$name}) {
    +    @content;
    +  }
    +}
    +
    +
    .custom-element {
    +  @include color-scheme(light) {
    +    // Insert light mode styles here
    +  }
     
    -
    -    
    -
    -    
    -
    -
    -
    -
    -
    -    
    -  
    -
    -  
    -
    +  @include color-scheme(dark) {
    +    // Insert dark mode styles here
    +  }
    +}
    +
    \ No newline at end of file diff --git a/docs/5.3/docsref/index.html b/docs/5.3/docsref/index.html index 92ee95eee1..07b003e5bf 100644 --- a/docs/5.3/docsref/index.html +++ b/docs/5.3/docsref/index.html @@ -1,704 +1,54 @@ - - - - - - - - - - - - - - - - -Docs reference · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Docs reference

    -
    -

    Examples of Bootstrap’s documentation-specific components and styles.

    - - -
    - - -
    - - On this page -
    -
    - -
    -
    - - -
    - - -

    Buttons

    -

    + Docs reference · Bootstrap v5.3

    Docs reference

    Examples of Bootstrap’s documentation-specific components and styles.

    +
    On this page

    Buttons

    + -

    -

    Callouts

    -
    -Default callout -
    + +

    Callouts

    +

    Default callout

    +

    Warning callout

    +

    Danger callout

    +

    Code example

    +
    .test {
    +  --color: blue;
    +}
    +
    +

    The HTML abbreviation element.

    +
    This is a test.
    html
    <div class="test">This is a test.</div>
    +
    $gradient: linear-gradient(180deg, rgba($white, .15), rgba($white, 0));
    +
    +
    const toastTrigger = document.getElementById('liveToastBtn')
    +const toastLiveExample = document.getElementById('liveToast')
     
    -
    -Warning callout -
    - -
    -Danger callout -
    - -

    Code example

    -
    .test {
    -  --color: blue;
    -}
    -
    - The HTML abbreviation element. -
    -
    -
    - -
    This is a test.
    - -
    - html -
    - - -
    -
    <div class="test">This is a test.</div>
    -
    - -
    -
    - scss/_variables.scss -
    - -
    -
    $gradient: linear-gradient(180deg, rgba($white, .15), rgba($white, 0));
    -
    -
    -
    const toastTrigger = document.getElementById('liveToastBtn')
    -const toastLiveExample = document.getElementById('liveToast')
    -
    -if (toastTrigger) {
    -  const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample)
    -  toastTrigger.addEventListener('click', () => {
    -    toastBootstrap.show()
    -  })
    -}
    - -
    -
    -
    - - - - - - - - - - - - - - - +if (toastTrigger) { + const toastBootstrap = bootstrap.Toast.getOrCreateInstance(toastLiveExample) + toastTrigger.addEventListener('click', () => { + toastBootstrap.show() + }) +} +
    \ No newline at end of file diff --git a/docs/5.3/examples/album-rtl/index.html b/docs/5.3/examples/album-rtl/index.html index ab85a51b45..7fef3687b4 100644 --- a/docs/5.3/examples/album-rtl/index.html +++ b/docs/5.3/examples/album-rtl/index.html @@ -1,374 +1,8 @@ - - - - - - - - - مثال الألبوم · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    - -
    - -
    -
    -
    -

    مثال الألبوم

    -

    وصف قصير حول الألبوم أدناه (محتوياته ، ومنشؤه ، وما إلى ذلك). اجعله قصير ولطيف، ولكن ليست قصير جدًا حتى لا يتخطى الناس هذا الألبوم تمامًا.

    -

    - الدعوة الرئيسية للعمل - عمل ثانوي -

    -
    -
    -
    - -
    -
    - -
    -
    -
    - Placeholderصورة مصغرة -
    -

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    -
    -
    - - -
    - 9 دقائق -
    -
    -
    -
    -
    -
    - Placeholderصورة مصغرة -
    -

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    -
    -
    - - -
    - 9 دقائق -
    -
    -
    -
    -
    -
    - Placeholderصورة مصغرة -
    -

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    -
    -
    - - -
    - 9 دقائق -
    -
    -
    -
    - -
    -
    - Placeholderصورة مصغرة -
    -

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    -
    -
    - - -
    - 9 دقائق -
    -
    -
    -
    -
    -
    - Placeholderصورة مصغرة -
    -

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    -
    -
    - - -
    - 9 دقائق -
    -
    -
    -
    -
    -
    - Placeholderصورة مصغرة -
    -

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    -
    -
    - - -
    - 9 دقائق -
    -
    -
    -
    - -
    -
    - Placeholderصورة مصغرة -
    -

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    -
    -
    - - -
    - 9 دقائق -
    -
    -
    -
    -
    -
    - Placeholderصورة مصغرة -
    -

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    -
    -
    - - -
    - 9 دقائق -
    -
    -
    -
    -
    -
    - Placeholderصورة مصغرة -
    -

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    -
    -
    - - -
    - 9 دقائق -
    -
    -
    -
    -
    -
    -
    - -
    - - - - - - + مثال الألبوم · Bootstrap v5.3

    مثال الألبوم

    وصف قصير حول الألبوم أدناه (محتوياته ، ومنشؤه ، وما إلى ذلك). اجعله قصير ولطيف، ولكن ليست قصير جدًا حتى لا يتخطى الناس هذا الألبوم تمامًا.

    الدعوة الرئيسية للعمل عمل ثانوي

    Placeholderصورة مصغرة

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    9 دقائق
    Placeholderصورة مصغرة

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    9 دقائق
    Placeholderصورة مصغرة

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    9 دقائق
    Placeholderصورة مصغرة

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    9 دقائق
    Placeholderصورة مصغرة

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    9 دقائق
    Placeholderصورة مصغرة

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    9 دقائق
    Placeholderصورة مصغرة

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    9 دقائق
    Placeholderصورة مصغرة

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    9 دقائق
    Placeholderصورة مصغرة

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي. هذا المحتوى أطول قليلاً.

    9 دقائق
    \ No newline at end of file diff --git a/docs/5.3/examples/album/index.html b/docs/5.3/examples/album/index.html index cbad529b71..45a4b85059 100644 --- a/docs/5.3/examples/album/index.html +++ b/docs/5.3/examples/album/index.html @@ -1,374 +1,8 @@ - - - - - - - - - Album example · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    - -
    - -
    -
    -
    -

    Album example

    -

    Something short and leading about the collection below—its contents, the creator, etc. Make it short and sweet, but not too short so folks don’t simply skip over it entirely.

    -

    - Main call to action - Secondary action -

    -
    -
    -
    - -
    -
    - -
    -
    -
    - PlaceholderThumbnail -
    -

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    -
    -
    - - -
    - 9 mins -
    -
    -
    -
    -
    -
    - PlaceholderThumbnail -
    -

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    -
    -
    - - -
    - 9 mins -
    -
    -
    -
    -
    -
    - PlaceholderThumbnail -
    -

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    -
    -
    - - -
    - 9 mins -
    -
    -
    -
    - -
    -
    - PlaceholderThumbnail -
    -

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    -
    -
    - - -
    - 9 mins -
    -
    -
    -
    -
    -
    - PlaceholderThumbnail -
    -

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    -
    -
    - - -
    - 9 mins -
    -
    -
    -
    -
    -
    - PlaceholderThumbnail -
    -

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    -
    -
    - - -
    - 9 mins -
    -
    -
    -
    - -
    -
    - PlaceholderThumbnail -
    -

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    -
    -
    - - -
    - 9 mins -
    -
    -
    -
    -
    -
    - PlaceholderThumbnail -
    -

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    -
    -
    - - -
    - 9 mins -
    -
    -
    -
    -
    -
    - PlaceholderThumbnail -
    -

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    -
    -
    - - -
    - 9 mins -
    -
    -
    -
    -
    -
    -
    - -
    - - - - - - + Album example · Bootstrap v5.3

    Album example

    Something short and leading about the collection below—its contents, the creator, etc. Make it short and sweet, but not too short so folks don’t simply skip over it entirely.

    Main call to action Secondary action

    PlaceholderThumbnail

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    9 mins
    PlaceholderThumbnail

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    9 mins
    PlaceholderThumbnail

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    9 mins
    PlaceholderThumbnail

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    9 mins
    PlaceholderThumbnail

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    9 mins
    PlaceholderThumbnail

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    9 mins
    PlaceholderThumbnail

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    9 mins
    PlaceholderThumbnail

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    9 mins
    PlaceholderThumbnail

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    9 mins
    \ No newline at end of file diff --git a/docs/5.3/examples/badges/index.html b/docs/5.3/examples/badges/index.html index 4875f7f9c4..2d7dd35f66 100644 --- a/docs/5.3/examples/badges/index.html +++ b/docs/5.3/examples/badges/index.html @@ -1,313 +1,32 @@ - - - - - - - - - Badges · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - Primary - Secondary - Success - Danger - Warning - Info - Light - Dark -
    - -
    - -
    - Primary - Secondary - Success - Danger - Warning - Info - Light - Dark -
    - -
    - -
    - Primary - Secondary - Success - Danger - Warning - Info - Light - Dark -
    - -
    - -
    - - Primary - - - Secondary - - - Success - - - Danger - - - Warning - - - Info - - - Light - - - Dark - -
    - -
    - -
    - - Primary 1 - - - - Primary 2 - - - - Primary 3 - - -
    - -
    - -
    - - - Primary - - - - - - Secondary - - - - - - Success - - - - - - Danger - - - - - - Warning - - - - - - Info - - - - - - Light - - - - - - Dark - - - -
    - - - - + Badges · Bootstrap v5.3
    Primary Secondary Success Danger Warning Info Light Dark
    Primary Secondary Success Danger Warning Info Light Dark
    Primary Secondary Success Danger Warning Info Light Dark
    Primary + Secondary + Success + Danger + Warning + Info + Light + Dark +
    Primary 1 Primary 2 Primary 3
    +Primary + +Secondary + +Success + +Danger + +Warning + +Info + +Light + +Dark +
    \ No newline at end of file diff --git a/docs/5.3/examples/blog-rtl/index.html b/docs/5.3/examples/blog-rtl/index.html index 44cbf3700e..db3bdb2d2c 100644 --- a/docs/5.3/examples/blog-rtl/index.html +++ b/docs/5.3/examples/blog-rtl/index.html @@ -1,421 +1,14 @@ - - - - - - - - - قالب المدونة · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    -

    عنوان تدوينة مميزة أطول

    -

    عدة أسطر نصية متعددة تعبر عن التدوية، وذلك لإعلام القراء الجدد بسرعة وكفاءة حول أكثر الأشياء إثارة للاهتمام في محتويات هذه التدوينة.

    -

    أكمل القراءة...

    -
    -
    - -
    -
    -
    -
    - العالم -

    مشاركة مميزة

    -
    نوفمبر 12
    -

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي.

    - - أكمل القراءة - - -
    -
    - Placeholderصورة مصغرة -
    -
    -
    -
    -
    -
    - التصميم -

    عنوان الوظيفة

    -
    نوفمبر 11
    -

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي.

    - - أكمل القراءة - - -
    -
    - Placeholderصورة مصغرة -
    -
    -
    -
    - -
    -
    -

    - من Firehose -

    - -
    - - - -

    تعرض مشاركة المدونة هذه بضعة أنواع مختلفة من المحتوى الذي يتم دعمه وتصميمه باستخدام Bootstrap. النصوص الأساسية، الصور، والأكواد مدعومة بشكل كامل.

    -
    -

    يشكِّل تأمين الغذاء في المستقبل قضية تؤرِّق حكومات العالَم والعلماء على حدٍّ سواء. فخلال القرن العشرين ازداد عدد سكان الأرض أربعة أضعاف، وتشير التقديرات إلى أن العدد سوف يصل إلى عشرة مليارات إنسان بحلول عام 2050م. وسوف تمثل هذه الزيادة الهائلة تحدياً كبيراً وضغطاً متصاعداً على قدرة الإنتاج الزراعي. الأمر الذي كان ولا بد من أن يدفع إلى تطوير تقنيات مبتكرة في تصنيع الغذاء غير الزراعة، منها تقنية مستقبلية تقوم على تصنيع الغذاء من الهواء.

    -
    -

    تشغل الزراعة مساحات كبيرة من اليابسة، وتستهلك كميات هائلة من المياه، كما أن إنتاج الغذاء بواسطة الزراعة يسهم بنسبة عالية من انبعاثات غازات الاحتباس الحراري العالمية

    -
    -

    تشغل الزراعة مساحات كبيرة من اليابسة، وتستهلك كميات هائلة من المياه. كما أن إنتاج الغذاء بواسطة الزراعة يسهم بنسبة عالية من انبعاثات غازات الاحتباس الحراري العالمية، وللمقارنة فإن هذه النسبة من الانبعاثات هي أكبر مما ينتجه قطاع النقل بكل ما فيه من سيارات وشاحنات وطائرات وقطارات.

    -

    عنوان

    -

    تحصل النباتات على غذائها بواسطة عملية تسمى البناء الضوئي، حيث تقوم النباتات بتحويل ضوء الشمس والماء وثاني أكسيد الكربون الموجود في الغلاف الجوي إلى غذاء وتطلق الأكسجين كمنتج ثانوي لهذا التفاعل الكيميائي. وتحدث هذه العملية في "البلاستيدات الخضراء". فالنباتات تستفيد من طاقة ضوء الشمس في تقسيم الماء إلى هيدروجين وأكسجين، وتحدث تفاعلات كيميائية أخرى ينتج عنها سكر الجلكوز الذي تستخدمه كمصدر للغذاء وينطلق الأكسجين من النباتات إلى الغلاف الجوي. وهذا يعني أن النباتات تحوِّل ثاني أكسيد الكربون إلى غذاء من خلال تفاعلات كيميائية معقَّدة. ويُعد البناء الضوئي من أهم التفاعلات الكيميائية على كوكب الأرض، فقد ساعد في الماضي على تطوُّر كوكبنا وظهور الحياة عليه. فالنباتات تستخدم ثاني أكسيد الكربون لصنع غذائها، وتطلق الأكسجين لتساعد الكائنات الأخرى على التنفس!

    -

    عنوان فرعي

    -

    ألهمت هذه العملية علماء وكالة الفضاء الأمريكية (ناسا) خلال الستينيات من القرن الماضي، لبحث فكرة إطعام روَّاد الفضاء في مهمات الفضاء الطويلة مثل السفر إلى المريخ. وكانت واحدة من الأفكار الواعدة تصنيع الغذاء عن طريق ثاني أكسيد الكربون الذي ينتجه روَّاد الفضاء، لكن ليس بواسطة النباتات بل عن طريق ميكروبات صغيرة وحيدة الخلية قادرة على حصد ثاني أكسيد الكربون لإنتاج كميات وفيرة من البروتين المغذي على شكل مسحوق عديم النكهة، كما يمكن استخدام المادة في صنع الأطعمة المألوفة لدينا.

    -
    Example code block
    -

    وخلافاً لما هو الحال في عالم النبات، فإن هذه الميكروبات لا تستخدم الضوء كما يحدث في عملية البناء الضوئي التي تستخدمها النباتات للحصول على الغذاء، أي لأنها قادرة على النمو في الظلام. تسمى هذه البكتريا "هيدروجينوتروف" (Hydrogenotrophs)، وهي تستخدم الهيدروجين كوقود لإنتاج الغذاء من ثاني أكسيد الكربون. فعندما يُنتج روَّاد الفضاء ثاني أكسيد الكربون، تلتقطه الميكروبات، ويتحوَّل مع مدخلات أخرى إلى غذاء غني بالكربون. وبهذه الطريقة سوف نحصل على دورة كربون مغلقة الحلقة.

    -

    عنوان فرعي

    -

    بعد مرور أكثر من نصف قرن على أبحاث ناسا، تعمل حالياً عدة شركات في قطاع البيولوجيا التركيبية من ضمنها إير بروتين (Air Protein) وسولار فودز (Solar Foods) على تطوير جيل جديد من المنتجات الغذائية المستدامة، من دون وجود بصمة كربونية. ولن تقتصر هذه المنتجات الغذائية على روَّاد الفضاء فحسب، بل سوف تمتد لتشمل جميع سكان الأرض، وسوف تُنتَج في فترة زمنية قصيرة، بدلاً من الشهور، ومن دون الاعتماد على الأراضي الزراعية. وهذا يعني الحصول على منتجات غذائية بشكل سريع جداً. كما سيصبح من الممكن تصنيع الغذاء بطريقة عمودية من خلال هذه الميكروبات، بدلاً من الطريقة الأفقية التقليدية الشبيهة بتقنية الزراعة العمودية الحديثة. وهذا يعني توفير منتجات غذائية أكبر من المساحة نفسها.

    -

    يتكوَّن الغذاء البشري من ثلاثة أنواع رئيسة، هي:

    -
      -
    • البروتينات
    • -
    • الكربوهيدرات
    • -
    • الدهون
    • -
    -

    وتتكوَّن البروتينات من الأحماض الأمينية، وهي مجموعة من المركبات العضوية يبلغ عددها في جسم الإنسان عشرين حمضاً أمينياً، من بينها تسعة أساسية يحصل عليها الجسم من الغذاء. وتتكوَّن الأحماض الأمينية بشكل أساس من:

    -
      -
    1. الكربون
    2. -
    3. الهيدروجين
    4. -
    5. الأكسجين
    6. -
    7. النيتروجين
    8. -
    -

    ومن الملاحظ أن النيتروجين يشكِّل نسبة %78 من الهواء، كما أن الهيدروجين نحصل عليه من خلال التحليل الكهربائي للماء، ومن الممكن نظرياً سحب الكربون من الهواء لتشكيل هذه الأحماض، ذلك أن الكربون هو العمود الفقري للأحماض الأمينية، كما أن الحياة على كوكب الأرض قائمة على الكربون لقدرته على تكوين سلاسل كربونية طويلة، وهذا ما تفعله الميكروبات بتصنيع أحماض أمينية من ثاني أكسيد الكربون من خلال مجموعة من التفاعلات الكيميائية المعقَّدة. وإضافة إلى صنع وجبات غنية بالبروتين، فهذه الميكروبات تنتج منتجات أخرى مثل الزيوت التي لها عديد من الاستخدامات.

    -
    - -
    - - - -

    في الوقت الحالي، تدرس عدَّة شركات هذه الميكروبات بشكل أعمق، وتستزرعها من أجل الحصول على الغذاء. ففي عام 2019م، أعلن باحثون في شركة (Air Protein) الأمريكية نجاحهم في تحويل ثاني أكسيد الكربون الموجود في الهواء إلى لحوم صناعية مصنوعة من البروتين، التي لا تتطلَّب أي أرض زراعية، بل هي معتمدة بشكل أساسي على الهواء.

    -
    -

    تم تصنيع اللحوم بأنواع عديدة

    -
    -

    إذ استخدم هؤلاء الباحثون الهواء والطاقة المتجدِّدة كمدخلات في عملية مشابهة للتخمير، لإنتاج بروتين يحتوي على الأحماض الأمينية التسعة الأساسية وغني بالفيتامينات والمعادن، كما أنه خالٍ من الهرمونات والمضادات الحيوية والمبيدات الحشرية ومبيدات الأعشاب.

    -

    وتم تصنيع اللحوم بأنواع عديدة بما فيها الدواجن والأبقار والمأكولات البحرية، من دون حصول انبعاثات كربونية، على عكس تربية الأبقار التي تسهم في انبعاث غاز الميثان أحد غازات الاحتباس الحراري.

    -
    - -
    - - - -

    كما أن الشركة الفنلندية (Solar Foods) طوَّرت تقنية لإنتاج البروتين من الهواء، حيث تبدأ العملية بتقسيم الماء إلى مكوناته الهيدروجين والأكسجين عن طريق الكهرباء. فالهيدروجين يوفِّر الطاقة للبكتريا لتحويل ثاني أكسيد الكربون والنيتروجين الموجودين في الهواء إلى مادة عضوية غنية بالبروتين بشكل أكفأ من نمو النباتات باستخدام البناء الضوئي. وهذا البروتين يشبه دقيق القمح وقد أطلق عليه اسم "سولين" (Solein).

    -

    وتقوم الشركة حالياً بجمع البيانات حول المنتج الغذائي لتقديمه إلى الاتحاد الأوروبي بهدف الحصول على ترخيص غذائي، كما أنها تخطط لبدء الإنتاج التجاري في العام المقبل 2021م. وقد أوضحت الشركة أنها مهتمة بإنتاج أطعمة صديقة للبيئة من خلال استخدام المواد الأساسية: الكهرباء وثاني أكسيد الكربون، وهذه الأطعمة سوف تجنبنا الأثر السلبي البيئي للزراعة التقليدية الذي يشمل كل شيء من استخدام الأرض والمياه إلى الانبعاثات الناتجة من تسميد المحاصيل أو تربية الحيوانات.

    -

    وعلى هذا، فإن البروتينات المشتقة من الميكروبات سوف:

    -
      -
    • توفر حلاً ممكناً في ظل زيادة الطلب العالمي المستقبلي على الغذاء
    • -
    • تتوسع مصانع الغذاء في المستقبل لتكون أكفأ وأكثر استدامة
    • -
    • تصبح قادرة على توفير الغذاء لروَّاد الفضاء في سفرهم إلى المريخ وجميع سكان كوكب الأرض في عام 2050م
    • -
    -

    فتخيّل أن الميكروبات ستكون مصانع المستقبل، وأن غذاء المستقبل سيكون مصنوعاً من الهواء! وأن عام 2050م سيكون مختلفاً تماماً عن عالمنا اليوم. فهو عالم من دون زراعة ولا تربية حيوانات من أجل الغذاء! قد يبدو ذلك خيالياً لكنه ليس مستحيلاً!

    -
    - - - -
    - -
    -
    -
    -

    حول

    -

    أقبلت، فأقبلت معك الحياة بجميع صنوفها وألوانها: فالنبات ينبت، والأشجار تورق وتزهر، والهرة تموء، والقمري يسجع، والغنم يثغو، والبقر يخور، وكل أليف يدعو أليفه. كل شيء يشعر بالحياة وينسي هموم الحياة، ولا يذكر إلا سعادة الحياة، فإن كان الزمان جسدا فأنت روحه، وإن كان عمرا فأنت شبابه.

    -
    - - - - - -
    -

    في مكان آخر

    -
      -
    1. GitHub
    2. -
    3. Social
    4. -
    5. Facebook
    6. -
    -
    -
    -
    -
    - -
    - - - - - - + قالب المدونة · Bootstrap v5.3

    عنوان تدوينة مميزة أطول

    عدة أسطر نصية متعددة تعبر عن التدوية، وذلك لإعلام القراء الجدد بسرعة وكفاءة حول أكثر الأشياء إثارة للاهتمام في محتويات هذه التدوينة.

    أكمل القراءة...

    العالم

    مشاركة مميزة

    نوفمبر 12

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي.

    +أكمل القراءة +
    Placeholderصورة مصغرة
    التصميم

    عنوان الوظيفة

    نوفمبر 11

    هذه بطاقة أوسع مع نص داعم أدناه كمقدمة طبيعية لمحتوى إضافي.

    +أكمل القراءة +
    Placeholderصورة مصغرة

    +من Firehose +

    تعرض مشاركة المدونة هذه بضعة أنواع مختلفة من المحتوى الذي يتم دعمه وتصميمه باستخدام Bootstrap. النصوص الأساسية، الصور، والأكواد مدعومة بشكل كامل.


    يشكِّل تأمين الغذاء في المستقبل قضية تؤرِّق حكومات العالَم والعلماء على حدٍّ سواء. فخلال القرن العشرين ازداد عدد سكان الأرض أربعة أضعاف، وتشير التقديرات إلى أن العدد سوف يصل إلى عشرة مليارات إنسان بحلول عام 2050م. وسوف تمثل هذه الزيادة الهائلة تحدياً كبيراً وضغطاً متصاعداً على قدرة الإنتاج الزراعي. الأمر الذي كان ولا بد من أن يدفع إلى تطوير تقنيات مبتكرة في تصنيع الغذاء غير الزراعة، منها تقنية مستقبلية تقوم على تصنيع الغذاء من الهواء.

    تشغل الزراعة مساحات كبيرة من اليابسة، وتستهلك كميات هائلة من المياه، كما أن إنتاج الغذاء بواسطة الزراعة يسهم بنسبة عالية من انبعاثات غازات الاحتباس الحراري العالمية

    تشغل الزراعة مساحات كبيرة من اليابسة، وتستهلك كميات هائلة من المياه. كما أن إنتاج الغذاء بواسطة الزراعة يسهم بنسبة عالية من انبعاثات غازات الاحتباس الحراري العالمية، وللمقارنة فإن هذه النسبة من الانبعاثات هي أكبر مما ينتجه قطاع النقل بكل ما فيه من سيارات وشاحنات وطائرات وقطارات.

    عنوان

    تحصل النباتات على غذائها بواسطة عملية تسمى البناء الضوئي، حيث تقوم النباتات بتحويل ضوء الشمس والماء وثاني أكسيد الكربون الموجود في الغلاف الجوي إلى غذاء وتطلق الأكسجين كمنتج ثانوي لهذا التفاعل الكيميائي. وتحدث هذه العملية في "البلاستيدات الخضراء". فالنباتات تستفيد من طاقة ضوء الشمس في تقسيم الماء إلى هيدروجين وأكسجين، وتحدث تفاعلات كيميائية أخرى ينتج عنها سكر الجلكوز الذي تستخدمه كمصدر للغذاء وينطلق الأكسجين من النباتات إلى الغلاف الجوي. وهذا يعني أن النباتات تحوِّل ثاني أكسيد الكربون إلى غذاء من خلال تفاعلات كيميائية معقَّدة. ويُعد البناء الضوئي من أهم التفاعلات الكيميائية على كوكب الأرض، فقد ساعد في الماضي على تطوُّر كوكبنا وظهور الحياة عليه. فالنباتات تستخدم ثاني أكسيد الكربون لصنع غذائها، وتطلق الأكسجين لتساعد الكائنات الأخرى على التنفس!

    عنوان فرعي

    ألهمت هذه العملية علماء وكالة الفضاء الأمريكية (ناسا) خلال الستينيات من القرن الماضي، لبحث فكرة إطعام روَّاد الفضاء في مهمات الفضاء الطويلة مثل السفر إلى المريخ. وكانت واحدة من الأفكار الواعدة تصنيع الغذاء عن طريق ثاني أكسيد الكربون الذي ينتجه روَّاد الفضاء، لكن ليس بواسطة النباتات بل عن طريق ميكروبات صغيرة وحيدة الخلية قادرة على حصد ثاني أكسيد الكربون لإنتاج كميات وفيرة من البروتين المغذي على شكل مسحوق عديم النكهة، كما يمكن استخدام المادة في صنع الأطعمة المألوفة لدينا.

    Example code block

    وخلافاً لما هو الحال في عالم النبات، فإن هذه الميكروبات لا تستخدم الضوء كما يحدث في عملية البناء الضوئي التي تستخدمها النباتات للحصول على الغذاء، أي لأنها قادرة على النمو في الظلام. تسمى هذه البكتريا "هيدروجينوتروف" (Hydrogenotrophs)، وهي تستخدم الهيدروجين كوقود لإنتاج الغذاء من ثاني أكسيد الكربون. فعندما يُنتج روَّاد الفضاء ثاني أكسيد الكربون، تلتقطه الميكروبات، ويتحوَّل مع مدخلات أخرى إلى غذاء غني بالكربون. وبهذه الطريقة سوف نحصل على دورة كربون مغلقة الحلقة.

    عنوان فرعي

    بعد مرور أكثر من نصف قرن على أبحاث ناسا، تعمل حالياً عدة شركات في قطاع البيولوجيا التركيبية من ضمنها إير بروتين (Air Protein) وسولار فودز (Solar Foods) على تطوير جيل جديد من المنتجات الغذائية المستدامة، من دون وجود بصمة كربونية. ولن تقتصر هذه المنتجات الغذائية على روَّاد الفضاء فحسب، بل سوف تمتد لتشمل جميع سكان الأرض، وسوف تُنتَج في فترة زمنية قصيرة، بدلاً من الشهور، ومن دون الاعتماد على الأراضي الزراعية. وهذا يعني الحصول على منتجات غذائية بشكل سريع جداً. كما سيصبح من الممكن تصنيع الغذاء بطريقة عمودية من خلال هذه الميكروبات، بدلاً من الطريقة الأفقية التقليدية الشبيهة بتقنية الزراعة العمودية الحديثة. وهذا يعني توفير منتجات غذائية أكبر من المساحة نفسها.

    يتكوَّن الغذاء البشري من ثلاثة أنواع رئيسة، هي:

    • البروتينات
    • الكربوهيدرات
    • الدهون

    وتتكوَّن البروتينات من الأحماض الأمينية، وهي مجموعة من المركبات العضوية يبلغ عددها في جسم الإنسان عشرين حمضاً أمينياً، من بينها تسعة أساسية يحصل عليها الجسم من الغذاء. وتتكوَّن الأحماض الأمينية بشكل أساس من:

    1. الكربون
    2. الهيدروجين
    3. الأكسجين
    4. النيتروجين

    ومن الملاحظ أن النيتروجين يشكِّل نسبة %78 من الهواء، كما أن الهيدروجين نحصل عليه من خلال التحليل الكهربائي للماء، ومن الممكن نظرياً سحب الكربون من الهواء لتشكيل هذه الأحماض، ذلك أن الكربون هو العمود الفقري للأحماض الأمينية، كما أن الحياة على كوكب الأرض قائمة على الكربون لقدرته على تكوين سلاسل كربونية طويلة، وهذا ما تفعله الميكروبات بتصنيع أحماض أمينية من ثاني أكسيد الكربون من خلال مجموعة من التفاعلات الكيميائية المعقَّدة. وإضافة إلى صنع وجبات غنية بالبروتين، فهذه الميكروبات تنتج منتجات أخرى مثل الزيوت التي لها عديد من الاستخدامات.

    في الوقت الحالي، تدرس عدَّة شركات هذه الميكروبات بشكل أعمق، وتستزرعها من أجل الحصول على الغذاء. ففي عام 2019م، أعلن باحثون في شركة (Air Protein) الأمريكية نجاحهم في تحويل ثاني أكسيد الكربون الموجود في الهواء إلى لحوم صناعية مصنوعة من البروتين، التي لا تتطلَّب أي أرض زراعية، بل هي معتمدة بشكل أساسي على الهواء.

    تم تصنيع اللحوم بأنواع عديدة

    إذ استخدم هؤلاء الباحثون الهواء والطاقة المتجدِّدة كمدخلات في عملية مشابهة للتخمير، لإنتاج بروتين يحتوي على الأحماض الأمينية التسعة الأساسية وغني بالفيتامينات والمعادن، كما أنه خالٍ من الهرمونات والمضادات الحيوية والمبيدات الحشرية ومبيدات الأعشاب.

    وتم تصنيع اللحوم بأنواع عديدة بما فيها الدواجن والأبقار والمأكولات البحرية، من دون حصول انبعاثات كربونية، على عكس تربية الأبقار التي تسهم في انبعاث غاز الميثان أحد غازات الاحتباس الحراري.

    كما أن الشركة الفنلندية (Solar Foods) طوَّرت تقنية لإنتاج البروتين من الهواء، حيث تبدأ العملية بتقسيم الماء إلى مكوناته الهيدروجين والأكسجين عن طريق الكهرباء. فالهيدروجين يوفِّر الطاقة للبكتريا لتحويل ثاني أكسيد الكربون والنيتروجين الموجودين في الهواء إلى مادة عضوية غنية بالبروتين بشكل أكفأ من نمو النباتات باستخدام البناء الضوئي. وهذا البروتين يشبه دقيق القمح وقد أطلق عليه اسم "سولين" (Solein).

    وتقوم الشركة حالياً بجمع البيانات حول المنتج الغذائي لتقديمه إلى الاتحاد الأوروبي بهدف الحصول على ترخيص غذائي، كما أنها تخطط لبدء الإنتاج التجاري في العام المقبل 2021م. وقد أوضحت الشركة أنها مهتمة بإنتاج أطعمة صديقة للبيئة من خلال استخدام المواد الأساسية: الكهرباء وثاني أكسيد الكربون، وهذه الأطعمة سوف تجنبنا الأثر السلبي البيئي للزراعة التقليدية الذي يشمل كل شيء من استخدام الأرض والمياه إلى الانبعاثات الناتجة من تسميد المحاصيل أو تربية الحيوانات.

    وعلى هذا، فإن البروتينات المشتقة من الميكروبات سوف:

    • توفر حلاً ممكناً في ظل زيادة الطلب العالمي المستقبلي على الغذاء
    • تتوسع مصانع الغذاء في المستقبل لتكون أكفأ وأكثر استدامة
    • تصبح قادرة على توفير الغذاء لروَّاد الفضاء في سفرهم إلى المريخ وجميع سكان كوكب الأرض في عام 2050م

    فتخيّل أن الميكروبات ستكون مصانع المستقبل، وأن غذاء المستقبل سيكون مصنوعاً من الهواء! وأن عام 2050م سيكون مختلفاً تماماً عن عالمنا اليوم. فهو عالم من دون زراعة ولا تربية حيوانات من أجل الغذاء! قد يبدو ذلك خيالياً لكنه ليس مستحيلاً!

    حول

    أقبلت، فأقبلت معك الحياة بجميع صنوفها وألوانها: فالنبات ينبت، والأشجار تورق وتزهر، والهرة تموء، والقمري يسجع، والغنم يثغو، والبقر يخور، وكل أليف يدعو أليفه. كل شيء يشعر بالحياة وينسي هموم الحياة، ولا يذكر إلا سعادة الحياة، فإن كان الزمان جسدا فأنت روحه، وإن كان عمرا فأنت شبابه.

    في مكان آخر

    1. GitHub
    2. Social
    3. Facebook
    \ No newline at end of file diff --git a/docs/5.3/examples/blog/index.html b/docs/5.3/examples/blog/index.html index 42b1b9f82f..a685218ece 100644 --- a/docs/5.3/examples/blog/index.html +++ b/docs/5.3/examples/blog/index.html @@ -1,474 +1,14 @@ - - - - - - - - - Blog Template · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - Subscribe -
    -
    - -
    - -
    -
    - - -
    - -
    -
    -
    -

    Title of a longer featured blog post

    -

    Multiple lines of text that form the lede, informing new readers quickly and efficiently about what’s most interesting in this post’s contents.

    -

    Continue reading...

    -
    -
    - -
    -
    -
    -
    - World -

    Featured post

    -
    Nov 12
    -

    This is a wider card with supporting text below as a natural lead-in to additional content.

    - - Continue reading - - -
    -
    - PlaceholderThumbnail -
    -
    -
    -
    -
    -
    - Design -

    Post title

    -
    Nov 11
    -

    This is a wider card with supporting text below as a natural lead-in to additional content.

    - - Continue reading - - -
    -
    - PlaceholderThumbnail -
    -
    -
    -
    - -
    -
    -

    - From the Firehose -

    - -
    - - - -

    This blog post shows a few different types of content that’s supported and styled with Bootstrap. Basic typography, lists, tables, images, code, and more are all supported as expected.

    -
    -

    This is some additional paragraph placeholder content. It has been written to fill the available space and show how a longer snippet of text affects the surrounding content. We'll repeat it often to keep the demonstration flowing, so be on the lookout for this exact same string of text.

    -

    Blockquotes

    -

    This is an example blockquote in action:

    -
    -

    Quoted text goes here.

    -
    -

    This is some additional paragraph placeholder content. It has been written to fill the available space and show how a longer snippet of text affects the surrounding content. We'll repeat it often to keep the demonstration flowing, so be on the lookout for this exact same string of text.

    -

    Example lists

    -

    This is some additional paragraph placeholder content. It's a slightly shorter version of the other highly repetitive body text used throughout. This is an example unordered list:

    -
      -
    • First list item
    • -
    • Second list item with a longer description
    • -
    • Third list item to close it out
    • -
    -

    And this is an ordered list:

    -
      -
    1. First list item
    2. -
    3. Second list item with a longer description
    4. -
    5. Third list item to close it out
    6. -
    -

    And this is a definition list:

    -
    -
    HyperText Markup Language (HTML)
    -
    The language used to describe and define the content of a Web page
    -
    Cascading Style Sheets (CSS)
    -
    Used to describe the appearance of Web content
    -
    JavaScript (JS)
    -
    The programming language used to build advanced Web sites and applications
    -
    -

    Inline HTML elements

    -

    HTML defines a long list of available inline tags, a complete list of which can be found on the Mozilla Developer Network.

    -
      -
    • To bold text, use <strong>.
    • -
    • To italicize text, use <em>.
    • -
    • Abbreviations, like HTML should use <abbr>, with an optional title attribute for the full phrase.
    • -
    • Citations, like — Mark Otto, should use <cite>.
    • -
    • Deleted text should use <del> and inserted text should use <ins>.
    • -
    • Superscript text uses <sup> and subscript text uses <sub>.
    • -
    -

    Most of these elements are styled by browsers with few modifications on our part.

    -

    Heading

    -

    This is some additional paragraph placeholder content. It has been written to fill the available space and show how a longer snippet of text affects the surrounding content. We'll repeat it often to keep the demonstration flowing, so be on the lookout for this exact same string of text.

    -

    Sub-heading

    -

    This is some additional paragraph placeholder content. It has been written to fill the available space and show how a longer snippet of text affects the surrounding content. We'll repeat it often to keep the demonstration flowing, so be on the lookout for this exact same string of text.

    -
    Example code block
    -

    This is some additional paragraph placeholder content. It's a slightly shorter version of the other highly repetitive body text used throughout.

    -
    - -
    - - - -

    This is some additional paragraph placeholder content. It has been written to fill the available space and show how a longer snippet of text affects the surrounding content. We'll repeat it often to keep the demonstration flowing, so be on the lookout for this exact same string of text.

    -
    -

    Longer quote goes here, maybe with some emphasized text in the middle of it.

    -
    -

    This is some additional paragraph placeholder content. It has been written to fill the available space and show how a longer snippet of text affects the surrounding content. We'll repeat it often to keep the demonstration flowing, so be on the lookout for this exact same string of text.

    -

    Example table

    -

    And don't forget about tables in these posts:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameUpvotesDownvotes
    Alice1011
    Bob43
    Charlie79
    Totals2123
    - -

    This is some additional paragraph placeholder content. It's a slightly shorter version of the other highly repetitive body text used throughout.

    -
    - -
    - - - -

    This is some additional paragraph placeholder content. It has been written to fill the available space and show how a longer snippet of text affects the surrounding content. We'll repeat it often to keep the demonstration flowing, so be on the lookout for this exact same string of text.

    -
      -
    • First list item
    • -
    • Second list item with a longer description
    • -
    • Third list item to close it out
    • -
    -

    This is some additional paragraph placeholder content. It's a slightly shorter version of the other highly repetitive body text used throughout.

    -
    - - - -
    - -
    -
    -
    -

    About

    -

    Customize this section to tell your visitors a little bit about your publication, writers, content, or something else entirely. Totally up to you.

    -
    - - - - - -
    -

    Elsewhere

    -
      -
    1. GitHub
    2. -
    3. Social
    4. -
    5. Facebook
    6. -
    -
    -
    -
    -
    - -
    - - - - - - + Blog Template · Bootstrap v5.3

    Title of a longer featured blog post

    Multiple lines of text that form the lede, informing new readers quickly and efficiently about what’s most interesting in this post’s contents.

    Continue reading...

    World

    Featured post

    Nov 12

    This is a wider card with supporting text below as a natural lead-in to additional content.

    +Continue reading +
    PlaceholderThumbnail
    Design

    Post title

    Nov 11

    This is a wider card with supporting text below as a natural lead-in to additional content.

    +Continue reading +
    PlaceholderThumbnail

    +From the Firehose +

    This blog post shows a few different types of content that’s supported and styled with Bootstrap. Basic typography, lists, tables, images, code, and more are all supported as expected.


    This is some additional paragraph placeholder content. It has been written to fill the available space and show how a longer snippet of text affects the surrounding content. We'll repeat it often to keep the demonstration flowing, so be on the lookout for this exact same string of text.

    Blockquotes

    This is an example blockquote in action:

    Quoted text goes here.

    This is some additional paragraph placeholder content. It has been written to fill the available space and show how a longer snippet of text affects the surrounding content. We'll repeat it often to keep the demonstration flowing, so be on the lookout for this exact same string of text.

    Example lists

    This is some additional paragraph placeholder content. It's a slightly shorter version of the other highly repetitive body text used throughout. This is an example unordered list:

    • First list item
    • Second list item with a longer description
    • Third list item to close it out

    And this is an ordered list:

    1. First list item
    2. Second list item with a longer description
    3. Third list item to close it out

    And this is a definition list:

    HyperText Markup Language (HTML)
    The language used to describe and define the content of a Web page
    Cascading Style Sheets (CSS)
    Used to describe the appearance of Web content
    JavaScript (JS)
    The programming language used to build advanced Web sites and applications

    Inline HTML elements

    HTML defines a long list of available inline tags, a complete list of which can be found on the Mozilla Developer Network.

    • To bold text, use <strong>.
    • To italicize text, use <em>.
    • Abbreviations, like HTML should use <abbr>, with an optional title attribute for the full phrase.
    • Citations, like — Mark Otto, should use <cite>.
    • Deleted text should use <del> and inserted text should use <ins>.
    • Superscript text uses <sup> and subscript text uses <sub>.

    Most of these elements are styled by browsers with few modifications on our part.

    Heading

    This is some additional paragraph placeholder content. It has been written to fill the available space and show how a longer snippet of text affects the surrounding content. We'll repeat it often to keep the demonstration flowing, so be on the lookout for this exact same string of text.

    Sub-heading

    This is some additional paragraph placeholder content. It has been written to fill the available space and show how a longer snippet of text affects the surrounding content. We'll repeat it often to keep the demonstration flowing, so be on the lookout for this exact same string of text.

    Example code block

    This is some additional paragraph placeholder content. It's a slightly shorter version of the other highly repetitive body text used throughout.

    This is some additional paragraph placeholder content. It has been written to fill the available space and show how a longer snippet of text affects the surrounding content. We'll repeat it often to keep the demonstration flowing, so be on the lookout for this exact same string of text.

    Longer quote goes here, maybe with some emphasized text in the middle of it.

    This is some additional paragraph placeholder content. It has been written to fill the available space and show how a longer snippet of text affects the surrounding content. We'll repeat it often to keep the demonstration flowing, so be on the lookout for this exact same string of text.

    Example table

    And don't forget about tables in these posts:

    Name Upvotes Downvotes
    Alice 10 11
    Bob 4 3
    Charlie 7 9
    Totals 21 23

    This is some additional paragraph placeholder content. It's a slightly shorter version of the other highly repetitive body text used throughout.

    This is some additional paragraph placeholder content. It has been written to fill the available space and show how a longer snippet of text affects the surrounding content. We'll repeat it often to keep the demonstration flowing, so be on the lookout for this exact same string of text.

    • First list item
    • Second list item with a longer description
    • Third list item to close it out

    This is some additional paragraph placeholder content. It's a slightly shorter version of the other highly repetitive body text used throughout.

    \ No newline at end of file diff --git a/docs/5.3/examples/breadcrumbs/index.html b/docs/5.3/examples/breadcrumbs/index.html index 4c1d91cd20..2c65c3b75f 100644 --- a/docs/5.3/examples/breadcrumbs/index.html +++ b/docs/5.3/examples/breadcrumbs/index.html @@ -1,252 +1,16 @@ - - - - - - - - - Breadcrumbs · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - - - - + Breadcrumbs · Bootstrap v5.3
    \ No newline at end of file diff --git a/docs/5.3/examples/buttons/index.html b/docs/5.3/examples/buttons/index.html index 65174a9e55..d83bce505f 100644 --- a/docs/5.3/examples/buttons/index.html +++ b/docs/5.3/examples/buttons/index.html @@ -1,253 +1,12 @@ - - - - - - - - - Buttons · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - -
    - -
    - -
    -
    - - -
    -
    - -
    - -
    - - -
    - -
    - -
    - - -
    - -
    - -
    - - -
    - -
    - - -
    - -
    - - - - + Buttons · Bootstrap v5.3
    \ No newline at end of file diff --git a/docs/5.3/examples/carousel-rtl/index.html b/docs/5.3/examples/carousel-rtl/index.html index 1f5bcf992e..7a3761d4ac 100644 --- a/docs/5.3/examples/carousel-rtl/index.html +++ b/docs/5.3/examples/carousel-rtl/index.html @@ -1,331 +1,9 @@ - - - - - - - - - قالب شرائح العرض · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -
    - -
    - - - - - - - -
    - - -
    -
    - Placeholder -

    عنوان

    -

    تذكر دائماً أن الحاسوب لا يمتلك ذكاءً، ولكنه يكتسب الذكاء الاصطناعي من خلال ثلاثة عناصر وظيفية رئيسة، هي: القدرة على التحليل، والقدرة على التأليف، والاستدلال المنطقي.

    -

    عرض التفاصيل

    -
    -
    - Placeholder -

    عنوان آخر

    -

    إذا أردنا استخدام الحاسوب الذكي في معالجة اللغة العربية فإننا نجد أنفسنا أمام تحدٍّ كبير، خاصة وأن لغتنا تمتاز بتماسك منظوماتها وتداخلها، ومع ذلك فإن الذكاء الاصطناعي يمكّننا من الحصول على أربعة أنواع من المعالجة، هي: المعالجة الصوتية، والمعالجة الصرفية، والمعالجة النحوية، والمعالجة الدلالية.

    -

    عرض التفاصيل

    -
    -
    - Placeholder -

    عنوان ثالث لتأكيد المعلومة

    -

    بفضل بحوث الذكاء الاصطناعي وتقنياته استطعنا الانتقال من مرحلة التعامل مع الفيزيائي إلى مرحلة التعامل مع المنطقي، وقد انعكس هذا الانتقال بصورة إيجابية على الكيفية التي تتعامل بها الشعوب مع لغاتها الحيَّة، وهذا يعني أنه يجب أن ينعكس بصورة إيجابية على كيفية تعاملنا مع لغتنا العربية.

    -

    عرض التفاصيل

    -
    -
    - - - - -
    - -
    -
    -

    العنوان الأول المميز. سيذهل عقلك.

    -

    وجه الإنسان هو جزء معقَّد ومتميِّز للغاية من جسمه. وفي الواقع، إنه أحد أكثر أنظمة الإشارات المتاحة تعقيداً لدينا؛ فهو يتضمَّن أكثر من 40 عضلة مستقلة هيكلياً ووظيفياً، بحيث يمكن تشغيل كل منها بشكل مستقل عن البعض الآخر؛ وتشكِّل أحد أقوى مؤشرات العواطف.

    -
    -
    - Placeholder500x500 -
    -
    - -
    - -
    -
    -

    أوه نعم، هذا جيد. شاهد بنفسك.

    -

    عندما نضحك أو نبكي، فإننا نعرض عواطفنا، مما يسمح للآخرين بإلقاء نظرة خاطفة على أذهاننا أثناء "قراءة" وجوهنا بناءً على التغييرات في مكوّنات الوجه الرئيسة، مثل: العينين والحاجبين والجفنين والأنف والشفتين.

    -
    -
    - Placeholder500x500 -
    -
    - -
    - -
    -
    -

    وأخيرًا، هذا. كش ملك.

    -

    إن جميع العضلات في أجسامنا مدعمة بالأعصاب المتصلة من كافة أنحاء الجسم بالنخاع الشوكي والدماغ. وهذا الاتصال العصبي هو ثنائي الاتجاه، أي إن العصب يتسبَّب في تقلصات العضلات بناءً على إشارات الدماغ، ويقوم في الوقت نفسه بإرسال معلومات عن حالة العضلات إلى الدماغ

    -
    -
    - Placeholder500x500 -
    -
    - -
    - - - -
    - - - - -
    - - - - + قالب شرائح العرض · Bootstrap v5.3
    Placeholder

    عنوان

    تذكر دائماً أن الحاسوب لا يمتلك ذكاءً، ولكنه يكتسب الذكاء الاصطناعي من خلال ثلاثة عناصر وظيفية رئيسة، هي: القدرة على التحليل، والقدرة على التأليف، والاستدلال المنطقي.

    عرض التفاصيل

    Placeholder

    عنوان آخر

    إذا أردنا استخدام الحاسوب الذكي في معالجة اللغة العربية فإننا نجد أنفسنا أمام تحدٍّ كبير، خاصة وأن لغتنا تمتاز بتماسك منظوماتها وتداخلها، ومع ذلك فإن الذكاء الاصطناعي يمكّننا من الحصول على أربعة أنواع من المعالجة، هي: المعالجة الصوتية، والمعالجة الصرفية، والمعالجة النحوية، والمعالجة الدلالية.

    عرض التفاصيل

    Placeholder

    عنوان ثالث لتأكيد المعلومة

    بفضل بحوث الذكاء الاصطناعي وتقنياته استطعنا الانتقال من مرحلة التعامل مع الفيزيائي إلى مرحلة التعامل مع المنطقي، وقد انعكس هذا الانتقال بصورة إيجابية على الكيفية التي تتعامل بها الشعوب مع لغاتها الحيَّة، وهذا يعني أنه يجب أن ينعكس بصورة إيجابية على كيفية تعاملنا مع لغتنا العربية.

    عرض التفاصيل


    العنوان الأول المميز. سيذهل عقلك.

    وجه الإنسان هو جزء معقَّد ومتميِّز للغاية من جسمه. وفي الواقع، إنه أحد أكثر أنظمة الإشارات المتاحة تعقيداً لدينا؛ فهو يتضمَّن أكثر من 40 عضلة مستقلة هيكلياً ووظيفياً، بحيث يمكن تشغيل كل منها بشكل مستقل عن البعض الآخر؛ وتشكِّل أحد أقوى مؤشرات العواطف.

    Placeholder500x500

    أوه نعم، هذا جيد. شاهد بنفسك.

    عندما نضحك أو نبكي، فإننا نعرض عواطفنا، مما يسمح للآخرين بإلقاء نظرة خاطفة على أذهاننا أثناء "قراءة" وجوهنا بناءً على التغييرات في مكوّنات الوجه الرئيسة، مثل: العينين والحاجبين والجفنين والأنف والشفتين.

    Placeholder500x500

    وأخيرًا، هذا. كش ملك.

    إن جميع العضلات في أجسامنا مدعمة بالأعصاب المتصلة من كافة أنحاء الجسم بالنخاع الشوكي والدماغ. وهذا الاتصال العصبي هو ثنائي الاتجاه، أي إن العصب يتسبَّب في تقلصات العضلات بناءً على إشارات الدماغ، ويقوم في الوقت نفسه بإرسال معلومات عن حالة العضلات إلى الدماغ

    Placeholder500x500

    \ No newline at end of file diff --git a/docs/5.3/examples/carousel/index.html b/docs/5.3/examples/carousel/index.html index e368892e64..5c97ac4456 100644 --- a/docs/5.3/examples/carousel/index.html +++ b/docs/5.3/examples/carousel/index.html @@ -1,331 +1,9 @@ - - - - - - - - - Carousel Template · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -
    - -
    - - - - - - - -
    - - -
    -
    - Placeholder -

    Heading

    -

    Some representative placeholder content for the three columns of text below the carousel. This is the first column.

    -

    View details »

    -
    -
    - Placeholder -

    Heading

    -

    Another exciting bit of representative placeholder content. This time, we've moved on to the second column.

    -

    View details »

    -
    -
    - Placeholder -

    Heading

    -

    And lastly this, the third column of representative placeholder content.

    -

    View details »

    -
    -
    - - - - -
    - -
    -
    -

    First featurette heading. It’ll blow your mind.

    -

    Some great placeholder content for the first featurette here. Imagine some exciting prose here.

    -
    -
    - Placeholder500x500 -
    -
    - -
    - -
    -
    -

    Oh yeah, it’s that good. See for yourself.

    -

    Another featurette? Of course. More placeholder content here to give you an idea of how this layout would work with some actual real-world content in place.

    -
    -
    - Placeholder500x500 -
    -
    - -
    - -
    -
    -

    And lastly, this one. Checkmate.

    -

    And yes, this is the last block of representative placeholder content. Again, not really intended to be actually read, simply here to give you a better view of what this would look like with some actual content. Your content.

    -
    -
    - Placeholder500x500 -
    -
    - -
    - - - -
    - - - - -
    - - - - + Carousel Template · Bootstrap v5.3
    Placeholder

    Heading

    Some representative placeholder content for the three columns of text below the carousel. This is the first column.

    View details »

    Placeholder

    Heading

    Another exciting bit of representative placeholder content. This time, we've moved on to the second column.

    View details »

    Placeholder

    Heading

    And lastly this, the third column of representative placeholder content.

    View details »


    First featurette heading. It’ll blow your mind.

    Some great placeholder content for the first featurette here. Imagine some exciting prose here.

    Placeholder500x500

    Oh yeah, it’s that good. See for yourself.

    Another featurette? Of course. More placeholder content here to give you an idea of how this layout would work with some actual real-world content in place.

    Placeholder500x500

    And lastly, this one. Checkmate.

    And yes, this is the last block of representative placeholder content. Again, not really intended to be actually read, simply here to give you a better view of what this would look like with some actual content. Your content.

    Placeholder500x500

    \ No newline at end of file diff --git a/docs/5.3/examples/cheatsheet-rtl/index.html b/docs/5.3/examples/cheatsheet-rtl/index.html index 0bb69d25a6..3f1fe7f59f 100644 --- a/docs/5.3/examples/cheatsheet-rtl/index.html +++ b/docs/5.3/examples/cheatsheet-rtl/index.html @@ -1,285 +1,31 @@ - - - - - - - - - ورقة الغش · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -

    - Bootstrap - ورقة الغش -

    - جدول بيانات LTR -
    -
    - -
    -
    -

    المحتوى

    - -
    -
    -

    النصوص

    - دليل الإستخدام -
    - -
    -
    -
    - + ورقة الغش · Bootstrap v5.3

    Bootstrap +ورقة الغش +

    جدول بيانات LTR

    المحتوى

    العرض 1

    العرض 2

    العرض 3

    العرض 4

    العرض 5

    العرض 6

    - -
    -
    - - -
    -
    - +

    عنوان 1

    عنوان 2

    عنوان 3

    عنوان 4

    عنوان 5

    عنوان 6

    - -
    -
    - - -
    -
    - +

    هذه قطعة إملائية متميزة، فهي مصممة لتكون بارزة من بين القطع الإملائية الأخرى.

    - -
    -
    - - -
    -
    - +

    يمكنك استخدام تصنيف mark لتحديد نص.

    من المفترض أن يتم التعامل مع هذا السطر كنص محذوف.

    من المفترض أن يتم التعامل مع هذا السطر على أنه لم يعد دقيقًا.

    @@ -288,35 +34,14 @@

    من المفترض أن يتم التعامل مع هذا السطر على أنه يحوي تفاصيل صغيرة.

    هذا السطر يحوي نص عريض.

    هذا السطر يحوي نص مائل.

    - -
    -
    - - -
    -
    - +

    - -
    -
    - - -
    -
    - +

    إقتباس مبهر، موضوع في عنصر blockquote

    شخص مشهور في عنوان المصدر
    - -
    -
    - - -
    -
    - +
    • هذه قائمة عناصر.
    • بالرغم من أنها مصممة كي لا تظهر كذلك.
    • @@ -331,61 +56,17 @@
    • قد يكون هذا التصميم مفيدًا في بعض الأحيان.
    - -
    -
    - - -
    -
    - +
    • هذا عنصر في قائمة.
    • وهذا أيضًا.
    • لكنهم يظهرون متجاورين.
    - -
    -
    - -
    -
    -
    -
    -

    الصور

    - دليل الإستخدام -
    - -
    -
    -
    - - Placeholderصورة مستجيبة - -
    -
    - - -
    -
    - - صورة عنصر نائب مربع عام مع حدود بيضاء حولها ، مما يجعلها تشبه صورة تم التقاطها بكاميرا فورية قديمة200x200 - -
    -
    - -
    -
    -
    + Placeholderصورة مستجيبة +
    + صورة عنصر نائب مربع عام مع حدود بيضاء حولها ، مما يجعلها تشبه صورة تم التقاطها بكاميرا فورية قديمة200x200 +
    @@ -416,14 +97,7 @@
    - -
    -
    - - -
    -
    - +
    @@ -454,14 +128,7 @@
    - -
    -
    - - -
    -
    - +
    @@ -476,57 +143,49 @@ - - + - + - + - + - + - + - + - + - +
    خلية خلية
    Primary خلية خلية
    Secondary خلية خلية
    Success خلية خلية
    Danger خلية خلية
    Warning خلية خلية
    Info خلية خلية
    Light خلية خلية
    Dark خلية خلية
    - -
    -
    - - -
    -
    - +
    @@ -557,47 +216,12 @@
    - -
    -
    - -
    -
    -

    النماذج البيانية

    دليل الإستخدام
    - Placeholder400x300 + Placeholder400x300
    شرح للصورة أعلاه.
    - -
    -
    - -
    -
    -
    - -
    -

    النماذج

    - -

    النماذج

    - - - - - -
    - -
    -

    العناصر

    - -

    العناصر

    -
    -

    الإنذارات

    دليل الإستخدام
    + + + + + + + + + + + + + + - -
    -
    - - -
    -
    - +
    - -
    -
    - -
    -
    -

    مثال على عنوان جديد

    مثال على عنوان جديد

    مثال على عنوان جديد

    @@ -1050,39 +548,30 @@

    مثال على عنوان جديد

    مثال على عنوان جديد

    مثال على عنوان جديد

    - -
    -
    - - -
    -
    - - +
    Primary - Secondary - Success - Danger - Warning - Info - Light - Dark -
    -
    -
    -
    - -
    -
    -

    الأزرار

    - دليل الإستخدام -
    + + -
    -
    -
    - - - - - - - - - - + + - - -
    -
    + + + + -
    -
    - - - - - - - - - - - -
    -
    + + + + -
    -
    - + + +
    + + + + + + + + + + + + + + + + + + + + + + +
    - -
    -
    - -
    -
    - -
    - Placeholderغطاء الصورة + Placeholderغطاء الصورة
    عنوان البطاقة

    بعض الأمثلة السريعة للنصوص للبناء على عنوان البطاقة وتشكيل الجزء الأكبر من محتوى البطاقة.

    @@ -1240,7 +695,7 @@
    - Placeholderصورة + Placeholderصورة
    @@ -1253,22 +708,7 @@
    - -
    -
    - -
    -
    - - -

    مجموعة العناصر

    دليل الإستخدام
    • عنصر معطل
    • عنصر ثاني
    • @@ -1532,14 +921,7 @@
    • عنصر رابع
    • وعنصر خامس أيضًا
    - -
    -
    - - -
    -
    - +
    • عنصر
    • عنصر ثاني
    • @@ -1547,42 +929,35 @@
    • عنصر رابع
    • وعنصر خامس أيضًا
    - -
    -
    - - -
    -
    - +
    - -
    -
    - - - -

    ترقيم الصفحات

    دليل الإستخدام
    - -
    -
    - - -
    -
    - +
    - -
    -
    - - -
    -
    - +
    - -
    -
    - -
    -
    -

    الصناديق المنبثقة

    دليل الإستخدام
    - -
    -
    - - -
    -
    - +
    @@ -1873,22 +1153,7 @@ - -
    -
    - -
    -
    -

    شريط التقدم

    دليل الإستخدام
    0%
    @@ -1904,14 +1169,7 @@
    100%
    - -
    -
    - - -
    -
    - +
    @@ -1920,143 +1178,88 @@
    - -
    -
    - -
    -
    -
    -
    -

    المخطوطة

    - دليل الإستخدام -
    - -
    -
    - -
    -

    @fat

    -

    محتوى لتوضيح كيف تعمل المخطوطة. ببساطة، المخطوطة عبارة عن منشور طويل يحتوي على عدة أقسام، ولديه شريط تنقل يسهل الوصول إلى هذه الأقسام الفرعية.

    -

    @mdo

    -

    بصرف النظر عن تحسيننا جدوى المكيّفات أو عدم تحسينها، فإن الطلب على الطاقة سيزداد. وطبقاً لما جاء في مقالة معهد ماساشوستس للتكنولوجيا، السالف ذكره، ثمَّة أمر يجب عدم إغفاله، وهو كيف أن هذا الطلب سيضغط على نظم توفير الطاقة الحالية. إذ لا بد من إعادة تأهيل كل شبكات الكهرباء، وتوسيعها لتلبية طلب الطاقة في زمن الذروة، خلال موجات الحرارة المتزايدة. فحين يكون الحر شديداً يجنح الناس إلى البقاء في الداخل، وإلى زيادة تشغيل المكيّفات، سعياً إلى جو لطيف وهم يستخدمون أدوات وأجهزة مختلفة أخرى.

    -

    واحد

    -

    وكل هذه الأمور المتزامنة من تشغيل الأجهزة، يزيد الضغط على شبكات الطاقة، كما أسلفنا. لكن مجرد زيادة سعة الشبكة ليس كافياً. إذ لا بد من تطوير الشبكات الذكية التي تستخدم الجسّاسات، ونظم المراقبة، والبرامج الإلكترونية، لتحديد متى يكون الشاغلون في المبنى، ومتى يكون ثمَّة حاجة إلى الطاقة، ومتى تكون الحرارة منخفضة، وبذلك يخرج الناس، فلا يستخدمون كثيراً من الكهرباء.

    -

    اثنان

    -

    مع الأسف، كل هذه الحلول المبتكرة مكلِّفة، وهذا ما يجعلها عديمة الجدوى في نظر بعض الشركات الخاصة والمواطن المتقشّف. إن بعض الأفراد الواعين بيئياً يبذلون قصارى جهدهم في تقليص استهلاكهم من الطاقة، ويعون جيداً أهمية أجهزة التكييف المجدية والأرفق بالبيئة. ولكن جهات كثيرة لن تتحرّك لمجرد حافز سلامة المناخ ووقف هدر الطاقة، ما دامت لا تحركها حوافز قانونية. وعلى الحكومات أن تُقدِم عند الاهتمام بالتغيّر المناخي، على وضع التشريعات المناسبة. فبالنظم والحوافز والدعم، يمكن دفع الشركات إلى اعتماد الحلول الأجدى في مكاتبها.

    -

    ثلاثة

    -

    وكما يتبيّن لنا، من عدد الحلول الملطِّفة للمشكلة، ومن تنوّعها، وهي الحلول التي أسلفنا الحديث عنها، فإن التكنولوجيا التي نحتاج إليها من أجل معالجة هذه التحديات، هي في مدى قدرتنا، لكنها ربما تتطلّب بعض التحسين، ودعماً استثمارياً أكبر!

    -

    ولا مانع من إضافة محتوى آخر ليس تحت أي قسم معين.

    -
    -
    -
    -
    -

    المخطوطة

    دليل الإستخدام

    @fat

    محتوى لتوضيح كيف تعمل المخطوطة. ببساطة، المخطوطة عبارة عن منشور طويل يحتوي على عدة أقسام، ولديه شريط تنقل يسهل الوصول إلى هذه الأقسام الفرعية.

    @mdo

    بصرف النظر عن تحسيننا جدوى المكيّفات أو عدم تحسينها، فإن الطلب على الطاقة سيزداد. وطبقاً لما جاء في مقالة معهد ماساشوستس للتكنولوجيا، السالف ذكره، ثمَّة أمر يجب عدم إغفاله، وهو كيف أن هذا الطلب سيضغط على نظم توفير الطاقة الحالية. إذ لا بد من إعادة تأهيل كل شبكات الكهرباء، وتوسيعها لتلبية طلب الطاقة في زمن الذروة، خلال موجات الحرارة المتزايدة. فحين يكون الحر شديداً يجنح الناس إلى البقاء في الداخل، وإلى زيادة تشغيل المكيّفات، سعياً إلى جو لطيف وهم يستخدمون أدوات وأجهزة مختلفة أخرى.

    واحد

    وكل هذه الأمور المتزامنة من تشغيل الأجهزة، يزيد الضغط على شبكات الطاقة، كما أسلفنا. لكن مجرد زيادة سعة الشبكة ليس كافياً. إذ لا بد من تطوير الشبكات الذكية التي تستخدم الجسّاسات، ونظم المراقبة، والبرامج الإلكترونية، لتحديد متى يكون الشاغلون في المبنى، ومتى يكون ثمَّة حاجة إلى الطاقة، ومتى تكون الحرارة منخفضة، وبذلك يخرج الناس، فلا يستخدمون كثيراً من الكهرباء.

    اثنان

    مع الأسف، كل هذه الحلول المبتكرة مكلِّفة، وهذا ما يجعلها عديمة الجدوى في نظر بعض الشركات الخاصة والمواطن المتقشّف. إن بعض الأفراد الواعين بيئياً يبذلون قصارى جهدهم في تقليص استهلاكهم من الطاقة، ويعون جيداً أهمية أجهزة التكييف المجدية والأرفق بالبيئة. ولكن جهات كثيرة لن تتحرّك لمجرد حافز سلامة المناخ ووقف هدر الطاقة، ما دامت لا تحركها حوافز قانونية. وعلى الحكومات أن تُقدِم عند الاهتمام بالتغيّر المناخي، على وضع التشريعات المناسبة. فبالنظم والحوافز والدعم، يمكن دفع الشركات إلى اعتماد الحلول الأجدى في مكاتبها.

    ثلاثة

    وكما يتبيّن لنا، من عدد الحلول الملطِّفة للمشكلة، ومن تنوّعها، وهي الحلول التي أسلفنا الحديث عنها، فإن التكنولوجيا التي نحتاج إليها من أجل معالجة هذه التحديات، هي في مدى قدرتنا، لكنها ربما تتطلّب بعض التحسين، ودعماً استثمارياً أكبر!

    ولا مانع من إضافة محتوى آخر ليس تحت أي قسم معين.

    الدوائر المتحركة

    دليل الإستخدام
    جار التحميل...
    + +
    جار التحميل...
    + +
    جار التحميل...
    + +
    جار التحميل...
    + +
    جار التحميل...
    + +
    جار التحميل...
    + +
    جار التحميل...
    + +
    جار التحميل...
    - -
    -
    - - -
    -
    - - +
    جار التحميل...
    + +
    جار التحميل...
    + +
    جار التحميل...
    + +
    جار التحميل...
    + +
    جار التحميل...
    + +
    جار التحميل...
    + +
    جار التحميل...
    + +
    جار التحميل...
    - -
    -
    - -
    -
    -

    الإشعارات

    دليل الإستخدام
    - -
    -
    - -
    -
    -

    التلميحات

    دليل الإستخدام
    - -
    -
    - -
    -
    -
    -
    - - - - - - - - - + \ No newline at end of file diff --git a/docs/5.3/examples/cheatsheet/index.html b/docs/5.3/examples/cheatsheet/index.html index 2a9cb2fac6..317d27e047 100644 --- a/docs/5.3/examples/cheatsheet/index.html +++ b/docs/5.3/examples/cheatsheet/index.html @@ -1,285 +1,28 @@ - - - - - - - - - Cheatsheet · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -

    - Bootstrap - Cheatsheet -

    - RTL cheatsheet -
    -
    - -
    -
    -

    Contents

    - -
    -
    -

    Typography

    - Documentation -
    - -
    -
    -
    - + Cheatsheet · Bootstrap v5.3

    Bootstrap +Cheatsheet +

    RTL cheatsheet

    Contents

    Typography

    Documentation

    Display 1

    Display 2

    Display 3

    Display 4

    Display 5

    -

    Display 6

    - -
    -
    - - -
    -
    - +

    Display 6

    Heading 1

    Heading 2

    Heading 3

    Heading 4

    Heading 5

    -

    Heading 6

    - -
    -
    - - -
    -
    - +

    Heading 6

    This is a lead paragraph. It stands out from regular paragraphs. -

    - -
    -
    - - -
    -
    - +

    You can use the mark tag to highlight text.

    This line of text is meant to be treated as deleted text.

    This line of text is meant to be treated as no longer accurate.

    @@ -287,36 +30,12 @@

    This line of text will render as underlined.

    This line of text is meant to be treated as fine print.

    This line rendered as bold text.

    -

    This line rendered as italicized text.

    - -
    -
    - - -
    -
    - -
    - -
    -
    - - -
    -
    - +

    This line rendered as italicized text.

    +

    A well-known quote, contained in a blockquote element.

    Someone famous in Source Title
    -
    - -
    -
    - - -
    -
    - +
    • This is a list.
    • It appears completely unstyled.
    • @@ -330,274 +49,164 @@
  • This may still come in handy in some situations.
  • - - -
    -
    - - -
    -
    - +
    • This is a list item.
    • And another one.
    • But they're displayed inline.
    • -
    - -
    -
    - -
    -
    -
    -
    -

    Images

    - Documentation -
    - -
    -
    -
    - - PlaceholderResponsive image - -
    -
    - - -
    -
    - - A generic square placeholder image with a white border around it, making it resemble a photograph taken with an old instant camera200x200 - -
    -
    - -
    -
    -
    -
    -

    Tables

    - Documentation -
    - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #FirstLastHandle
    1MarkOtto@mdo
    2JacobThornton@fat
    3JohnDoe@social
    - -
    -
    - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #FirstLastHandle
    1MarkOtto@mdo
    2JacobThornton@fat
    3JohnDoe@social
    - -
    -
    - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ClassHeadingHeading
    DefaultCellCell
    PrimaryCellCell
    SecondaryCellCell
    SuccessCellCell
    DangerCellCell
    WarningCellCell
    InfoCellCell
    LightCellCell
    DarkCellCell
    - -
    -
    - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #FirstLastHandle
    1MarkOtto@mdo
    2JacobThornton@fat
    3JohnDoe@social
    - -
    -
    - -
    -
    -

    Images

    Documentation
    + PlaceholderResponsive image
    + A generic square placeholder image with a white border around it, making it resemble a photograph taken with an old instant camera200x200

    Tables

    Documentation
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    #FirstLastHandle
    1MarkOtto@mdo
    2JacobThornton@fat
    3JohnDoe@social
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    #FirstLastHandle
    1MarkOtto@mdo
    2JacobThornton@fat
    3JohnDoe@social
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ClassHeadingHeading
    DefaultCellCell
    PrimaryCellCell
    SecondaryCellCell
    SuccessCellCell
    DangerCellCell
    WarningCellCell
    InfoCellCell
    LightCellCell
    DarkCellCell
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    #FirstLastHandle
    1MarkOtto@mdo
    2JacobThornton@fat
    3JohnDoe@social

    Figures

    Documentation
    - Placeholder400x300 + Placeholder400x300
    A caption for the above image.
    -
    - -
    -
    - -
    -
    -
    - -
    -

    Forms

    - -

    Forms

    Overview

    Documentation
    @@ -645,23 +254,7 @@
    -
    - -
    -
    - -
    -
    -

    Disabled forms

    Documentation
    @@ -707,23 +300,7 @@
    -
    - -
    -
    - -
    -
    -
    @@ -760,22 +329,7 @@
    - -
    -
    - -
    -
    -

    Input group

    Documentation
    @ @@ -798,22 +352,7 @@ With textarea
    - -
    -
    - -
    -
    -

    Floating labels

    Documentation
    @@ -824,22 +363,7 @@
    - -
    -
    - -
    -
    -

    Validation

    Documentation
    @@ -904,27 +428,7 @@
    - -
    -
    - -
    -
    -
    - -
    -

    Components

    - -

    Components

    -

    Alerts

    Documentation
    + + + + + + + + + + + + + + - -
    -
    - - -
    -
    - +
    - -
    -
    - -
    -
    -

    Example heading New

    Example heading New

    Example heading New

    @@ -1050,39 +530,30 @@

    Example heading New

    Example heading New

    Example heading New

    - -
    -
    - - -
    -
    - - +
    Primary - Secondary - Success - Danger - Warning - Info - Light - Dark -
    -
    -
    -
    - -
    -
    -

    Buttons

    - Documentation -
    + + -
    -
    -
    - - - - - - - - - - + + - - -
    -
    + + + + -
    -
    - - - - - - - - - - - -
    -
    + + + + -
    -
    - - - - - -
    -
    + + +
    + + -
    -
    -
    -
    -

    Button group

    - Documentation -
    + + -
    -
    -
    - + + + + + + + + + + + + + + + + +
    + + + +

    Button group

    Documentation
    - -
    -
    - -
    -
    -
    -
    -

    Card

    - Documentation -
    - -
    -
    -
    - -
    -
    -
    - PlaceholderImage cap -
    -
    Card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    - Go somewhere -
    -
    -
    -
    -
    -
    - Featured -
    -
    -
    Card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    - Go somewhere -
    - -
    -
    -
    -
    -
    -
    Card title
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    -
    -
      -
    • An item
    • -
    • A second item
    • -
    • A third item
    • -
    - -
    -
    -
    -
    -
    -
    - PlaceholderImage +
    +
    +
    +
    + PlaceholderImage cap +
    +
    Card title
    +

    Some quick example text to build on the card title and make up the bulk of the card's content.

    + Go somewhere
    -
    -
    -
    Card title
    -

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    -

    Last updated 3 mins ago

    +
    +
    +
    +
    +
    + Featured +
    +
    +
    Card title
    +

    Some quick example text to build on the card title and make up the bulk of the card's content.

    + Go somewhere +
    + +
    +
    +
    +
    +
    +
    Card title
    +

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +
    +
      +
    • An item
    • +
    • A second item
    • +
    • A third item
    • +
    + +
    +
    +
    +
    +
    +
    + PlaceholderImage +
    +
    +
    +
    Card title
    +

    This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    +

    Last updated 3 mins ago

    +
    -
    - -
    -
    - -
    -
    - - -

    List group

    Documentation
    • A disabled item
    • A second item
    • @@ -1532,14 +903,7 @@
    • A fourth item
    • And a fifth one
    - -
    -
    - - -
    -
    - +
    • An item
    • A second item
    • @@ -1547,42 +911,35 @@
    • A fourth item
    • And a fifth one
    - -
    -
    - - -
    -
    - +
    - -
    -
    - - - -

    Pagination

    Documentation
    - -
    -
    - - -
    -
    - +
    - -
    -
    - - -
    -
    - +
    - -
    -
    - -
    -
    -

    Popovers

    Documentation
    - -
    -
    - - -
    -
    - +
    @@ -1871,22 +1133,7 @@ - -
    -
    - -
    -
    -

    Progress

    Documentation
    0%
    @@ -1902,14 +1149,7 @@
    100%
    - -
    -
    - - -
    -
    - +
    @@ -1918,142 +1158,88 @@
    - -
    -
    - -
    -
    -
    -
    -

    Scrollspy

    - Documentation -
    - -
    -
    - -
    -

    First heading

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Second heading

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Third heading

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Fourth heading

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -

    Fifth heading

    -

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    -
    -
    -
    -
    -

    Scrollspy

    Documentation

    First heading

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Second heading

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Third heading

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Fourth heading

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Fifth heading

    This is some placeholder content for the scrollspy page. Note that as you scroll down the page, the appropriate navigation link is highlighted. It's repeated throughout the component example. We keep adding some more example copy here to emphasize the scrolling and highlighting.

    Spinners

    Documentation
    Loading...
    + +
    Loading...
    + +
    Loading...
    + +
    Loading...
    + +
    Loading...
    + +
    Loading...
    + +
    Loading...
    + +
    Loading...
    - -
    -
    - - -
    -
    - - +
    Loading...
    + +
    Loading...
    + +
    Loading...
    + +
    Loading...
    + +
    Loading...
    + +
    Loading...
    + +
    Loading...
    + +
    Loading...
    - -
    -
    - -
    -
    -

    Toasts

    Documentation
    - -
    -
    - -
    -
    -

    Tooltips

    Documentation
    - -
    -
    - -
    -
    -
    -
    - - - - - - - - - + \ No newline at end of file diff --git a/docs/5.3/examples/checkout-rtl/index.html b/docs/5.3/examples/checkout-rtl/index.html index 7fc115c2a1..0a194b7598 100644 --- a/docs/5.3/examples/checkout-rtl/index.html +++ b/docs/5.3/examples/checkout-rtl/index.html @@ -1,393 +1,32 @@ - - - - - - - - - مثال إتمام الشراء · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    - -

    نموذج إتمام الشراء

    -

    فيما يلي مثال على نموذج تم إنشاؤه بالكامل باستخدام عناصر تحكم النموذج في Bootstrap. لكل مجموعة نماذج مطلوبة حالة تحقق يمكن تشغيلها بمحاولة إرسال النموذج دون استكماله.

    -
    - -
    -
    -

    - عربة التسوق - 3 -

    -
      -
    • -
      -
      اسم المنتج
      - وصف مختصر -
      - $12 -
    • -
    • -
      -
      المنتج الثاني
      - وصف مختصر -
      - $8 -
    • -
    • -
      -
      البند الثالث
      - وصف مختصر -
      - $5 -
    • -
    • -
      -
      رمز ترويجي
      - EXAMPLECODE -
      - -$5 -
    • -
    • - مجموع (USD) - $20 -
    • -
    - -
    -
    - - -
    -
    -
    -
    -

    عنوان الفوترة

    -
    -
    -
    - - -
    - يرجى إدخال اسم أول صحيح. -
    -
    - -
    - - -
    - يرجى إدخال اسم عائلة صحيح. -
    -
    - -
    - -
    - @ - -
    - اسم المستخدم الخاص بك مطلوب. -
    -
    -
    - -
    - - -
    - يرجى إدخال عنوان بريد إلكتروني صحيح لتصلكم تحديثات الشحن. -
    -
    - -
    - - -
    - يرجى إدخال عنوان الشحن الخاص بك. -
    -
    - -
    - - -
    - -
    - - -
    - يرجى اختيار بلد صحيح. -
    -
    - -
    - - -
    - يرجى اختيار اسم منطقة صحيح. -
    -
    - -
    - - -
    - الرمز البريدي مطلوب. -
    -
    -
    - -
    - -
    - - -
    - -
    - - -
    - -
    - -

    طريقة الدفع

    - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - -
    -
    - - - الاسم الكامل كما هو معروض على البطاقة -
    - الاسم على البطاقة مطلوب -
    -
    - -
    - - -
    - رقم بطاقة الائتمان مطلوب -
    -
    - -
    - - -
    - تاريخ انتهاء الصلاحية مطلوب -
    -
    - -
    - - -
    - رمز الحماية مطلوب -
    -
    -
    - -
    - - -
    -
    -
    -
    - -
    - - - - + مثال إتمام الشراء · Bootstrap v5.3

    نموذج إتمام الشراء

    فيما يلي مثال على نموذج تم إنشاؤه بالكامل باستخدام عناصر تحكم النموذج في Bootstrap. لكل مجموعة نماذج مطلوبة حالة تحقق يمكن تشغيلها بمحاولة إرسال النموذج دون استكماله.

    عربة التسوق 3

    • اسم المنتج
      وصف مختصر
      $12
    • المنتج الثاني
      وصف مختصر
      $8
    • البند الثالث
      وصف مختصر
      $5
    • رمز ترويجي
      EXAMPLECODE
      -$5
    • مجموع (USD) $20

    عنوان الفوترة

    +يرجى إدخال اسم أول صحيح. +
    +يرجى إدخال اسم عائلة صحيح. +
    @
    +اسم المستخدم الخاص بك مطلوب. +
    +يرجى إدخال عنوان بريد إلكتروني صحيح لتصلكم تحديثات الشحن. +
    +يرجى إدخال عنوان الشحن الخاص بك. +
    +يرجى اختيار بلد صحيح. +
    +يرجى اختيار اسم منطقة صحيح. +
    +الرمز البريدي مطلوب. +


    طريقة الدفع

    الاسم الكامل كما هو معروض على البطاقة
    +الاسم على البطاقة مطلوب +
    +رقم بطاقة الائتمان مطلوب +
    +تاريخ انتهاء الصلاحية مطلوب +
    +رمز الحماية مطلوب +

    \ No newline at end of file diff --git a/docs/5.3/examples/checkout/index.html b/docs/5.3/examples/checkout/index.html index 6acc4bc030..5741c26e6e 100644 --- a/docs/5.3/examples/checkout/index.html +++ b/docs/5.3/examples/checkout/index.html @@ -1,394 +1,32 @@ - - - - - - - - - Checkout example · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    - -

    Checkout form

    -

    Below is an example form built entirely with Bootstrap’s form controls. Each required form group has a validation state that can be triggered by attempting to submit the form without completing it.

    -
    - -
    -
    -

    - Your cart - 3 -

    -
      -
    • -
      -
      Product name
      - Brief description -
      - $12 -
    • -
    • -
      -
      Second product
      - Brief description -
      - $8 -
    • -
    • -
      -
      Third item
      - Brief description -
      - $5 -
    • -
    • -
      -
      Promo code
      - EXAMPLECODE -
      - −$5 -
    • -
    • - Total (USD) - $20 -
    • -
    - -
    -
    - - -
    -
    -
    -
    -

    Billing address

    -
    -
    -
    - - -
    - Valid first name is required. -
    -
    - -
    - - -
    - Valid last name is required. -
    -
    - -
    - -
    - @ - -
    - Your username is required. -
    -
    -
    - -
    - - -
    - Please enter a valid email address for shipping updates. -
    -
    - -
    - - -
    - Please enter your shipping address. -
    -
    - -
    - - -
    - -
    - - -
    - Please select a valid country. -
    -
    - -
    - - -
    - Please provide a valid state. -
    -
    - -
    - - -
    - Zip code required. -
    -
    -
    - -
    - -
    - - -
    - -
    - - -
    - -
    - -

    Payment

    - -
    -
    - - -
    -
    - - -
    -
    - - -
    -
    - -
    -
    - - - Full name as displayed on card -
    - Name on card is required -
    -
    - -
    - - -
    - Credit card number is required -
    -
    - -
    - - -
    - Expiration date required -
    -
    - -
    - - -
    - Security code required -
    -
    -
    - -
    - - -
    -
    -
    -
    - - -
    - - - - + Checkout example · Bootstrap v5.3

    Checkout form

    Below is an example form built entirely with Bootstrap’s form controls. Each required form group has a validation state that can be triggered by attempting to submit the form without completing it.

    Your cart 3

    • Product name
      Brief description
      $12
    • Second product
      Brief description
      $8
    • Third item
      Brief description
      $5
    • Promo code
      EXAMPLECODE
      −$5
    • Total (USD) $20

    Billing address

    +Valid first name is required. +
    +Valid last name is required. +
    @
    +Your username is required. +
    +Please enter a valid email address for shipping updates. +
    +Please enter your shipping address. +
    +Please select a valid country. +
    +Please provide a valid state. +
    +Zip code required. +


    Payment

    Full name as displayed on card
    +Name on card is required +
    +Credit card number is required +
    +Expiration date required +
    +Security code required +

    \ No newline at end of file diff --git a/docs/5.3/examples/cover/index.html b/docs/5.3/examples/cover/index.html index cc10459a85..97d0c856f9 100644 --- a/docs/5.3/examples/cover/index.html +++ b/docs/5.3/examples/cover/index.html @@ -1,196 +1,8 @@ - - - - - - - - - Cover Template · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    -

    Cover

    - -
    -
    - -
    -

    Cover your page.

    -

    Cover is a one-page template for building simple and beautiful home pages. Download, edit the text, and add your own fullscreen background photo to make it your own.

    -

    - Learn more -

    -
    - - -
    - - - - + Cover Template · Bootstrap v5.3

    Cover your page.

    Cover is a one-page template for building simple and beautiful home pages. Download, edit the text, and add your own fullscreen background photo to make it your own.

    Learn more

    \ No newline at end of file diff --git a/docs/5.3/examples/dashboard-rtl/index.html b/docs/5.3/examples/dashboard-rtl/index.html index 7071720bfe..319343fc81 100644 --- a/docs/5.3/examples/dashboard-rtl/index.html +++ b/docs/5.3/examples/dashboard-rtl/index.html @@ -1,492 +1,34 @@ - - - - - - - - - قالب لوحة القيادة · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - -
    -
    -

    لوحة القيادة

    -
    -
    - - -
    - -
    -
    - - - -

    عنوان القسم

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #عنوانعنوانعنوانعنوان
    1,001بياناتعشوائيةتثريالجدول
    1,002تثريمبهةتصميمتنسيق
    1,003عشوائيةغنيةقيمةمفيدة
    1,003معلوماتتثريتوضيحيةعشوائية
    1,004الجدولبياناتتنسيققيمة
    1,005قيمةمبهةالجدولتثري
    1,006قيمةتوضيحيةغنيةعشوائية
    1,007تثريمفيدةمعلوماتمبهة
    1,008بياناتعشوائيةتثريالجدول
    1,009تثريمبهةتصميمتنسيق
    1,010عشوائيةغنيةقيمةمفيدة
    1,011معلوماتتثريتوضيحيةعشوائية
    1,012الجدولتثريتنسيققيمة
    1,013قيمةمبهةالجدولتصميم
    1,014قيمةتوضيحيةغنيةعشوائية
    1,015بياناتمفيدةمعلوماتالجدول
    -
    -
    -
    -
    - - - - + قالب لوحة القيادة · Bootstrap v5.3

    لوحة القيادة

    عنوان القسم

    # عنوان عنوان عنوان عنوان
    1,001 بيانات عشوائية تثري الجدول
    1,002 تثري مبهة تصميم تنسيق
    1,003 عشوائية غنية قيمة مفيدة
    1,003 معلومات تثري توضيحية عشوائية
    1,004 الجدول بيانات تنسيق قيمة
    1,005 قيمة مبهة الجدول تثري
    1,006 قيمة توضيحية غنية عشوائية
    1,007 تثري مفيدة معلومات مبهة
    1,008 بيانات عشوائية تثري الجدول
    1,009 تثري مبهة تصميم تنسيق
    1,010 عشوائية غنية قيمة مفيدة
    1,011 معلومات تثري توضيحية عشوائية
    1,012 الجدول تثري تنسيق قيمة
    1,013 قيمة مبهة الجدول تصميم
    1,014 قيمة توضيحية غنية عشوائية
    1,015 بيانات مفيدة معلومات الجدول
    \ No newline at end of file diff --git a/docs/5.3/examples/dashboard/index.html b/docs/5.3/examples/dashboard/index.html index 6778402e4b..280553a079 100644 --- a/docs/5.3/examples/dashboard/index.html +++ b/docs/5.3/examples/dashboard/index.html @@ -1,492 +1,34 @@ - - - - - - - - - Dashboard Template · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - -
    -
    -

    Dashboard

    -
    -
    - - -
    - -
    -
    - - - -

    Section title

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    #HeaderHeaderHeaderHeader
    1,001randomdataplaceholdertext
    1,002placeholderirrelevantvisuallayout
    1,003datarichdashboardtabular
    1,003informationplaceholderillustrativedata
    1,004textrandomlayoutdashboard
    1,005dashboardirrelevanttextplaceholder
    1,006dashboardillustrativerichdata
    1,007placeholdertabularinformationirrelevant
    1,008randomdataplaceholdertext
    1,009placeholderirrelevantvisuallayout
    1,010datarichdashboardtabular
    1,011informationplaceholderillustrativedata
    1,012textplaceholderlayoutdashboard
    1,013dashboardirrelevanttextvisual
    1,014dashboardillustrativerichdata
    1,015randomtabularinformationtext
    -
    -
    -
    -
    - - - - + Dashboard Template · Bootstrap v5.3

    Dashboard

    Section title

    # Header Header Header Header
    1,001 random data placeholder text
    1,002 placeholder irrelevant visual layout
    1,003 data rich dashboard tabular
    1,003 information placeholder illustrative data
    1,004 text random layout dashboard
    1,005 dashboard irrelevant text placeholder
    1,006 dashboard illustrative rich data
    1,007 placeholder tabular information irrelevant
    1,008 random data placeholder text
    1,009 placeholder irrelevant visual layout
    1,010 data rich dashboard tabular
    1,011 information placeholder illustrative data
    1,012 text placeholder layout dashboard
    1,013 dashboard irrelevant text visual
    1,014 dashboard illustrative rich data
    1,015 random tabular information text
    \ No newline at end of file diff --git a/docs/5.3/examples/dropdowns/index.html b/docs/5.3/examples/dropdowns/index.html index d96274dde1..32eeb9d5b8 100644 --- a/docs/5.3/examples/dropdowns/index.html +++ b/docs/5.3/examples/dropdowns/index.html @@ -1,626 +1,48 @@ - - - - - - - - - Dropdowns · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - - - -
    - -
    - - - -
    - -
    - - - - - - + Dropdowns · Bootstrap v5.3
    \ No newline at end of file diff --git a/docs/5.3/examples/features/index.html b/docs/5.3/examples/features/index.html index 259f5d73c4..8ca960ab09 100644 --- a/docs/5.3/examples/features/index.html +++ b/docs/5.3/examples/features/index.html @@ -1,504 +1,20 @@ - - - - - - - - - Features · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Bootstrap - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    Features examples

    - - - -
    - -
    -

    Hanging icons

    -
    -
    -
    - -
    -
    -

    Featured title

    -

    Paragraph of text beneath the heading to explain the heading. We'll add onto it with another sentence and probably just keep going until we run out of words.

    - - Primary button - -
    -
    -
    -
    - -
    -
    -

    Featured title

    -

    Paragraph of text beneath the heading to explain the heading. We'll add onto it with another sentence and probably just keep going until we run out of words.

    - - Primary button - -
    -
    -
    -
    - -
    -
    -

    Featured title

    -

    Paragraph of text beneath the heading to explain the heading. We'll add onto it with another sentence and probably just keep going until we run out of words.

    - - Primary button - -
    -
    -
    -
    - -
    - -
    -

    Custom cards

    - -
    -
    -
    -
    -

    Short title, long jacket

    -
      -
    • - Bootstrap -
    • -
    • - - Earth -
    • -
    • - - 3d -
    • -
    -
    -
    -
    - -
    -
    -
    -

    Much longer title that wraps to multiple lines

    -
      -
    • - Bootstrap -
    • -
    • - - Pakistan -
    • -
    • - - 4d -
    • -
    -
    -
    -
    - -
    -
    -
    -

    Another longer title belongs here

    -
      -
    • - Bootstrap -
    • -
    • - - California -
    • -
    • - - 5d -
    • -
    -
    -
    -
    -
    -
    - -
    - -
    -

    Icon grid

    - -
    -
    - -
    -

    Featured title

    -

    Paragraph of text beneath the heading to explain the heading.

    -
    -
    -
    - -
    -

    Featured title

    -

    Paragraph of text beneath the heading to explain the heading.

    -
    -
    -
    - -
    -

    Featured title

    -

    Paragraph of text beneath the heading to explain the heading.

    -
    -
    -
    - -
    -

    Featured title

    -

    Paragraph of text beneath the heading to explain the heading.

    -
    -
    -
    - -
    -

    Featured title

    -

    Paragraph of text beneath the heading to explain the heading.

    -
    -
    -
    - -
    -

    Featured title

    -

    Paragraph of text beneath the heading to explain the heading.

    -
    -
    -
    - -
    -

    Featured title

    -

    Paragraph of text beneath the heading to explain the heading.

    -
    -
    -
    - -
    -

    Featured title

    -

    Paragraph of text beneath the heading to explain the heading.

    -
    -
    -
    -
    - -
    - -
    -

    Features with title

    - -
    -
    -

    Left-aligned title explaining these awesome features

    -

    Paragraph of text beneath the heading to explain the heading. We'll add onto it with another sentence and probably just keep going until we run out of words.

    - Primary button -
    - -
    -
    -
    -
    - -
    -

    Featured title

    -

    Paragraph of text beneath the heading to explain the heading.

    -
    - -
    -
    - -
    -

    Featured title

    -

    Paragraph of text beneath the heading to explain the heading.

    -
    - -
    -
    - -
    -

    Featured title

    -

    Paragraph of text beneath the heading to explain the heading.

    -
    - -
    -
    - -
    -

    Featured title

    -

    Paragraph of text beneath the heading to explain the heading.

    -
    -
    -
    -
    -
    -
    - - - - + Features · Bootstrap v5.3 Bootstrap

    Features examples

    Hanging icons

    Featured title

    Paragraph of text beneath the heading to explain the heading. We'll add onto it with another sentence and probably just keep going until we run out of words.

    +Primary button +

    Featured title

    Paragraph of text beneath the heading to explain the heading. We'll add onto it with another sentence and probably just keep going until we run out of words.

    +Primary button +

    Featured title

    Paragraph of text beneath the heading to explain the heading. We'll add onto it with another sentence and probably just keep going until we run out of words.

    +Primary button +

    Custom cards

    Short title, long jacket

    • Bootstrap
    • Earth
    • 3d

    Much longer title that wraps to multiple lines

    • Bootstrap
    • Pakistan
    • 4d

    Another longer title belongs here

    • Bootstrap
    • California
    • 5d

    Icon grid

    Featured title

    Paragraph of text beneath the heading to explain the heading.

    Featured title

    Paragraph of text beneath the heading to explain the heading.

    Featured title

    Paragraph of text beneath the heading to explain the heading.

    Featured title

    Paragraph of text beneath the heading to explain the heading.

    Featured title

    Paragraph of text beneath the heading to explain the heading.

    Featured title

    Paragraph of text beneath the heading to explain the heading.

    Featured title

    Paragraph of text beneath the heading to explain the heading.

    Featured title

    Paragraph of text beneath the heading to explain the heading.

    Features with title

    Left-aligned title explaining these awesome features

    Paragraph of text beneath the heading to explain the heading. We'll add onto it with another sentence and probably just keep going until we run out of words.

    Primary button

    Featured title

    Paragraph of text beneath the heading to explain the heading.

    Featured title

    Paragraph of text beneath the heading to explain the heading.

    Featured title

    Paragraph of text beneath the heading to explain the heading.

    Featured title

    Paragraph of text beneath the heading to explain the heading.

    \ No newline at end of file diff --git a/docs/5.3/examples/footers/index.html b/docs/5.3/examples/footers/index.html index e0ff14178f..7ef15b8a24 100644 --- a/docs/5.3/examples/footers/index.html +++ b/docs/5.3/examples/footers/index.html @@ -1,346 +1,8 @@ - - - - - - - - - Footers · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Bootstrap - - - - - - - - - - -
    - -
    - -
    - -
    -
    -
    - - - - © 2025 Company, Inc -
    - - -
    -
    - -
    - -
    - -
    - -
    - -
    - -
    - -
    - - -
    - -
    - - - - + Footers · Bootstrap v5.3 Bootstrap
    © 2025 Company, Inc
    \ No newline at end of file diff --git a/docs/5.3/examples/grid/index.html b/docs/5.3/examples/grid/index.html index df6e240496..30d7679baa 100644 --- a/docs/5.3/examples/grid/index.html +++ b/docs/5.3/examples/grid/index.html @@ -1,351 +1,12 @@ - - - - - - - - - Grid Template · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - -

    Bootstrap grid examples

    -

    Basic grid layouts to get you familiar with building within the Bootstrap grid system.

    -

    In these examples the .themed-grid-col class is added to the columns to add some theming. This is not a class that is available in Bootstrap by default.

    - -

    Five grid tiers

    -

    There are five tiers to the Bootstrap grid system, one for each range of devices we support. Each tier starts at a minimum viewport size and automatically applies to the larger devices unless overridden.

    - -
    -
    .col-4
    -
    .col-4
    -
    .col-4
    -
    - -
    -
    .col-sm-4
    -
    .col-sm-4
    -
    .col-sm-4
    -
    - -
    -
    .col-md-4
    -
    .col-md-4
    -
    .col-md-4
    -
    - -
    -
    .col-lg-4
    -
    .col-lg-4
    -
    .col-lg-4
    -
    - -
    -
    .col-xl-4
    -
    .col-xl-4
    -
    .col-xl-4
    -
    - -
    -
    .col-xxl-4
    -
    .col-xxl-4
    -
    .col-xxl-4
    -
    - -

    Three equal columns

    -

    Get three equal-width columns starting at desktops and scaling to large desktops. On mobile devices, tablets and below, the columns will automatically stack.

    -
    -
    .col-md-4
    -
    .col-md-4
    -
    .col-md-4
    -
    - -

    Three equal columns alternative

    -

    By using the .row-cols-* classes, you can easily create a grid with equal columns.

    -
    -
    .col child of .row-cols-md-3
    -
    .col child of .row-cols-md-3
    -
    .col child of .row-cols-md-3
    -
    - -

    Three unequal columns

    -

    Get three columns starting at desktops and scaling to large desktops of various widths. Remember, grid columns should add up to twelve for a single horizontal block. More than that, and columns start stacking no matter the viewport.

    -
    -
    .col-md-3
    -
    .col-md-6
    -
    .col-md-3
    -
    - -

    Two columns

    -

    Get two columns starting at desktops and scaling to large desktops.

    -
    -
    .col-md-8
    -
    .col-md-4
    -
    - -

    Full width, single column

    -

    - No grid classes are necessary for full-width elements. -

    - -
    - -

    Two columns with two nested columns

    -

    Per the documentation, nesting is easy—just put a row of columns within an existing column. This gives you two columns starting at desktops and scaling to large desktops, with another two (equal widths) within the larger column.

    -

    At mobile device sizes, tablets and down, these columns and their nested columns will stack.

    -
    -
    -
    - .col-md-8 -
    -
    -
    .col-md-6
    -
    .col-md-6
    -
    -
    -
    .col-md-4
    -
    - -
    - -

    Mixed: mobile and desktop

    -

    The Bootstrap v5 grid system has six tiers of classes: xs (extra small, this class infix is not used), sm (small), md (medium), lg (large), xl (x-large), and xxl (xx-large). You can use nearly any combination of these classes to create more dynamic and flexible layouts.

    -

    Each tier of classes scales up, meaning if you plan on setting the same widths for md, lg, xl and xxl, you only need to specify md.

    -
    -
    .col-md-8
    -
    .col-6 .col-md-4
    -
    -
    -
    .col-6 .col-md-4
    -
    .col-6 .col-md-4
    -
    .col-6 .col-md-4
    -
    -
    -
    .col-6
    -
    .col-6
    -
    - -
    - -

    Mixed: mobile, tablet, and desktop

    -
    -
    .col-sm-6 .col-lg-8
    -
    .col-6 .col-lg-4
    -
    -
    -
    .col-6 .col-sm-4
    -
    .col-6 .col-sm-4
    -
    .col-6 .col-sm-4
    -
    - -
    - -

    Gutters

    -

    With .gx-* classes, the horizontal gutters can be adjusted.

    -
    -
    .col with .gx-4 gutters
    -
    .col with .gx-4 gutters
    -
    .col with .gx-4 gutters
    -
    .col with .gx-4 gutters
    -
    .col with .gx-4 gutters
    -
    .col with .gx-4 gutters
    -
    -

    Use the .gy-* classes to control the vertical gutters.

    -
    -
    .col with .gy-4 gutters
    -
    .col with .gy-4 gutters
    -
    .col with .gy-4 gutters
    -
    .col with .gy-4 gutters
    -
    .col with .gy-4 gutters
    -
    .col with .gy-4 gutters
    -
    -

    With .g-* classes, the gutters in both directions can be adjusted.

    -
    -
    .col with .g-3 gutters
    -
    .col with .g-3 gutters
    -
    .col with .g-3 gutters
    -
    .col with .g-3 gutters
    -
    .col with .g-3 gutters
    -
    .col with .g-3 gutters
    -
    -
    - -
    -
    - -

    Containers

    -

    Additional classes added in Bootstrap v4.4 allow containers that are 100% wide until a particular breakpoint. v5 adds a new xxl breakpoint.

    -
    - -
    .container
    -
    .container-sm
    -
    .container-md
    -
    .container-lg
    -
    .container-xl
    -
    .container-xxl
    -
    .container-fluid
    -
    - - - - + Grid Template · Bootstrap v5.3

    Bootstrap grid examples

    Basic grid layouts to get you familiar with building within the Bootstrap grid system.

    In these examples the .themed-grid-col class is added to the columns to add some theming. This is not a class that is available in Bootstrap by default.

    Five grid tiers

    There are five tiers to the Bootstrap grid system, one for each range of devices we support. Each tier starts at a minimum viewport size and automatically applies to the larger devices unless overridden.

    .col-4
    .col-4
    .col-4
    .col-sm-4
    .col-sm-4
    .col-sm-4
    .col-md-4
    .col-md-4
    .col-md-4
    .col-lg-4
    .col-lg-4
    .col-lg-4
    .col-xl-4
    .col-xl-4
    .col-xl-4
    .col-xxl-4
    .col-xxl-4
    .col-xxl-4

    Three equal columns

    Get three equal-width columns starting at desktops and scaling to large desktops. On mobile devices, tablets and below, the columns will automatically stack.

    .col-md-4
    .col-md-4
    .col-md-4

    Three equal columns alternative

    By using the .row-cols-* classes, you can easily create a grid with equal columns.

    .col child of .row-cols-md-3
    .col child of .row-cols-md-3
    .col child of .row-cols-md-3

    Three unequal columns

    Get three columns starting at desktops and scaling to large desktops of various widths. Remember, grid columns should add up to twelve for a single horizontal block. More than that, and columns start stacking no matter the viewport.

    .col-md-3
    .col-md-6
    .col-md-3

    Two columns

    Get two columns starting at desktops and scaling to large desktops.

    .col-md-8
    .col-md-4

    Full width, single column

    +No grid classes are necessary for full-width elements. +


    Two columns with two nested columns

    Per the documentation, nesting is easy—just put a row of columns within an existing column. This gives you two columns starting at desktops and scaling to large desktops, with another two (equal widths) within the larger column.

    At mobile device sizes, tablets and down, these columns and their nested columns will stack.

    +.col-md-8 +
    .col-md-6
    .col-md-6
    .col-md-4

    Mixed: mobile and desktop

    The Bootstrap v5 grid system has six tiers of classes: xs (extra small, this class infix is not used), sm (small), md (medium), lg (large), xl (x-large), and xxl (xx-large). You can use nearly any combination of these classes to create more dynamic and flexible layouts.

    Each tier of classes scales up, meaning if you plan on setting the same widths for md, lg, xl and xxl, you only need to specify md.

    .col-md-8
    .col-6 .col-md-4
    .col-6 .col-md-4
    .col-6 .col-md-4
    .col-6 .col-md-4
    .col-6
    .col-6

    Mixed: mobile, tablet, and desktop

    .col-sm-6 .col-lg-8
    .col-6 .col-lg-4
    .col-6 .col-sm-4
    .col-6 .col-sm-4
    .col-6 .col-sm-4

    Gutters

    With .gx-* classes, the horizontal gutters can be adjusted.

    .col with .gx-4 gutters
    .col with .gx-4 gutters
    .col with .gx-4 gutters
    .col with .gx-4 gutters
    .col with .gx-4 gutters
    .col with .gx-4 gutters

    Use the .gy-* classes to control the vertical gutters.

    .col with .gy-4 gutters
    .col with .gy-4 gutters
    .col with .gy-4 gutters
    .col with .gy-4 gutters
    .col with .gy-4 gutters
    .col with .gy-4 gutters

    With .g-* classes, the gutters in both directions can be adjusted.

    .col with .g-3 gutters
    .col with .g-3 gutters
    .col with .g-3 gutters
    .col with .g-3 gutters
    .col with .g-3 gutters
    .col with .g-3 gutters

    Containers

    Additional classes added in Bootstrap v4.4 allow containers that are 100% wide until a particular breakpoint. v5 adds a new xxl breakpoint.

    .container
    .container-sm
    .container-md
    .container-lg
    .container-xl
    .container-xxl
    .container-fluid
    \ No newline at end of file diff --git a/docs/5.3/examples/headers/index.html b/docs/5.3/examples/headers/index.html index 04951d6b20..9302838e2f 100644 --- a/docs/5.3/examples/headers/index.html +++ b/docs/5.3/examples/headers/index.html @@ -1,461 +1,18 @@ - - - - - - - - - Headers · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Bootstrap - - - - - - - - - - - - - - - - - - - - - -
    -

    Headers examples

    - - - -
    - -
    -
    - -
    -
    - -
    - -
    -
    -
    - - - -
    - - - -
    - - -
    -
    -
    - -
    - -
    -
    -
    - - - - - - - - -
    - - -
    -
    -
    -
    - -
    - -
    -
    -
    - - - - - - - - - -
    -
    -
    - -
    - -
    -
    - - -
    - - - -
    -
    -
    - -
    -
    -
    -









    -
    -
    -









    -
    -
    -
    - -
    - - -
    - -
    - -
    - -
    - -
    -
    - - -
    - - -
    -
    -
    -
    - -
    -
    - - - - + Headers · Bootstrap v5.3 Bootstrap

    Headers examples





















    \ No newline at end of file diff --git a/docs/5.3/examples/heroes/index.html b/docs/5.3/examples/heroes/index.html index d685624718..25140006e1 100644 --- a/docs/5.3/examples/heroes/index.html +++ b/docs/5.3/examples/heroes/index.html @@ -1,289 +1,9 @@ - - - - - - - - - Heroes · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    Heroes examples

    - -
    - -

    Centered hero

    -
    -

    Quickly design and customize responsive mobile-first sites with Bootstrap, the world’s most popular front-end open source toolkit, featuring Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful JavaScript plugins.

    -
    - - -
    -
    -
    - -
    - -
    -

    Centered screenshot

    -
    -

    Quickly design and customize responsive mobile-first sites with Bootstrap, the world’s most popular front-end open source toolkit, featuring Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful JavaScript plugins.

    -
    - - -
    -
    -
    -
    - Example image -
    -
    -
    - -
    - -
    -
    -
    - Bootstrap Themes -
    -
    -

    Responsive left-aligned hero with image

    -

    Quickly design and customize responsive mobile-first sites with Bootstrap, the world’s most popular front-end open source toolkit, featuring Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful JavaScript plugins.

    -
    - - -
    -
    -
    -
    - -
    - -
    -
    -
    -

    Vertically centered hero sign-up form

    -

    Below is an example form built entirely with Bootstrap’s form controls. Each required form group has a validation state that can be triggered by attempting to submit the form without completing it.

    -
    -
    -
    -
    - - -
    -
    - - -
    -
    - -
    - -
    - By clicking Sign up, you agree to the terms of use. -
    -
    -
    -
    - -
    - -
    -
    -
    -

    Border hero with cropped image and shadows

    -

    Quickly design and customize responsive mobile-first sites with Bootstrap, the world’s most popular front-end open source toolkit, featuring Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful JavaScript plugins.

    -
    - - -
    -
    -
    - -
    -
    -
    - -
    - -
    -
    -

    Dark color hero

    -
    -

    Quickly design and customize responsive mobile-first sites with Bootstrap, the world’s most popular front-end open source toolkit, featuring Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful JavaScript plugins.

    -
    - - -
    -
    -
    -
    - -
    -
    - - - - + Heroes · Bootstrap v5.3

    Heroes examples

    Centered hero

    Quickly design and customize responsive mobile-first sites with Bootstrap, the world’s most popular front-end open source toolkit, featuring Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful JavaScript plugins.

    Centered screenshot

    Quickly design and customize responsive mobile-first sites with Bootstrap, the world’s most popular front-end open source toolkit, featuring Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful JavaScript plugins.

    Example image
    Bootstrap Themes

    Responsive left-aligned hero with image

    Quickly design and customize responsive mobile-first sites with Bootstrap, the world’s most popular front-end open source toolkit, featuring Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful JavaScript plugins.

    Vertically centered hero sign-up form

    Below is an example form built entirely with Bootstrap’s form controls. Each required form group has a validation state that can be triggered by attempting to submit the form without completing it.


    By clicking Sign up, you agree to the terms of use.

    Border hero with cropped image and shadows

    Quickly design and customize responsive mobile-first sites with Bootstrap, the world’s most popular front-end open source toolkit, featuring Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful JavaScript plugins.

    Dark color hero

    Quickly design and customize responsive mobile-first sites with Bootstrap, the world’s most popular front-end open source toolkit, featuring Sass variables and mixins, responsive grid system, extensive prebuilt components, and powerful JavaScript plugins.

    \ No newline at end of file diff --git a/docs/5.3/examples/index.html b/docs/5.3/examples/index.html index a8e8003e3c..d2d8b1e69c 100644 --- a/docs/5.3/examples/index.html +++ b/docs/5.3/examples/index.html @@ -1,1287 +1,28 @@ - - - - - - - - - - - - - - - - -Examples · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    -

    Examples

    -

    Quickly get a project started with any of our examples ranging from using parts of the framework to custom components and layouts.

    - -
    -
    - - -
    -
    -
    -
    - -
    -
    - - -
    -

    Starters

    -

    Functional examples of using Bootstrap in common JS frameworks like Webpack, Parcel, Vite, and more you can edit in StackBlitz.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -

    Snippets

    -

    Common patterns for building sites and apps that build on existing components and utilities with custom CSS and more.

    -
    -
    - - -

    - Headers -

    -
    -

    Display your branding, navigation, search, and more with these header components

    -
    - -
    - - -

    - Heroes -

    -
    -

    Set the stage on your homepage with heroes that feature clear calls to action.

    -
    - -
    - - -

    - Features -

    -
    -

    Explain the features, benefits, or other details in your marketing content.

    -
    - - - - - - - - - -
    - - -

    - Modals -

    -
    -

    Transform modals to serve any purpose, from feature tours to dialogs.

    -
    - - - - - - - - -
    -
    -

    Custom Components

    -

    Brand-new components and templates to help folks quickly get started with Bootstrap and demonstrate best practices for adding onto the framework.

    -
    -
    - - -

    - Album -

    -
    -

    Simple one-page template for photo galleries, portfolios, and more.

    -
    - -
    - - -

    - Pricing -

    -
    -

    Example pricing page built with Cards and featuring a custom header and footer.

    -
    - -
    - - -

    - Checkout -

    -
    -

    Custom checkout form showing our form components and their validation features.

    -
    - -
    - - -

    - Product -

    -
    -

    Lean product-focused marketing page with extensive grid and image work.

    -
    - -
    - - -

    - Cover -

    -
    -

    A one-page template for building simple and beautiful home pages.

    -
    - - - -
    - - -

    - Blog -

    -
    -

    Magazine like blog template with header, navigation, featured content.

    -
    - - - - - - - - - - -
    -
    -

    Framework

    -

    Examples that focus on implementing uses of built-in components provided by Bootstrap.

    -
    - - -
    - - -

    - Grid -

    -
    -

    Multiple examples of grid layouts with all four tiers, nesting, and more.

    -
    - - - - -
    -
    - -

    Taking the default navbar component and showing how it can be moved, placed, and extended.

    -
    -
    - - -

    - Navbars -

    -
    -

    Demonstration of all responsive and container options for the navbar.

    -
    - - - - - - - - - - -
    -
    -

    RTL

    -

    See Bootstrap's RTL version in action with these modified Custom Components examples.

    -
    -

    - RTL is still experimental and will evolve with feedback. Spotted something or have an improvement to suggest? -

    -

    Please open an issue.

    -
    -
    - - - - - - - - - -
    -
    -

    Integrations

    -

    Integrations with external libraries.

    -
    - -
    - -
    -
    -
    -
    - - -
    -

    Go further with Bootstrap Themes

    -

    - Need something more than these examples? Take Bootstrap to the next level with premium themes from the official Bootstrap Themes marketplace. They’re built as their own extended frameworks, rich with new components and plugins, documentation, and powerful build tools. -

    - Browse themes -
    - -Bootstrap Themes - -
    - -
    -
    - - - - - - - - - - - - - + Examples · Bootstrap v5.3

    Examples

    Quickly get a project started with any of our examples ranging from using parts of the framework to custom components and layouts.

    Starters

    Functional examples of using Bootstrap in common JS frameworks like Webpack, Parcel, Vite, and more you can edit in StackBlitz.

    Sass & JS

    Use npm to import and compile Bootstrap's Sass with Autoprefixer and Stylelint, plus our bundled JavaScript.

    Edit in StackBlitz

    React

    Import and bundle Bootstrap's source Sass and JavaScript with React, Next.js, and React Bootstrap.

    Edit in StackBlitz

    Snippets

    Common patterns for building sites and apps that build on existing components and utilities with custom CSS and more.

    Headers

    Display your branding, navigation, search, and more with these header components

    Heroes

    Set the stage on your homepage with heroes that feature clear calls to action.

    Features

    Explain the features, benefits, or other details in your marketing content.

    Sidebars

    Common navigation patterns ideal for offcanvas or multi-column layouts.

    Footers

    Finish every page strong with an awesome footer, big or small.

    Dropdowns

    Enhance your dropdowns with filters, icons, custom styles, and more.

    List groups

    Extend list groups with utilities and custom styles for any content.

    Modals

    Transform modals to serve any purpose, from feature tours to dialogs.

    Badges

    Make badges work with custom inner HTML and new looks.

    Breadcrumbs

    Integrate custom icons and create stepper components.

    Buttons

    Create custom buttons for just about any use case with utilities.

    Jumbotrons

    Create modernized versions of the classic Bootstrap component.

    Custom Components

    Brand-new components and templates to help folks quickly get started with Bootstrap and demonstrate best practices for adding onto the framework.

    Album

    Simple one-page template for photo galleries, portfolios, and more.

    Pricing

    Example pricing page built with Cards and featuring a custom header and footer.

    Checkout

    Custom checkout form showing our form components and their validation features.

    Product

    Lean product-focused marketing page with extensive grid and image work.

    Cover

    A one-page template for building simple and beautiful home pages.

    Carousel

    Customize the navbar and carousel, then add some new components.

    Blog

    Magazine like blog template with header, navigation, featured content.

    Dashboard

    Basic admin dashboard shell with fixed sidebar and navbar.

    Sign-in

    Custom form layout and design for a simple sign in form.

    Sticky footer

    Attach a footer to the bottom of the viewport when page content is short.

    Jumbotron

    Use utilities to recreate and enhance Bootstrap 4's jumbotron.

    Framework

    Examples that focus on implementing uses of built-in components provided by Bootstrap.

    Grid

    Multiple examples of grid layouts with all four tiers, nesting, and more.

    Taking the default navbar component and showing how it can be moved, placed, and extended.

    Navbars

    Demonstration of all responsive and container options for the navbar.

    Navbar static

    Single navbar example of a static top navbar along with some additional content.

    Navbar fixed

    Single navbar example with a fixed top navbar along with some additional content.

    Navbar bottom

    Single navbar example with a bottom navbar along with some additional content.

    Offcanvas navbar

    Turn your expandable navbar into a sliding offcanvas menu (doesn't use our offcanvas component).

    RTL

    See Bootstrap's RTL version in action with these modified examples from various categories.

    RTL is still experimental and will evolve with feedback. Spotted something or have an + improvement to suggest? +

    Please open an issue.

    Album RTL

    Simple one-page template for photo galleries, portfolios, and more.

    Checkout RTL

    Custom checkout form showing our form components and their validation features.

    Carousel RTL

    Customize the navbar and carousel, then add some new components.

    Blog RTL

    Magazine like blog template with header, navigation, featured content.

    Dashboard RTL

    Basic admin dashboard shell with fixed sidebar and navbar.

    Integrations

    Integrations with external libraries.

    Masonry

    Combine the powers of the Bootstrap grid and the Masonry layout.


    Go further with Bootstrap Themes

    +Need something more than these examples? Take Bootstrap to the next level with premium themes from the official Bootstrap Themes marketplace. They’re built as their own extended frameworks, rich with new components and plugins, documentation, and + powerful build tools. +

    Browse themes
    Bootstrap Themes
    \ No newline at end of file diff --git a/docs/5.3/examples/jumbotron/index.html b/docs/5.3/examples/jumbotron/index.html index f0840c14c4..ec1e2edfdb 100644 --- a/docs/5.3/examples/jumbotron/index.html +++ b/docs/5.3/examples/jumbotron/index.html @@ -1,210 +1,9 @@ - - - - - - - - - Jumbotron example · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    - - Bootstrap - Jumbotron example - -
    - -
    -
    -

    Custom jumbotron

    -

    Using a series of utilities, you can create this jumbotron, just like the one in previous versions of Bootstrap. Check out the examples below for how you can remix and restyle it to your liking.

    - -
    -
    - -
    -
    -
    -

    Change the background

    -

    Swap the background-color utility and add a `.text-*` color utility to mix up the jumbotron look. Then, mix and match with additional component themes and more.

    - -
    -
    -
    -
    -

    Add borders

    -

    Or, keep it light and add a border for some added definition to the boundaries of your content. Be sure to look under the hood at the source HTML here as we've adjusted the alignment and sizing of both column's content for equal-height.

    - -
    -
    -
    - -
    - © 2025 -
    -
    -
    - - - - + Jumbotron example · Bootstrap v5.3
    Bootstrap Jumbotron example

    Custom jumbotron

    Using a series of utilities, you can create this jumbotron, just like the one in previous versions of Bootstrap. Check out the examples below for how you can remix and restyle it to your liking.

    Change the background

    Swap the background-color utility and add a `.text-*` color utility to mix up the jumbotron look. Then, mix and match with additional component themes and more.

    Add borders

    Or, keep it light and add a border for some added definition to the boundaries of your content. Be sure to look under the hood at the source HTML here as we've adjusted the alignment and sizing of both column's content for equal-height.

    +© 2025
    \ No newline at end of file diff --git a/docs/5.3/examples/jumbotrons/index.html b/docs/5.3/examples/jumbotrons/index.html index 2a4c7b85bf..78fecf6417 100644 --- a/docs/5.3/examples/jumbotrons/index.html +++ b/docs/5.3/examples/jumbotrons/index.html @@ -1,246 +1,22 @@ - - - - - - - - - Jumbotrons · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Bootstrap - - - - - - - - - - - -
    -
    - -

    Jumbotron with icon

    -

    - This is a custom jumbotron featuring an SVG image at the top, some longer text that wraps early thanks to a responsive .col-* class, and a customized call to action. -

    -
    - - -
    -
    -
    - -
    - -
    -
    - - -

    Placeholder jumbotron

    -

    - This faded back jumbotron is useful for placeholder content. It's also a great way to add a bit of context to a page or section when no content is available and to encourage visitors to take a specific action. -

    - -
    -
    - -
    - -
    -
    -
    -

    Full-width jumbotron

    -

    - This takes the basic jumbotron above and makes its background edge-to-edge with a .container inside to align content. Similar to above, it's been recreated with built-in grid and utility classes. -

    -
    -
    -
    - -
    - -
    -
    -

    Basic jumbotron

    -

    - This is a simple Bootstrap jumbotron that sits within a .container, recreated with built-in utility classes. -

    -
    -
    - -
    - - - - + Jumbotrons · Bootstrap v5.3 Bootstrap

    Jumbotron with icon

    +This is a custom jumbotron featuring an SVG image at the top, some longer text that wraps early thanks to a responsive .col-* class, and a customized call to action. +

    Placeholder jumbotron

    +This faded back jumbotron is useful for placeholder content. It's also a great way to add a bit of context to a page or section when no content is available and to encourage visitors to take a specific action. +

    Full-width jumbotron

    +This takes the basic jumbotron above and makes its background edge-to-edge with a .container inside to align content. Similar to above, it's been recreated with built-in grid and utility classes. +

    Basic jumbotron

    +This is a simple Bootstrap jumbotron that sits within a .container, recreated with built-in utility classes. +

    \ No newline at end of file diff --git a/docs/5.3/examples/list-groups/index.html b/docs/5.3/examples/list-groups/index.html index 5974710f02..2e0fe10eb4 100644 --- a/docs/5.3/examples/list-groups/index.html +++ b/docs/5.3/examples/list-groups/index.html @@ -1,389 +1,36 @@ - - - - - - - - - List groups · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -
    -
    - - - -
    - -
    - - - -
    -
    - -
    - -
    -
    - - - - -
    -
    - -
    - -
    -
    - - - - - - - - - - - -
    -
    - -
    - -
    -
    -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    -
    -
    - - - - + List groups · Bootstrap v5.3
    \ No newline at end of file diff --git a/docs/5.3/examples/masonry/index.html b/docs/5.3/examples/masonry/index.html index 25b88391e3..5387c598c7 100644 --- a/docs/5.3/examples/masonry/index.html +++ b/docs/5.3/examples/masonry/index.html @@ -1,267 +1,13 @@ - - - - - - - - - Masonry example · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    Bootstrap and Masonry

    -

    Integrate Masonry with the Bootstrap grid system and cards component.

    - -

    Masonry is not included in Bootstrap. Add it by including the JavaScript plugin manually, or using a CDN like so:

    - -
    
    + Masonry example · Bootstrap v5.3                   

    Bootstrap and Masonry

    Integrate Masonry with the Bootstrap grid system and cards component.

    Masonry is not included in Bootstrap. Add it by including the JavaScript plugin manually, or using a CDN like so:

    
     <script src="https://cdn.jsdelivr.net/npm/masonry-layout@4.2.2/dist/masonry.pkgd.min.js" integrity="sha384-GNFwBvfVxBkLMJpYMOABq3c+d3KnQxudP/mGPkzpZSTYykLBNsZEnG2D9G/X/+7D" crossorigin="anonymous" async></script>
    -  
    - -

    By adding data-masonry='{"percentPosition": true }' to the .row wrapper, we can combine the powers of Bootstrap's responsive grid and Masonry's positioning.

    - -
    - -
    -
    -
    - PlaceholderImage cap -
    -
    Card title that wraps to a new line
    -

    This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    -
    -
    -
    -
    -
    -
    -
    -

    A well-known quote, contained in a blockquote element.

    -
    - -
    -
    -
    -
    -
    - PlaceholderImage cap -
    -
    Card title
    -

    This card has supporting text below as a natural lead-in to additional content.

    -

    Last updated 3 mins ago

    -
    -
    -
    -
    -
    -
    -
    -

    A well-known quote, contained in a blockquote element.

    -
    - -
    -
    -
    -
    -
    -
    -
    Card title
    -

    This card has a regular title and short paragraph of text below it.

    -

    Last updated 3 mins ago

    -
    -
    -
    -
    -
    - PlaceholderCard image -
    -
    -
    -
    -
    -
    -

    A well-known quote, contained in a blockquote element.

    -
    - -
    -
    -
    -
    -
    -
    -
    Card title
    -

    This is another card with title and supporting text below. This card has some additional content to make it slightly taller overall.

    -

    Last updated 3 mins ago

    -
    -
    -
    -
    - -
    - - - - +

    By adding data-masonry='}"percentPosition": true }' to the .row wrapper, we can combine the powers of Bootstrap's responsive grid and Masonry's positioning.


    PlaceholderImage cap
    Card title that wraps to a new line

    This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.

    A well-known quote, contained in a blockquote element.

    PlaceholderImage cap
    Card title

    This card has supporting text below as a natural lead-in to additional content.

    Last updated 3 mins ago

    A well-known quote, contained in a blockquote element.

    Card title

    This card has a regular title and short paragraph of text below it.

    Last updated 3 mins ago

    PlaceholderCard image

    A well-known quote, contained in a blockquote element.

    Card title

    This is another card with title and supporting text below. This card has some additional content to make it slightly taller overall.

    Last updated 3 mins ago

    \ No newline at end of file diff --git a/docs/5.3/examples/modals/index.html b/docs/5.3/examples/modals/index.html index 39fb799bff..82e77ff506 100644 --- a/docs/5.3/examples/modals/index.html +++ b/docs/5.3/examples/modals/index.html @@ -1,314 +1,20 @@ - - - - - - - - - Modals · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - -
    - - - -
    - - - -
    - - - - + Modals · Bootstrap v5.3
    \ No newline at end of file diff --git a/docs/5.3/examples/modals/modals.css b/docs/5.3/examples/modals/modals.css index 924952ae37..194e16aca6 100644 --- a/docs/5.3/examples/modals/modals.css +++ b/docs/5.3/examples/modals/modals.css @@ -5,4 +5,3 @@ .modal-sheet .modal-footer { padding-bottom: 2rem; } - diff --git a/docs/5.3/examples/navbar-bottom/index.html b/docs/5.3/examples/navbar-bottom/index.html index 36ca982a97..49f26ae475 100644 --- a/docs/5.3/examples/navbar-bottom/index.html +++ b/docs/5.3/examples/navbar-bottom/index.html @@ -1,207 +1,8 @@ - - - - - - - - - Bottom navbar example · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -

    Bottom Navbar example

    -

    This example is a quick exercise to illustrate how the bottom navbar works.

    - View navbar docs » -
    -
    - - - - - + Bottom navbar example · Bootstrap v5.3

    Bottom Navbar example

    This example is a quick exercise to illustrate how the bottom navbar works.

    View navbar docs »
    \ No newline at end of file diff --git a/docs/5.3/examples/navbar-fixed/index.html b/docs/5.3/examples/navbar-fixed/index.html index e170322cdc..d9c8499e6d 100644 --- a/docs/5.3/examples/navbar-fixed/index.html +++ b/docs/5.3/examples/navbar-fixed/index.html @@ -1,205 +1,8 @@ - - - - - - - - - Fixed top navbar example · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -

    Navbar example

    -

    This example is a quick exercise to illustrate how fixed to top navbar works. As you scroll, it will remain fixed to the top of your browser’s viewport.

    - View navbar docs » -
    -
    - - - - + Fixed top navbar example · Bootstrap v5.3

    Navbar example

    This example is a quick exercise to illustrate how fixed to top navbar works. As you scroll, it will remain fixed to the top of your browser’s viewport.

    View navbar docs »
    \ No newline at end of file diff --git a/docs/5.3/examples/navbar-static/index.html b/docs/5.3/examples/navbar-static/index.html index 6e04264205..967da1f2e3 100644 --- a/docs/5.3/examples/navbar-static/index.html +++ b/docs/5.3/examples/navbar-static/index.html @@ -1,205 +1,8 @@ - - - - - - - - - Top navbar example · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -

    Navbar example

    -

    This example is a quick exercise to illustrate how the top-aligned navbar works. As you scroll, this navbar remains in its original position and moves with the rest of the page.

    - View navbar docs » -
    -
    - - - - + Top navbar example · Bootstrap v5.3

    Navbar example

    This example is a quick exercise to illustrate how the top-aligned navbar works. As you scroll, this navbar remains in its original position and moves with the rest of the page.

    View navbar docs »
    \ No newline at end of file diff --git a/docs/5.3/examples/navbars-offcanvas/index.html b/docs/5.3/examples/navbars-offcanvas/index.html index b1305276b7..4f34157431 100644 --- a/docs/5.3/examples/navbars-offcanvas/index.html +++ b/docs/5.3/examples/navbars-offcanvas/index.html @@ -1,312 +1,14 @@ - - - - - - - - - Navbar Template · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - -
    -
    -
    -

    Navbar with offcanvas examples

    -

    This example shows how responsive offcanvas menus work within the navbar. For positioning of navbars, checkout the top and fixed top examples.

    -

    From the top down, you'll see a dark navbar, light navbar and a responsive navbar—each with offcanvases built in. Resize your browser window to the large breakpoint to see the toggle for the offcanvas.

    -

    - Learn more about offcanvas navbars » -

    -
    -
    -
    -
    - - - - + Navbar Template · Bootstrap v5.3

    Navbar with offcanvas examples

    This example shows how responsive offcanvas menus work within the navbar. For positioning of navbars, checkout the top and fixed top examples.

    From the top down, you'll see a dark navbar, light navbar and a responsive navbar—each with offcanvases built in. Resize your browser window to the large breakpoint to see the toggle for the offcanvas.

    Learn more about offcanvas navbars »

    \ No newline at end of file diff --git a/docs/5.3/examples/navbars/index.html b/docs/5.3/examples/navbars/index.html index 2fab336cbe..9549480a43 100644 --- a/docs/5.3/examples/navbars/index.html +++ b/docs/5.3/examples/navbars/index.html @@ -1,615 +1,8 @@ - - - - - - - - - Navbar Template · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - -
    -

    Matching .container-xl...

    -
    - - - -
    - - - - - - -
    -
    -
    -

    Navbar examples

    -

    This example is a quick exercise to illustrate how the navbar and its contents work. Some navbars extend the width of the viewport, others are confined within a .container. For positioning of navbars, checkout the top and fixed top examples.

    -

    At the smallest breakpoint, the collapse plugin is used to hide the links and show a menu button to toggle the collapsed content.

    -

    - View navbar docs » -

    -
    -
    -
    -
    -
    - - - - + Navbar Template · Bootstrap v5.3

    Matching .container-xl...

    Navbar examples

    This example is a quick exercise to illustrate how the navbar and its contents work. Some navbars extend the width of the viewport, others are confined within a .container. For positioning of navbars, checkout the top and fixed top examples.

    At the smallest breakpoint, the collapse plugin is used to hide the links and show a menu button to toggle the collapsed content.

    View navbar docs »

    \ No newline at end of file diff --git a/docs/5.3/examples/offcanvas-navbar/index.html b/docs/5.3/examples/offcanvas-navbar/index.html index a30ed38235..712b7ce5f8 100644 --- a/docs/5.3/examples/offcanvas-navbar/index.html +++ b/docs/5.3/examples/offcanvas-navbar/index.html @@ -1,301 +1,16 @@ - - - - - - - - - Offcanvas navbar template · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - -
    -

    Bootstrap

    - Since 2011 -
    -
    - -
    -
    Recent updates
    -
    - Placeholder32x32 -

    - @username - Some representative placeholder content, with some information about this user. Imagine this being some sort of status update, perhaps? -

    -
    -
    - Placeholder32x32 -

    - @username - Some more representative placeholder content, related to this other user. Another status update, perhaps. -

    -
    -
    - Placeholder32x32 -

    - @username - This user also gets some representative placeholder content. Maybe they did something interesting, and you really want to highlight this in the recent updates. -

    -
    - - All updates - -
    - -
    -
    Suggestions
    -
    - Placeholder32x32 -
    -
    - Full Name - Follow -
    - @username -
    -
    -
    - Placeholder32x32 -
    -
    - Full Name - Follow -
    - @username -
    -
    -
    - Placeholder32x32 -
    -
    - Full Name - Follow -
    - @username -
    -
    - - All suggestions - -
    -
    - - - - + Offcanvas navbar template · Bootstrap v5.3

    Bootstrap

    Since 2011
    Recent updates
    Placeholder32x32

    @username +Some representative placeholder content, with some information about this user. Imagine this being some sort of status update, perhaps? +

    Placeholder32x32

    @username +Some more representative placeholder content, related to this other user. Another status update, perhaps. +

    Placeholder32x32

    @username +This user also gets some representative placeholder content. Maybe they did something interesting, and you really want to highlight this in the recent updates. +

    All updates
    Suggestions
    Placeholder32x32
    Full Name Follow
    @username
    Placeholder32x32
    Full Name Follow
    @username
    Placeholder32x32
    Full Name Follow
    @username
    All suggestions
    \ No newline at end of file diff --git a/docs/5.3/examples/offcanvas/index.html b/docs/5.3/examples/offcanvas/index.html index aa79baceba..89e364da0c 100644 --- a/docs/5.3/examples/offcanvas/index.html +++ b/docs/5.3/examples/offcanvas/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/examples/offcanvas-navbar/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/examples/pricing/index.html b/docs/5.3/examples/pricing/index.html index 47722004fa..96e0cfcadd 100644 --- a/docs/5.3/examples/pricing/index.html +++ b/docs/5.3/examples/pricing/index.html @@ -1,351 +1,8 @@ - - - - - - - - - Pricing example · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Check - - - - -
    -
    - - -
    -

    Pricing

    -

    Quickly build an effective pricing table for your potential customers with this Bootstrap example. It’s built with default Bootstrap components and utilities with little customization.

    -
    -
    - -
    -
    -
    -
    -
    -

    Free

    -
    -
    -

    $0/mo

    -
      -
    • 10 users included
    • -
    • 2 GB of storage
    • -
    • Email support
    • -
    • Help center access
    • -
    - -
    -
    -
    -
    -
    -
    -

    Pro

    -
    -
    -

    $15/mo

    -
      -
    • 20 users included
    • -
    • 10 GB of storage
    • -
    • Priority email support
    • -
    • Help center access
    • -
    - -
    -
    -
    -
    -
    -
    -

    Enterprise

    -
    -
    -

    $29/mo

    -
      -
    • 30 users included
    • -
    • 15 GB of storage
    • -
    • Phone and email support
    • -
    • Help center access
    • -
    - -
    -
    -
    -
    - -

    Compare plans

    - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FreeProEnterprise
    Public
    Private
    Permissions
    Sharing
    Unlimited members
    Extra security
    -
    -
    - - -
    - - - - + Pricing example · Bootstrap v5.3 Check

    Pricing

    Quickly build an effective pricing table for your potential customers with this Bootstrap example. It’s built with default Bootstrap components and utilities with little customization.

    Free

    $0/mo

    • 10 users included
    • 2 GB of storage
    • Email support
    • Help center access

    Pro

    $15/mo

    • 20 users included
    • 10 GB of storage
    • Priority email support
    • Help center access

    Enterprise

    $29/mo

    • 30 users included
    • 15 GB of storage
    • Phone and email support
    • Help center access

    Compare plans

    Free Pro Enterprise
    Public
    Private
    Permissions
    Sharing
    Unlimited members
    Extra security
    \ No newline at end of file diff --git a/docs/5.3/examples/product/index.html b/docs/5.3/examples/product/index.html index ff215ce113..cd52be07dd 100644 --- a/docs/5.3/examples/product/index.html +++ b/docs/5.3/examples/product/index.html @@ -1,354 +1,14 @@ - - - - - - - - - Product example · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    -

    Designed for engineers

    -

    Build anything you want with Aperture

    - -
    -
    -
    -
    - -
    -
    -
    -

    Another headline

    -

    And an even wittier subheading.

    -
    -
    -
    -
    -
    -

    Another headline

    -

    And an even wittier subheading.

    -
    -
    -
    -
    - -
    -
    -
    -

    Another headline

    -

    And an even wittier subheading.

    -
    -
    -
    -
    -
    -

    Another headline

    -

    And an even wittier subheading.

    -
    -
    -
    -
    - -
    -
    -
    -

    Another headline

    -

    And an even wittier subheading.

    -
    -
    -
    -
    -
    -

    Another headline

    -

    And an even wittier subheading.

    -
    -
    -
    -
    - -
    -
    -
    -

    Another headline

    -

    And an even wittier subheading.

    -
    -
    -
    -
    -
    -

    Another headline

    -

    And an even wittier subheading.

    -
    -
    -
    -
    -
    - - - - - - + Product example · Bootstrap v5.3

    Designed for engineers

    Build anything you want with Aperture

    Another headline

    And an even wittier subheading.

    Another headline

    And an even wittier subheading.

    Another headline

    And an even wittier subheading.

    Another headline

    And an even wittier subheading.

    Another headline

    And an even wittier subheading.

    Another headline

    And an even wittier subheading.

    Another headline

    And an even wittier subheading.

    Another headline

    And an even wittier subheading.

    \ No newline at end of file diff --git a/docs/5.3/examples/sidebars/index.html b/docs/5.3/examples/sidebars/index.html index 0a1f60cf6f..dc1e1646e5 100644 --- a/docs/5.3/examples/sidebars/index.html +++ b/docs/5.3/examples/sidebars/index.html @@ -1,518 +1,36 @@ - - - - - - - - - Sidebars · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Bootstrap - - - - - - - - - - - - - - - - - - - - - -
    -

    Sidebars examples

    - - - -
    - - - -
    - -
    - - - Icon-only - - - -
    - -
    - -
    - - - Collapsible - - -
    - -
    - - - -
    -
    - - - - + Sidebars · Bootstrap v5.3 Bootstrap

    Sidebars examples

    \ No newline at end of file diff --git a/docs/5.3/examples/sign-in/index.html b/docs/5.3/examples/sign-in/index.html index 44c90f48c8..f1db43325e 100644 --- a/docs/5.3/examples/sign-in/index.html +++ b/docs/5.3/examples/sign-in/index.html @@ -1,196 +1,10 @@ - - - - - - - - - Signin Template · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - -

    Please sign in

    - -
    - - -
    -
    - - -
    - -
    - - -
    - -

    © 2017–2025

    -
    -
    - - - - + Signin Template · Bootstrap v5.3

    Please sign in

    © 2017–2025

    \ No newline at end of file diff --git a/docs/5.3/examples/starter-template/index.html b/docs/5.3/examples/starter-template/index.html index 2a8f983736..4c7cec9608 100644 --- a/docs/5.3/examples/starter-template/index.html +++ b/docs/5.3/examples/starter-template/index.html @@ -1,273 +1,27 @@ - - - - - - - - - Starter Template · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Bootstrap - - - - -
    -
    - - - Starter template - -
    - -
    -

    Get started with Bootstrap

    -

    Quickly and easily get started with Bootstrap's compiled, production-ready files with this barebones example featuring some basic HTML and helpful links. Download all our examples to get started.

    - - - -
    - -
    -
    -

    Starter projects

    -

    Ready to go beyond the starter template? Check out these open source projects that you can quickly duplicate to a new GitHub repository.

    - -
    - -
    -

    Guides

    -

    Read more detailed instructions and documentation on using or contributing to Bootstrap.

    - -
    -
    -
    -
    - Created by the Bootstrap team · © 2025 -
    -
    - - - - + Starter Template · Bootstrap v5.3 Bootstrap
    Starter template

    Get started with Bootstrap

    Quickly and easily get started with Bootstrap's compiled, production-ready files with this barebones example featuring some basic HTML and helpful links. Download all our examples to get started.


    Starter projects

    Ready to go beyond the starter template? Check out these open source projects that you can quickly duplicate to a new GitHub repository.

    Guides

    Read more detailed instructions and documentation on using or contributing to Bootstrap.

    +Created by the Bootstrap team · © 2025
    \ No newline at end of file diff --git a/docs/5.3/examples/sticky-footer-navbar/index.html b/docs/5.3/examples/sticky-footer-navbar/index.html index a1782ca676..d87629a879 100644 --- a/docs/5.3/examples/sticky-footer-navbar/index.html +++ b/docs/5.3/examples/sticky-footer-navbar/index.html @@ -1,215 +1,8 @@ - - - - - - - - - Sticky Footer Navbar Template · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    - - -
    -
    -

    Sticky footer with fixed navbar

    -

    Pin a footer to the bottom of the viewport in desktop browsers with this custom HTML and CSS. A fixed navbar has been added with padding-top: 60px; on the main > .container.

    -

    Back to the default sticky footer minus the navbar.

    -
    -
    - -
    -
    - Place sticky footer content here. -
    -
    - - - - + Sticky Footer Navbar Template · Bootstrap v5.3

    Sticky footer with fixed navbar

    Pin a footer to the bottom of the viewport in desktop browsers with this custom HTML and CSS. A fixed navbar has been added with padding-top: 60px; on the main > .container.

    Back to the default sticky footer minus the navbar.

    Place sticky footer content here.
    \ No newline at end of file diff --git a/docs/5.3/examples/sticky-footer/index.html b/docs/5.3/examples/sticky-footer/index.html index ceb42c9f39..996524c3b9 100644 --- a/docs/5.3/examples/sticky-footer/index.html +++ b/docs/5.3/examples/sticky-footer/index.html @@ -1,186 +1,8 @@ - - - - - - - - - Sticky Footer Template · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -

    Sticky footer

    -

    Pin a footer to the bottom of the viewport in desktop browsers with this custom HTML and CSS.

    -

    Use the sticky footer with a fixed navbar if need be, too.

    -
    -
    - -
    -
    - Place sticky footer content here. -
    -
    - - - - + Sticky Footer Template · Bootstrap v5.3

    Sticky footer

    Pin a footer to the bottom of the viewport in desktop browsers with this custom HTML and CSS.

    Use the sticky footer with a fixed navbar if need be, too.

    Place sticky footer content here.
    \ No newline at end of file diff --git a/docs/5.3/extend/approach/index.html b/docs/5.3/extend/approach/index.html index 6193e0cfba..450b0928b7 100644 --- a/docs/5.3/extend/approach/index.html +++ b/docs/5.3/extend/approach/index.html @@ -1,547 +1,28 @@ - - - - - - - - - - - - - - - - -Approach · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Approach

    -
    -

    Learn about the guiding principles, strategies, and techniques used to build and maintain Bootstrap so you can more easily customize and extend it yourself.

    - - -
    - - - -
    - - -

    While the getting started pages provide an introductory tour of the project and what it offers, this document focuses on why we do the things we do in Bootstrap. It explains our philosophy to building on the web so that others can learn from us, contribute with us, and help us improve.

    -

    See something that doesn’t sound right, or perhaps could be done better? Open an issue—we’d love to discuss it with you.

    -

    Summary

    -

    We’ll dive into each of these more throughout, but at a high level, here’s what guides our approach.

    + Approach · Bootstrap v5.3

    Learn about the guiding principles, strategies, and techniques used to build and maintain Bootstrap so you can more easily customize and extend it yourself.

    +

    While the getting started pages provide an introductory tour of the project and what it offers, this document focuses on why we do the things we do in Bootstrap. It explains our philosophy to building on the web so that others can learn from us, contribute with us, and help us improve.

    +

    See something that doesn’t sound right, or perhaps could be done better? Open an issue—we’d love to discuss it with you.

    +

    Summary

    +

    We'll dive into each of these more throughout, but at a high level, here’s what guides our approach.

    • Components should be responsive and mobile-first
    • Components should be built with a base class and extended via modifier classes
    • @@ -550,115 +31,42 @@
    • Whenever possible, use utilities over custom styles
    • Whenever possible, avoid enforcing strict HTML requirements (children selectors)
    -

    Responsive

    -

    Bootstrap’s responsive styles are built to be responsive, an approach that’s often referred to as mobile-first. We use this term in our docs and largely agree with it, but at times it can be too broad. While not every component must be entirely responsive in Bootstrap, this responsive approach is about reducing CSS overrides by pushing you to add styles as the viewport becomes larger.

    -

    Across Bootstrap, you’ll see this most clearly in our media queries. In most cases, we use min-width queries that begin to apply at a specific breakpoint and carry up through the higher breakpoints. For example, a .d-none applies from min-width: 0 to infinity. On the other hand, a .d-md-none applies from the medium breakpoint and up.

    -

    At times we’ll use max-width when a component’s inherent complexity requires it. At times, these overrides are functionally and mentally clearer to implement and support than rewriting core functionality from our components. We strive to limit this approach, but will use it from time to time.

    -

    Classes

    +

    Responsive

    +

    Bootstrap’s responsive styles are built to be responsive, an approach that’s often referred to as mobile-first. We use this term in our docs and largely agree with it, but at times it can be too broad. While not every component must be entirely responsive in Bootstrap, this responsive approach is about reducing CSS overrides by pushing you to add styles as the viewport becomes larger.

    +

    Across Bootstrap, you’ll see this most clearly in our media queries. In most cases, we use min-width queries that begin to apply at a specific breakpoint and carry up through the higher breakpoints. For example, a .d-none applies from min-width: 0 to infinity. On the other hand, a .d-md-none applies from the medium breakpoint and up.

    +

    At times we'll use max-width when a component’s inherent complexity requires it. At times, these overrides are functionally and mentally clearer to implement and support than rewriting core functionality from our components. We strive to limit this approach, but will use it from time to time.

    +

    Classes

    Aside from our Reboot, a cross-browser normalization stylesheet, all our styles aim to use classes as selectors. This means steering clear of type selectors (e.g., input[type="text"]) and extraneous parent classes (e.g., .parent .child) that make styles too specific to easily override.

    As such, components should be built with a base class that houses common, not-to-be overridden property-value pairs. For example, .btn and .btn-primary. We use .btn for all the common styles like display, padding, and border-width. We then use modifiers like .btn-primary to add the color, background-color, border-color, etc.

    -

    Modifier classes should only be used when there are multiple properties or values to be changed across multiple variants. Modifiers are not always necessary, so be sure you’re actually saving lines of code and preventing unnecessary overrides when creating them. Good examples of modifiers are our theme color classes and size variants.

    -

    z-index scales

    +

    Modifier classes should only be used when there are multiple properties or values to be changed across multiple variants. Modifiers are not always necessary, so be sure you’re actually saving lines of code and preventing unnecessary overrides when creating them. Good examples of modifiers are our theme color classes and size variants.

    +

    z-index scales

    There are two z-index scales in Bootstrap—elements within a component and overlay components.

    -

    Component elements

    +

    Component elements

    • Some components in Bootstrap are built with overlapping elements to prevent double borders without modifying the border property. For example, button groups, input groups, and pagination.
    • These components share a standard z-index scale of 0 through 3.
    • 0 is default (initial), 1 is :hover, 2 is :active/.active, and 3 is :focus.
    • -
    • This approach matches our expectations of highest user priority. If an element is focused, it’s in view and at the user’s attention. Active elements are second highest because they indicate state. Hover is third highest because it indicates user intent, but nearly anything can be hovered.
    • +
    • This approach matches our expectations of highest user priority. If an element is focused, it’s in view and at the user’s attention. Active elements are second highest because they indicate state. Hover is third highest because it indicates user intent, but nearly anything can be hovered.
    -

    Overlay components

    -

    Bootstrap includes several components that function as an overlay of some kind. This includes, in order of highest z-index, dropdowns, fixed and sticky navbars, modals, tooltips, and popovers. These components have their own z-index scale that begins at 1000. This starting number was chosen arbitrarily and serves as a small buffer between our styles and your project’s custom styles.

    -

    Each overlay component increases its z-index value slightly in such a way that common UI principles allow user focused or hovered elements to remain in view at all times. For example, a modal is document blocking (e.g., you cannot take any other action save for the modal’s action), so we put that above our navbars.

    -

    Learn more about this in our z-index layout page.

    -

    HTML and CSS over JS

    +

    Overlay components

    +

    Bootstrap includes several components that function as an overlay of some kind. This includes, in order of highest z-index, dropdowns, fixed and sticky navbars, modals, tooltips, and popovers. These components have their own z-index scale that begins at 1000. This starting number was chosen arbitrarily and serves as a small buffer between our styles and your project’s custom styles.

    +

    Each overlay component increases its z-index value slightly in such a way that common UI principles allow user focused or hovered elements to remain in view at all times. For example, a modal is document blocking (e.g., you cannot take any other action save for the modal’s action), so we put that above our navbars.

    +

    Learn more about this in our z-index layout page.

    +

    HTML and CSS over JS

    Whenever possible, we prefer to write HTML and CSS over JavaScript. In general, HTML and CSS are more prolific and accessible to more people of all different experience levels. HTML and CSS are also faster in your browser than JavaScript, and your browser generally provides a great deal of functionality for you.

    -

    This principle is our first-class JavaScript API using data attributes. You don’t need to write nearly any JavaScript to use our JavaScript plugins; instead, write HTML. Read more about this in our JavaScript overview page.

    -

    Lastly, our styles build on the fundamental behaviors of common web elements. Whenever possible, we prefer to use what the browser provides. For example, you can put a .btn class on nearly any element, but most elements don’t provide any semantic value or browser functionality. So instead, we use <button>s and <a>s.

    -

    The same goes for more complex components. While we could write our own form validation plugin to add classes to a parent element based on an input’s state, thereby allowing us to style the text say red, we prefer using the :valid/:invalid pseudo-elements every browser provides us.

    -

    Utilities

    +

    This principle is our first-class JavaScript API using data attributes. You don’t need to write nearly any JavaScript to use our JavaScript plugins; instead, write HTML. Read more about this in our JavaScript overview page.

    +

    Lastly, our styles build on the fundamental behaviors of common web elements. Whenever possible, we prefer to use what the browser provides. For example, you can put a .btn class on nearly any element, but most elements don’t provide any semantic value or browser functionality. So instead, we use <button>s and <a>s.

    +

    The same goes for more complex components. While we could write our own form validation plugin to add classes to a parent element based on an input’s state, thereby allowing us to style the text say red, we prefer using the :valid/:invalid pseudo-elements every browser provides us.

    +

    Utilities

    Utility classes—formerly helpers in Bootstrap 3—are a powerful ally in combating CSS bloat and poor page performance. A utility class is typically a single, immutable property-value pairing expressed as a class (e.g., .d-block represents display: block;). Their primary appeal is speed of use while writing HTML and limiting the amount of custom CSS you have to write.

    Specifically regarding custom CSS, utilities can help combat increasing file size by reducing your most commonly repeated property-value pairs into single classes. This can have a dramatic effect at scale in your projects.

    -

    Flexible HTML

    +

    Flexible HTML

    While not always possible, we strive to avoid being overly dogmatic in our HTML requirements for components. Thus, we focus on single classes in our CSS selectors and try to avoid immediate children selectors (>). This gives you more flexibility in your implementation and helps keep our CSS simpler and less specific.

    -

    Code conventions

    +

    Code conventions

    Code Guide (from Bootstrap co-creator, @mdo) documents how we write our HTML and CSS across Bootstrap. It specifies guidelines for general formatting, common sense defaults, property and attribute orders, and more.

    We use Stylelint to enforce these standards and more in our Sass/CSS. Our custom Stylelint config is open source and available for others to use and extend.

    -

    We use vnu-jar to enforce standard and semantic HTML, as well as detecting common errors.

    - -
    -
    -
    - - - - - - - - - - - - - - - +

    We use vnu-jar to enforce standard and semantic HTML, as well as detecting common errors.

    \ No newline at end of file diff --git a/docs/5.3/extend/icons/index.html b/docs/5.3/extend/icons/index.html index e6b1c876b2..6455e8aa5b 100644 --- a/docs/5.3/extend/icons/index.html +++ b/docs/5.3/extend/icons/index.html @@ -1,645 +1,37 @@ - - - - - - - - - - - - - - - - -Icons · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Icons

    -
    -

    Guidance and suggestions for using external icon libraries with Bootstrap.

    - - -
    - - - -
    - - -

    While Bootstrap doesn’t include an icon set by default, we do have our own comprehensive icon library called Bootstrap Icons. Feel free to use them or any other icon set in your project. We’ve included details for Bootstrap Icons and other preferred icon sets below.

    + Icons · Bootstrap v5.3

    Guidance and suggestions for using external icon libraries with Bootstrap.

    +

    While Bootstrap doesn’t include an icon set by default, we do have our own comprehensive icon library called Bootstrap Icons. Feel free to use them or any other icon set in your project. We’ve included details for Bootstrap Icons and other preferred icon sets below.

    While most icon sets include multiple file formats, we prefer SVG implementations for their improved accessibility and vector support.

    -

    Bootstrap Icons

    -

    Bootstrap Icons is a growing library of SVG icons that are designed by @mdo and maintained by the Bootstrap Team. The beginnings of this icon set come from Bootstrap’s very own components—our forms, carousels, and more. Bootstrap has very few icon needs out of the box, so we didn’t need much. However, once we got going, we couldn’t stop making more.

    -

    Oh, and did we mention they’re completely open source? Licensed under MIT, just like Bootstrap, our icon set is available to everyone.

    +

    Bootstrap Icons

    +

    Bootstrap Icons is a growing library of SVG icons that are designed by @mdo and maintained by the Bootstrap Team. The beginnings of this icon set come from Bootstrap’s very own components—our forms, carousels, and more. Bootstrap has very few icon needs out of the box, so we didn’t need much. However, once we got going, we couldn’t stop making more.

    +

    Oh, and did we mention they’re completely open source? Licensed under MIT, just like Bootstrap, our icon set is available to everyone.

    Learn more about Bootstrap Icons, including how to install them and recommended usage.

    -

    Alternatives

    -

    We’ve tested and used these icon sets ourselves as preferred alternatives to Bootstrap Icons.

    - - -

    More options

    -

    While we haven’t tried these out ourselves, they do look promising and provide multiple formats, including SVG.

    - - - -
    -
    -
    - - - - - - - - - - - - - - - +

    Alternatives

    +

    We’ve tested and used these icon sets ourselves as preferred alternatives to Bootstrap Icons.

    + +

    More options

    +

    While we haven’t tried these out ourselves, they do look promising and provide multiple formats, including SVG.

    +
    \ No newline at end of file diff --git a/docs/5.3/extend/index.html b/docs/5.3/extend/index.html index 0d0a40600b..19857e5ab3 100644 --- a/docs/5.3/extend/index.html +++ b/docs/5.3/extend/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/extend/approach/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/forms/checks-radios/index.html b/docs/5.3/forms/checks-radios/index.html index a399df31a0..b62fdacd18 100644 --- a/docs/5.3/forms/checks-radios/index.html +++ b/docs/5.3/forms/checks-radios/index.html @@ -1,596 +1,32 @@ - - - - - - - - - - - - - - - - -Checks and radios · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Checks and radios

    -
    -

    Create consistent cross-browser and cross-device checkboxes and radios with our completely rewritten checks component.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Approach

    + Checks and radios · Bootstrap v5.3

    Checks and radios

    Create consistent cross-browser and cross-device checkboxes and radios with our completely rewritten checks component.

    +

    Approach

    Browser default checkboxes and radios are replaced with the help of .form-check, a series of classes for both input types that improves the layout and behavior of their HTML elements, that provide greater customization and cross browser consistency. Checkboxes are for selecting one or several options in a list, while radios are for selecting one option from many.

    -

    Structurally, our <input>s and <label>s are sibling elements as opposed to an <input> within a <label>. This is slightly more verbose as you must specify id and for attributes to relate the <input> and <label>. We use the sibling selector (~) for all our <input> states, like :checked or :disabled. When combined with the .form-check-label class, we can easily style the text for each item based on the <input>’s state.

    +

    Structurally, our <input>s and <label>s are sibling elements as opposed to an <input> within a <label>. This is slightly more verbose as you must specify id and for attributes to relate the <input> and <label>. We use the sibling selector (~) for all our <input> states, like :checked or :disabled. When combined with the .form-check-label class, we can easily style the text for each item based on the <input>’s state.

    Our checks use custom Bootstrap icons to indicate checked or indeterminate states.

    -

    Checks

    -
    -
    - -
    +

    Checks

    +
    - -
    - html -
    - - -
    -
    <div class="form-check">
    -  <input class="form-check-input" type="checkbox" value="" id="checkDefault">
    -  <label class="form-check-label" for="checkDefault">
    -    Default checkbox
    -  </label>
    -</div>
    -<div class="form-check">
    -  <input class="form-check-input" type="checkbox" value="" id="checkChecked" checked>
    -  <label class="form-check-label" for="checkChecked">
    -    Checked checkbox
    -  </label>
    -</div>
    -
    - -

    Indeterminate

    +
    html
    <div class="form-check">
    +  <input class="form-check-input" type="checkbox" value="" id="checkDefault">
    +  <label class="form-check-label" for="checkDefault">
    +    Default checkbox
    +  </label>
    +</div>
    +<div class="form-check">
    +  <input class="form-check-input" type="checkbox" value="" id="checkChecked" checked>
    +  <label class="form-check-label" for="checkChecked">
    +    Checked checkbox
    +  </label>
    +</div>
    +

    Indeterminate

    Checkboxes can utilize the :indeterminate pseudo class when manually set via JavaScript (there is no available HTML attribute for specifying it).

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="form-check">
    -  <input class="form-check-input" type="checkbox" value="" id="checkIndeterminate">
    -  <label class="form-check-label" for="checkIndeterminate">
    -    Indeterminate checkbox
    -  </label>
    -</div>
    -
    - -

    Disabled

    -

    Add the disabled attribute and the associated <label>s are automatically styled to match with a lighter color to help indicate the input’s state.

    -
    -
    - -
    +
    html
    <div class="form-check">
    +  <input class="form-check-input" type="checkbox" value="" id="checkIndeterminate">
    +  <label class="form-check-label" for="checkIndeterminate">
    +    Indeterminate checkbox
    +  </label>
    +</div>
    +

    Disabled

    +

    Add the disabled attribute and the associated <label>s are automatically styled to match with a lighter color to help indicate the input’s state.

    +
    - -
    - html -
    - - -
    -
    <div class="form-check">
    -  <input class="form-check-input" type="checkbox" value="" id="checkIndeterminateDisabled" disabled>
    -  <label class="form-check-label" for="checkIndeterminateDisabled">
    -    Disabled indeterminate checkbox
    -  </label>
    -</div>
    -<div class="form-check">
    -  <input class="form-check-input" type="checkbox" value="" id="checkDisabled" disabled>
    -  <label class="form-check-label" for="checkDisabled">
    -    Disabled checkbox
    -  </label>
    -</div>
    -<div class="form-check">
    -  <input class="form-check-input" type="checkbox" value="" id="checkCheckedDisabled" checked disabled>
    -  <label class="form-check-label" for="checkCheckedDisabled">
    -    Disabled checked checkbox
    -  </label>
    -</div>
    -
    - -

    Radios

    -
    -
    - -
    +
    html
    <div class="form-check">
    +  <input class="form-check-input" type="checkbox" value="" id="checkIndeterminateDisabled" disabled>
    +  <label class="form-check-label" for="checkIndeterminateDisabled">
    +    Disabled indeterminate checkbox
    +  </label>
    +</div>
    +<div class="form-check">
    +  <input class="form-check-input" type="checkbox" value="" id="checkDisabled" disabled>
    +  <label class="form-check-label" for="checkDisabled">
    +    Disabled checkbox
    +  </label>
    +</div>
    +<div class="form-check">
    +  <input class="form-check-input" type="checkbox" value="" id="checkCheckedDisabled" checked disabled>
    +  <label class="form-check-label" for="checkCheckedDisabled">
    +    Disabled checked checkbox
    +  </label>
    +</div>
    +

    Radios

    +
    - -
    - html -
    - - -
    -
    <div class="form-check">
    -  <input class="form-check-input" type="radio" name="radioDefault" id="radioDefault1">
    -  <label class="form-check-label" for="radioDefault1">
    -    Default radio
    -  </label>
    -</div>
    -<div class="form-check">
    -  <input class="form-check-input" type="radio" name="radioDefault" id="radioDefault2" checked>
    -  <label class="form-check-label" for="radioDefault2">
    -    Default checked radio
    -  </label>
    -</div>
    -
    - -

    Disabled

    -

    Add the disabled attribute and the associated <label>s are automatically styled to match with a lighter color to help indicate the input’s state.

    -
    -
    - -
    +
    html
    <div class="form-check">
    +  <input class="form-check-input" type="radio" name="radioDefault" id="radioDefault1">
    +  <label class="form-check-label" for="radioDefault1">
    +    Default radio
    +  </label>
    +</div>
    +<div class="form-check">
    +  <input class="form-check-input" type="radio" name="radioDefault" id="radioDefault2" checked>
    +  <label class="form-check-label" for="radioDefault2">
    +    Default checked radio
    +  </label>
    +</div>
    +

    Disabled

    +

    Add the disabled attribute and the associated <label>s are automatically styled to match with a lighter color to help indicate the input’s state.

    +
    - -
    - html -
    - - -
    -
    <div class="form-check">
    -  <input class="form-check-input" type="radio" name="radioDisabled" id="radioDisabled" disabled>
    -  <label class="form-check-label" for="radioDisabled">
    -    Disabled radio
    -  </label>
    -</div>
    -<div class="form-check">
    -  <input class="form-check-input" type="radio" name="radioDisabled" id="radioCheckedDisabled" checked disabled>
    -  <label class="form-check-label" for="radioCheckedDisabled">
    -    Disabled checked radio
    -  </label>
    -</div>
    -
    - -

    Switches

    +
    html
    <div class="form-check">
    +  <input class="form-check-input" type="radio" name="radioDisabled" id="radioDisabled" disabled>
    +  <label class="form-check-label" for="radioDisabled">
    +    Disabled radio
    +  </label>
    +</div>
    +<div class="form-check">
    +  <input class="form-check-input" type="radio" name="radioDisabled" id="radioCheckedDisabled" checked disabled>
    +  <label class="form-check-label" for="radioCheckedDisabled">
    +    Disabled checked radio
    +  </label>
    +</div>
    +

    Switches

    A switch has the markup of a custom checkbox but uses the .form-switch class to render a toggle switch. Consider using role="switch" to more accurately convey the nature of the control to assistive technologies that support this role. In older assistive technologies, it will simply be announced as a regular checkbox as a fallback. Switches also support the disabled attribute.

    -
    -
    - -
    +
    @@ -814,42 +165,25 @@
    -
    - -
    - html -
    - - -
    -
    <div class="form-check form-switch">
    -  <input class="form-check-input" type="checkbox" role="switch" id="switchCheckDefault">
    -  <label class="form-check-label" for="switchCheckDefault">Default switch checkbox input</label>
    -</div>
    -<div class="form-check form-switch">
    -  <input class="form-check-input" type="checkbox" role="switch" id="switchCheckChecked" checked>
    -  <label class="form-check-label" for="switchCheckChecked">Checked switch checkbox input</label>
    -</div>
    -<div class="form-check form-switch">
    -  <input class="form-check-input" type="checkbox" role="switch" id="switchCheckDisabled" disabled>
    -  <label class="form-check-label" for="switchCheckDisabled">Disabled switch checkbox input</label>
    -</div>
    -<div class="form-check form-switch">
    -  <input class="form-check-input" type="checkbox" role="switch" id="switchCheckCheckedDisabled" checked disabled>
    -  <label class="form-check-label" for="switchCheckCheckedDisabled">Disabled checked switch checkbox input</label>
    -</div>
    -
    - -

    Default (stacked)

    +
    html
    <div class="form-check form-switch">
    +  <input class="form-check-input" type="checkbox" role="switch" id="switchCheckDefault">
    +  <label class="form-check-label" for="switchCheckDefault">Default switch checkbox input</label>
    +</div>
    +<div class="form-check form-switch">
    +  <input class="form-check-input" type="checkbox" role="switch" id="switchCheckChecked" checked>
    +  <label class="form-check-label" for="switchCheckChecked">Checked switch checkbox input</label>
    +</div>
    +<div class="form-check form-switch">
    +  <input class="form-check-input" type="checkbox" role="switch" id="switchCheckDisabled" disabled>
    +  <label class="form-check-label" for="switchCheckDisabled">Disabled switch checkbox input</label>
    +</div>
    +<div class="form-check form-switch">
    +  <input class="form-check-input" type="checkbox" role="switch" id="switchCheckCheckedDisabled" checked disabled>
    +  <label class="form-check-label" for="switchCheckCheckedDisabled">Disabled checked switch checkbox input</label>
    +</div>
    +

    Default (stacked)

    By default, any number of checkboxes and radios that are immediate sibling will be vertically stacked and appropriately spaced with .form-check.

    -
    -
    - -
    +
    - -
    - html -
    - - -
    -
    <div class="form-check">
    -  <input class="form-check-input" type="checkbox" value="" id="defaultCheck1">
    -  <label class="form-check-label" for="defaultCheck1">
    -    Default checkbox
    -  </label>
    -</div>
    -<div class="form-check">
    -  <input class="form-check-input" type="checkbox" value="" id="defaultCheck2" disabled>
    -  <label class="form-check-label" for="defaultCheck2">
    -    Disabled checkbox
    -  </label>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="form-check">
    +  <input class="form-check-input" type="checkbox" value="" id="defaultCheck1">
    +  <label class="form-check-label" for="defaultCheck1">
    +    Default checkbox
    +  </label>
    +</div>
    +<div class="form-check">
    +  <input class="form-check-input" type="checkbox" value="" id="defaultCheck2" disabled>
    +  <label class="form-check-label" for="defaultCheck2">
    +    Disabled checkbox
    +  </label>
    +</div>
    +
    - -
    - html -
    - - -
    -
    <div class="form-check">
    -  <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios1" value="option1" checked>
    -  <label class="form-check-label" for="exampleRadios1">
    -    Default radio
    -  </label>
    -</div>
    -<div class="form-check">
    -  <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios2" value="option2">
    -  <label class="form-check-label" for="exampleRadios2">
    -    Second default radio
    -  </label>
    -</div>
    -<div class="form-check">
    -  <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios3" value="option3" disabled>
    -  <label class="form-check-label" for="exampleRadios3">
    -    Disabled radio
    -  </label>
    -</div>
    -
    - -

    Inline

    +
    html
    <div class="form-check">
    +  <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios1" value="option1" checked>
    +  <label class="form-check-label" for="exampleRadios1">
    +    Default radio
    +  </label>
    +</div>
    +<div class="form-check">
    +  <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios2" value="option2">
    +  <label class="form-check-label" for="exampleRadios2">
    +    Second default radio
    +  </label>
    +</div>
    +<div class="form-check">
    +  <input class="form-check-input" type="radio" name="exampleRadios" id="exampleRadios3" value="option3" disabled>
    +  <label class="form-check-label" for="exampleRadios3">
    +    Disabled radio
    +  </label>
    +</div>
    +

    Inline

    Group checkboxes or radios on the same horizontal row by adding .form-check-inline to any .form-check.

    -
    -
    - -
    +
    @@ -954,36 +254,19 @@
    -
    - -
    - html -
    - - -
    -
    <div class="form-check form-check-inline">
    -  <input class="form-check-input" type="checkbox" id="inlineCheckbox1" value="option1">
    -  <label class="form-check-label" for="inlineCheckbox1">1</label>
    -</div>
    -<div class="form-check form-check-inline">
    -  <input class="form-check-input" type="checkbox" id="inlineCheckbox2" value="option2">
    -  <label class="form-check-label" for="inlineCheckbox2">2</label>
    -</div>
    -<div class="form-check form-check-inline">
    -  <input class="form-check-input" type="checkbox" id="inlineCheckbox3" value="option3" disabled>
    -  <label class="form-check-label" for="inlineCheckbox3">3 (disabled)</label>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="form-check form-check-inline">
    +  <input class="form-check-input" type="checkbox" id="inlineCheckbox1" value="option1">
    +  <label class="form-check-label" for="inlineCheckbox1">1</label>
    +</div>
    +<div class="form-check form-check-inline">
    +  <input class="form-check-input" type="checkbox" id="inlineCheckbox2" value="option2">
    +  <label class="form-check-label" for="inlineCheckbox2">2</label>
    +</div>
    +<div class="form-check form-check-inline">
    +  <input class="form-check-input" type="checkbox" id="inlineCheckbox3" value="option3" disabled>
    +  <label class="form-check-label" for="inlineCheckbox3">3 (disabled)</label>
    +</div>
    +
    @@ -994,38 +277,21 @@
    -
    - -
    - html -
    - - -
    -
    <div class="form-check form-check-inline">
    -  <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1">
    -  <label class="form-check-label" for="inlineRadio1">1</label>
    -</div>
    -<div class="form-check form-check-inline">
    -  <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2">
    -  <label class="form-check-label" for="inlineRadio2">2</label>
    -</div>
    -<div class="form-check form-check-inline">
    -  <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3" disabled>
    -  <label class="form-check-label" for="inlineRadio3">3 (disabled)</label>
    -</div>
    -
    - -

    Reverse

    +
    html
    <div class="form-check form-check-inline">
    +  <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio1" value="option1">
    +  <label class="form-check-label" for="inlineRadio1">1</label>
    +</div>
    +<div class="form-check form-check-inline">
    +  <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio2" value="option2">
    +  <label class="form-check-label" for="inlineRadio2">2</label>
    +</div>
    +<div class="form-check form-check-inline">
    +  <input class="form-check-input" type="radio" name="inlineRadioOptions" id="inlineRadio3" value="option3" disabled>
    +  <label class="form-check-label" for="inlineRadio3">3 (disabled)</label>
    +</div>
    +

    Reverse

    Put your checkboxes, radios, and switches on the opposite side with the .form-check-reverse modifier class.

    -
    -
    - -
    +
    html
    <div class="form-check form-check-reverse">
    +  <input class="form-check-input" type="checkbox" value="" id="reverseCheck1">
    +  <label class="form-check-label" for="reverseCheck1">
    +    Reverse checkbox
    +  </label>
    +</div>
    +<div class="form-check form-check-reverse">
    +  <input class="form-check-input" type="checkbox" value="" id="reverseCheck2" disabled>
    +  <label class="form-check-label" for="reverseCheck2">
    +    Disabled reverse checkbox
    +  </label>
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="form-check form-check-reverse">
    -  <input class="form-check-input" type="checkbox" value="" id="reverseCheck1">
    -  <label class="form-check-label" for="reverseCheck1">
    -    Reverse checkbox
    -  </label>
    -</div>
    -<div class="form-check form-check-reverse">
    -  <input class="form-check-input" type="checkbox" value="" id="reverseCheck2" disabled>
    -  <label class="form-check-label" for="reverseCheck2">
    -    Disabled reverse checkbox
    -  </label>
    -</div>
    -
    -<div class="form-check form-switch form-check-reverse">
    -  <input class="form-check-input" type="checkbox" id="switchCheckReverse">
    -  <label class="form-check-label" for="switchCheckReverse">Reverse switch checkbox input</label>
    -</div>
    -
    - -

    Without labels

    +<div class="form-check form-switch form-check-reverse"> + <input class="form-check-input" type="checkbox" id="switchCheckReverse"> + <label class="form-check-label" for="switchCheckReverse">Reverse switch checkbox input</label> +</div>
    +

    Without labels

    Omit the wrapping .form-check for checkboxes and radios that have no label text. Remember to still provide some form of accessible name for assistive technologies (for instance, using aria-label). See the forms overview accessibility section for details.

    -
    -
    - -
    +
    -
    +
    html
    <div>
    +  <input class="form-check-input" type="checkbox" id="checkboxNoLabel" value="" aria-label="...">
    +</div>
     
    -  
    - html -
    - - -
    -
    <div>
    -  <input class="form-check-input" type="checkbox" id="checkboxNoLabel" value="" aria-label="...">
    -</div>
    -
    -<div>
    -  <input class="form-check-input" type="radio" name="radioNoLabel" id="radioNoLabel1" value="" aria-label="...">
    -</div>
    -
    - -

    Toggle buttons

    -

    Create button-like checkboxes and radio buttons by using .btn styles rather than .form-check-label on the <label> elements. These toggle buttons can further be grouped in a button group if needed.

    -

    Checkbox toggle buttons

    -
    -
    - - +<div> + <input class="form-check-input" type="radio" name="radioNoLabel" id="radioNoLabel1" value="" aria-label="..."> +</div>
    +

    Toggle buttons

    +

    Create button-like checkboxes and radio buttons by using .btn styles rather than .form-check-label on the <label> elements. These toggle buttons can further be grouped in a button group if needed.

    +

    Checkbox toggle buttons

    +
    - +
    html
    <input type="checkbox" class="btn-check" id="btn-check" autocomplete="off">
    +<label class="btn btn-primary" for="btn-check">Single toggle</label>
     
    -  
    - html -
    - - -
    -
    <input type="checkbox" class="btn-check" id="btn-check" autocomplete="off">
    -<label class="btn btn-primary" for="btn-check">Single toggle</label>
    -
    -<input type="checkbox" class="btn-check" id="btn-check-2" checked autocomplete="off">
    -<label class="btn btn-primary" for="btn-check-2">Checked</label>
    -
    -<input type="checkbox" class="btn-check" id="btn-check-3" autocomplete="off" disabled>
    -<label class="btn btn-primary" for="btn-check-3">Disabled</label>
    -
    +<input type="checkbox" class="btn-check" id="btn-check-2" checked autocomplete="off"> +<label class="btn btn-primary" for="btn-check-2">Checked</label> -
    -
    - - +<input type="checkbox" class="btn-check" id="btn-check-3" autocomplete="off" disabled> +<label class="btn btn-primary" for="btn-check-3">Disabled</label>
    +
    - +
    html
    <input type="checkbox" class="btn-check" id="btn-check-4" autocomplete="off">
    +<label class="btn" for="btn-check-4">Single toggle</label>
     
    -  
    - html -
    - - -
    -
    <input type="checkbox" class="btn-check" id="btn-check-4" autocomplete="off">
    -<label class="btn" for="btn-check-4">Single toggle</label>
    -
    -<input type="checkbox" class="btn-check" id="btn-check-5" checked autocomplete="off">
    -<label class="btn" for="btn-check-5">Checked</label>
    -
    -<input type="checkbox" class="btn-check" id="btn-check-6" autocomplete="off" disabled>
    -<label class="btn" for="btn-check-6">Disabled</label>
    -
    +<input type="checkbox" class="btn-check" id="btn-check-5" checked autocomplete="off"> +<label class="btn" for="btn-check-5">Checked</label> -
    -Visually, these checkbox toggle buttons are identical to the button plugin toggle buttons. However, they are conveyed differently by assistive technologies: the checkbox toggles will be announced by screen readers as “checked”/“not checked” (since, despite their appearance, they are fundamentally still checkboxes), whereas the button plugin toggle buttons will be announced as “button”/“button pressed”. The choice between these two approaches will depend on the type of toggle you are creating, and whether or not the toggle will make sense to users when announced as a checkbox or as an actual button. -
    - -

    Radio toggle buttons

    -
    -
    - - +<input type="checkbox" class="btn-check" id="btn-check-6" autocomplete="off" disabled> +<label class="btn" for="btn-check-6">Disabled</label>
    +

    Visually, these checkbox toggle buttons are identical to the button plugin toggle buttons. However, they are conveyed differently by assistive technologies: the checkbox toggles will be announced by screen readers as “checked”/“not checked” (since, despite their appearance, they are fundamentally still checkboxes), whereas the button plugin toggle buttons will be announced as “button”/“button pressed”. The choice between these two approaches will depend on the type of toggle you are creating, and whether or not the toggle will make sense to users when announced as a checkbox or as an actual button.

    +

    Radio toggle buttons

    + +<input type="radio" class="btn-check" name="options" id="option2" autocomplete="off"> +<label class="btn btn-secondary" for="option2">Radio</label> -
    -
    - - +<input type="radio" class="btn-check" name="options" id="option3" autocomplete="off" disabled> +<label class="btn btn-secondary" for="option3">Disabled</label> + +<input type="radio" class="btn-check" name="options" id="option4" autocomplete="off"> +<label class="btn btn-secondary" for="option4">Radio</label>
    +
    +<input type="radio" class="btn-check" name="options-base" id="option6" autocomplete="off"> +<label class="btn" for="option6">Radio</label> -

    Outlined styles

    +<input type="radio" class="btn-check" name="options-base" id="option7" autocomplete="off" disabled> +<label class="btn" for="option7">Disabled</label> + +<input type="radio" class="btn-check" name="options-base" id="option8" autocomplete="off"> +<label class="btn" for="option8">Radio</label>
    +

    Outlined styles

    Different variants of .btn, such as the various outlined styles, are supported.

    -
    -
    - - + +<input type="checkbox" class="btn-check" id="btn-check-2-outlined" checked autocomplete="off"> +<label class="btn btn-outline-secondary" for="btn-check-2-outlined">Checked</label><br> -

    CSS

    -

    Sass variables

    +<input type="radio" class="btn-check" name="options-outlined" id="success-outlined" autocomplete="off" checked> +<label class="btn btn-outline-success" for="success-outlined">Checked success radio</label> + +<input type="radio" class="btn-check" name="options-outlined" id="danger-outlined" autocomplete="off"> +<label class="btn btn-outline-danger" for="danger-outlined">Danger radio</label>
    +

    CSS

    +

    Sass variables

    Variables for checks:

    -
    -
    - scss/_variables.scss -
    - -
    -
    $form-check-input-width:                  1em;
    -$form-check-min-height:                   $font-size-base * $line-height-base;
    -$form-check-padding-start:                $form-check-input-width + .5em;
    -$form-check-margin-bottom:                .125rem;
    -$form-check-label-color:                  null;
    -$form-check-label-cursor:                 null;
    -$form-check-transition:                   null;
    -
    -$form-check-input-active-filter:          brightness(90%);
    -
    -$form-check-input-bg:                     $input-bg;
    -$form-check-input-border:                 var(--#{$prefix}border-width) solid var(--#{$prefix}border-color);
    -$form-check-input-border-radius:          .25em;
    -$form-check-radio-border-radius:          50%;
    -$form-check-input-focus-border:           $input-focus-border-color;
    -$form-check-input-focus-box-shadow:       $focus-ring-box-shadow;
    -
    -$form-check-input-checked-color:          $component-active-color;
    -$form-check-input-checked-bg-color:       $component-active-bg;
    -$form-check-input-checked-border-color:   $form-check-input-checked-bg-color;
    -$form-check-input-checked-bg-image:       url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='none' stroke='#{$form-check-input-checked-color}' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/></svg>");
    -$form-check-radio-checked-bg-image:       url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='2' fill='#{$form-check-input-checked-color}'/></svg>");
    -
    -$form-check-input-indeterminate-color:          $component-active-color;
    -$form-check-input-indeterminate-bg-color:       $component-active-bg;
    -$form-check-input-indeterminate-border-color:   $form-check-input-indeterminate-bg-color;
    -$form-check-input-indeterminate-bg-image:       url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='none' stroke='#{$form-check-input-indeterminate-color}' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10h8'/></svg>");
    -
    -$form-check-input-disabled-opacity:        .5;
    -$form-check-label-disabled-opacity:        $form-check-input-disabled-opacity;
    -$form-check-btn-check-disabled-opacity:    $btn-disabled-opacity;
    -
    -$form-check-inline-margin-end:    1rem;
    -
    +
    $form-check-input-width:                  1em;
    +$form-check-min-height:                   $font-size-base * $line-height-base;
    +$form-check-padding-start:                $form-check-input-width + .5em;
    +$form-check-margin-bottom:                .125rem;
    +$form-check-label-color:                  null;
    +$form-check-label-cursor:                 null;
    +$form-check-transition:                   null;
    +
    +$form-check-input-active-filter:          brightness(90%);
    +
    +$form-check-input-bg:                     $input-bg;
    +$form-check-input-border:                 var(--#{$prefix}border-width) solid var(--#{$prefix}border-color);
    +$form-check-input-border-radius:          .25em;
    +$form-check-radio-border-radius:          50%;
    +$form-check-input-focus-border:           $input-focus-border-color;
    +$form-check-input-focus-box-shadow:       $focus-ring-box-shadow;
    +
    +$form-check-input-checked-color:          $component-active-color;
    +$form-check-input-checked-bg-color:       $component-active-bg;
    +$form-check-input-checked-border-color:   $form-check-input-checked-bg-color;
    +$form-check-input-checked-bg-image:       url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='none' stroke='#{$form-check-input-checked-color}' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/></svg>");
    +$form-check-radio-checked-bg-image:       url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='2' fill='#{$form-check-input-checked-color}'/></svg>");
    +
    +$form-check-input-indeterminate-color:          $component-active-color;
    +$form-check-input-indeterminate-bg-color:       $component-active-bg;
    +$form-check-input-indeterminate-border-color:   $form-check-input-indeterminate-bg-color;
    +$form-check-input-indeterminate-bg-image:       url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='none' stroke='#{$form-check-input-indeterminate-color}' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10h8'/></svg>");
    +
    +$form-check-input-disabled-opacity:        .5;
    +$form-check-label-disabled-opacity:        $form-check-input-disabled-opacity;
    +$form-check-btn-check-disabled-opacity:    $btn-disabled-opacity;
    +
    +$form-check-inline-margin-end:    1rem;
    +

    Variables for switches:

    -
    -
    - scss/_variables.scss -
    - -
    -
    $form-switch-color:               rgba($black, .25);
    -$form-switch-width:               2em;
    -$form-switch-padding-start:       $form-switch-width + .5em;
    -$form-switch-bg-image:            url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='#{$form-switch-color}'/></svg>");
    -$form-switch-border-radius:       $form-switch-width;
    -$form-switch-transition:          background-position .15s ease-in-out;
    -
    -$form-switch-focus-color:         $input-focus-border-color;
    -$form-switch-focus-bg-image:      url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='#{$form-switch-focus-color}'/></svg>");
    -
    -$form-switch-checked-color:       $component-active-color;
    -$form-switch-checked-bg-image:    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='#{$form-switch-checked-color}'/></svg>");
    -$form-switch-checked-bg-position: right center;
    -
    +
    $form-switch-color:               rgba($black, .25);
    +$form-switch-width:               2em;
    +$form-switch-padding-start:       $form-switch-width + .5em;
    +$form-switch-bg-image:            url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='#{$form-switch-color}'/></svg>");
    +$form-switch-border-radius:       $form-switch-width;
    +$form-switch-transition:          background-position .15s ease-in-out;
     
    -      
    -
    -
    +$form-switch-focus-color: $input-focus-border-color; +$form-switch-focus-bg-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='#{$form-switch-focus-color}'/></svg>"); - - - - - - - - - - - - - - +$form-switch-checked-color: $component-active-color; +$form-switch-checked-bg-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'><circle r='3' fill='#{$form-switch-checked-color}'/></svg>"); +$form-switch-checked-bg-position: right center; +
    \ No newline at end of file diff --git a/docs/5.3/forms/checks/index.html b/docs/5.3/forms/checks/index.html index 50c626b8e4..adb4a917dd 100644 --- a/docs/5.3/forms/checks/index.html +++ b/docs/5.3/forms/checks/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/forms/checks-radios/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/forms/floating-labels/index.html b/docs/5.3/forms/floating-labels/index.html index 112818e18f..cd64d4dc60 100644 --- a/docs/5.3/forms/floating-labels/index.html +++ b/docs/5.3/forms/floating-labels/index.html @@ -1,711 +1,79 @@ - - - - - - - - - - - - - - - - -Floating labels · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Floating labels

    -
    -

    Create beautifully simple form labels that float over your input fields.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Example

    -

    Wrap a pair of <input class="form-control"> and <label> elements in .form-floating to enable floating labels with Bootstrap’s textual form fields. A placeholder is required on each <input> as our method of CSS-only floating labels uses the :placeholder-shown pseudo-element. Also note that the <input> must come first so we can utilize a sibling selector (e.g., ~).

    -
    -
    - -
    + Floating labels · Bootstrap v5.3

    Floating labels

    Create beautifully simple form labels that float over your input fields.

    +

    Example

    +

    Wrap a pair of <input class="form-control"> and <label> elements in .form-floating to enable floating labels with Bootstrap’s textual form fields. A placeholder is required on each <input> as our method of CSS-only floating labels uses the :placeholder-shown pseudo-element. Also note that the <input> must come first so we can utilize a sibling selector (i.e., ~).

    +
    -
    - -
    - html -
    - - -
    -
    <div class="form-floating mb-3">
    -  <input type="email" class="form-control" id="floatingInput" placeholder="name@example.com">
    -  <label for="floatingInput">Email address</label>
    -</div>
    -<div class="form-floating">
    -  <input type="password" class="form-control" id="floatingPassword" placeholder="Password">
    -  <label for="floatingPassword">Password</label>
    -</div>
    -
    - -

    When there’s a value already defined, <label>s will automatically adjust to their floated position.

    -
    -
    - -
    +
    html
    <div class="form-floating mb-3">
    +  <input type="email" class="form-control" id="floatingInput" placeholder="name@example.com">
    +  <label for="floatingInput">Email address</label>
    +</div>
    +<div class="form-floating">
    +  <input type="password" class="form-control" id="floatingPassword" placeholder="Password">
    +  <label for="floatingPassword">Password</label>
    +</div>
    +

    When there’s a value already defined, <label>s will automatically adjust to their floated position.

    +
    - - -
    - html -
    - - -
    -
    <form class="form-floating">
    -  <input type="email" class="form-control" id="floatingInputValue" placeholder="name@example.com" value="test@example.com">
    -  <label for="floatingInputValue">Input with value</label>
    -</form>
    -
    - +
    html
    <form class="form-floating">
    +  <input type="email" class="form-control" id="floatingInputValue" placeholder="name@example.com" value="test@example.com">
    +  <label for="floatingInputValue">Input with value</label>
    +</form>

    Form validation styles also work as expected.

    -
    -
    - -
    +
    - - -
    - html -
    - - -
    -
    <form class="form-floating">
    -  <input type="email" class="form-control is-invalid" id="floatingInputInvalid" placeholder="name@example.com" value="test@example.com">
    -  <label for="floatingInputInvalid">Invalid input</label>
    -</form>
    -
    - -

    Textareas

    +
    html
    <form class="form-floating">
    +  <input type="email" class="form-control is-invalid" id="floatingInputInvalid" placeholder="name@example.com" value="test@example.com">
    +  <label for="floatingInputInvalid">Invalid input</label>
    +</form>
    +

    Textareas

    By default, <textarea>s with .form-control will be the same height as <input>s.

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="form-floating">
    -  <textarea class="form-control" placeholder="Leave a comment here" id="floatingTextarea"></textarea>
    -  <label for="floatingTextarea">Comments</label>
    -</div>
    -
    - +
    html
    <div class="form-floating">
    +  <textarea class="form-control" placeholder="Leave a comment here" id="floatingTextarea"></textarea>
    +  <label for="floatingTextarea">Comments</label>
    +</div>

    To set a custom height on your <textarea>, do not use the rows attribute. Instead, set an explicit height (either inline or via custom CSS).

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="form-floating">
    -  <textarea class="form-control" placeholder="Leave a comment here" id="floatingTextarea2" style="height: 100px"></textarea>
    -  <label for="floatingTextarea2">Comments</label>
    -</div>
    -
    - -

    Selects

    -

    Other than .form-control, floating labels are only available on .form-selects. They work in the same way, but unlike <input>s, they’ll always show the <label> in its floated state. Selects with size and multiple are not supported.

    -
    -
    - -
    +
    html
    <div class="form-floating">
    +  <textarea class="form-control" placeholder="Leave a comment here" id="floatingTextarea2" style="height: 100px"></textarea>
    +  <label for="floatingTextarea2">Comments</label>
    +</div>
    +

    Selects

    +

    Other than .form-control, floating labels are only available on .form-selects. They work in the same way, but unlike <input>s, they’ll always show the <label> in its floated state. Selects with size and multiple are not supported.

    +
    -
    - -
    - html -
    - - -
    -
    <div class="form-floating">
    -  <select class="form-select" id="floatingSelect" aria-label="Floating label select example">
    -    <option selected>Open this select menu</option>
    -    <option value="1">One</option>
    -    <option value="2">Two</option>
    -    <option value="3">Three</option>
    -  </select>
    -  <label for="floatingSelect">Works with selects</label>
    -</div>
    -
    - -

    Disabled

    +
    html
    <div class="form-floating">
    +  <select class="form-select" id="floatingSelect" aria-label="Floating label select example">
    +    <option selected>Open this select menu</option>
    +    <option value="1">One</option>
    +    <option value="2">Two</option>
    +    <option value="3">Three</option>
    +  </select>
    +  <label for="floatingSelect">Works with selects</label>
    +</div>
    +

    Disabled

    Add the disabled boolean attribute on an input, a textarea or a select to give it a grayed out appearance, remove pointer events, and prevent focusing.

    -
    -
    - -
    +
    @@ -761,112 +112,61 @@ -
    - -
    - html -
    - - -
    -
    <div class="form-floating mb-3">
    -  <input type="email" class="form-control" id="floatingInputDisabled" placeholder="name@example.com" disabled>
    -  <label for="floatingInputDisabled">Email address</label>
    -</div>
    -<div class="form-floating mb-3">
    -  <textarea class="form-control" placeholder="Leave a comment here" id="floatingTextareaDisabled" disabled></textarea>
    -  <label for="floatingTextareaDisabled">Comments</label>
    -</div>
    -<div class="form-floating mb-3">
    -  <textarea class="form-control" placeholder="Leave a comment here" id="floatingTextarea2Disabled" style="height: 100px" disabled>Disabled textarea with some text inside</textarea>
    -  <label for="floatingTextarea2Disabled">Comments</label>
    -</div>
    -<div class="form-floating">
    -  <select class="form-select" id="floatingSelectDisabled" aria-label="Floating label disabled select example" disabled>
    -    <option selected>Open this select menu</option>
    -    <option value="1">One</option>
    -    <option value="2">Two</option>
    -    <option value="3">Three</option>
    -  </select>
    -  <label for="floatingSelectDisabled">Works with selects</label>
    -</div>
    -
    - -

    Readonly plaintext

    +
    html
    <div class="form-floating mb-3">
    +  <input type="email" class="form-control" id="floatingInputDisabled" placeholder="name@example.com" disabled>
    +  <label for="floatingInputDisabled">Email address</label>
    +</div>
    +<div class="form-floating mb-3">
    +  <textarea class="form-control" placeholder="Leave a comment here" id="floatingTextareaDisabled" disabled></textarea>
    +  <label for="floatingTextareaDisabled">Comments</label>
    +</div>
    +<div class="form-floating mb-3">
    +  <textarea class="form-control" placeholder="Leave a comment here" id="floatingTextarea2Disabled" style="height: 100px" disabled>Disabled textarea with some text inside</textarea>
    +  <label for="floatingTextarea2Disabled">Comments</label>
    +</div>
    +<div class="form-floating">
    +  <select class="form-select" id="floatingSelectDisabled" aria-label="Floating label disabled select example" disabled>
    +    <option selected>Open this select menu</option>
    +    <option value="1">One</option>
    +    <option value="2">Two</option>
    +    <option value="3">Three</option>
    +  </select>
    +  <label for="floatingSelectDisabled">Works with selects</label>
    +</div>
    +

    Readonly plaintext

    Floating labels also support .form-control-plaintext, which can be helpful for toggling from an editable <input> to a plaintext value without affecting the page layout.

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="form-floating mb-3">
    -  <input type="email" readonly class="form-control-plaintext" id="floatingEmptyPlaintextInput" placeholder="name@example.com">
    -  <label for="floatingEmptyPlaintextInput">Empty input</label>
    -</div>
    -<div class="form-floating mb-3">
    -  <input type="email" readonly class="form-control-plaintext" id="floatingPlaintextInput" placeholder="name@example.com" value="name@example.com">
    -  <label for="floatingPlaintextInput">Input with value</label>
    -</div>
    -
    - -

    Input groups

    +
    html
    <div class="form-floating mb-3">
    +  <input type="email" readonly class="form-control-plaintext" id="floatingEmptyPlaintextInput" placeholder="name@example.com">
    +  <label for="floatingEmptyPlaintextInput">Empty input</label>
    +</div>
    +<div class="form-floating mb-3">
    +  <input type="email" readonly class="form-control-plaintext" id="floatingPlaintextInput" placeholder="name@example.com" value="name@example.com">
    +  <label for="floatingPlaintextInput">Input with value</label>
    +</div>
    +

    Input groups

    Floating labels also support .input-group.

    -
    -
    - -
    +
    @
    -
    - -
    - html -
    - - -
    -
    <div class="input-group mb-3">
    -  <span class="input-group-text">@</span>
    -  <div class="form-floating">
    -    <input type="text" class="form-control" id="floatingInputGroup1" placeholder="Username">
    -    <label for="floatingInputGroup1">Username</label>
    -  </div>
    -</div>
    -
    - +
    html
    <div class="input-group mb-3">
    +  <span class="input-group-text">@</span>
    +  <div class="form-floating">
    +    <input type="text" class="form-control" id="floatingInputGroup1" placeholder="Username">
    +    <label for="floatingInputGroup1">Username</label>
    +  </div>
    +</div>

    When using .input-group and .form-floating along with form validation, the -feedback should be placed outside of the .form-floating, but inside of the .input-group. This means that the feedback will need to be shown using javascript.

    -
    -
    - -
    +
    @
    @@ -875,36 +175,19 @@
    Please choose a username.
    -
    - -
    - html -
    - - -
    -
    <div class="input-group has-validation">
    -  <span class="input-group-text">@</span>
    -  <div class="form-floating is-invalid">
    -    <input type="text" class="form-control is-invalid" id="floatingInputGroup2" placeholder="Username" required>
    -    <label for="floatingInputGroup2">Username</label>
    -  </div>
    -  <div class="invalid-feedback">
    -    Please choose a username.
    -  </div>
    -</div>
    -
    - -

    Layout

    +
    html
    <div class="input-group has-validation">
    +  <span class="input-group-text">@</span>
    +  <div class="form-floating is-invalid">
    +    <input type="text" class="form-control is-invalid" id="floatingInputGroup2" placeholder="Username" required>
    +    <label for="floatingInputGroup2">Username</label>
    +  </div>
    +  <div class="invalid-feedback">
    +    Please choose a username.
    +  </div>
    +</div>
    +

    Layout

    When working with the Bootstrap grid system, be sure to place form elements within column classes.

    -
    -
    - -
    +
    @@ -922,135 +205,40 @@
    -
    - -
    - html -
    - - -
    -
    <div class="row g-2">
    -  <div class="col-md">
    -    <div class="form-floating">
    -      <input type="email" class="form-control" id="floatingInputGrid" placeholder="name@example.com" value="mdo@example.com">
    -      <label for="floatingInputGrid">Email address</label>
    -    </div>
    -  </div>
    -  <div class="col-md">
    -    <div class="form-floating">
    -      <select class="form-select" id="floatingSelectGrid">
    -        <option selected>Open this select menu</option>
    -        <option value="1">One</option>
    -        <option value="2">Two</option>
    -        <option value="3">Three</option>
    -      </select>
    -      <label for="floatingSelectGrid">Works with selects</label>
    -    </div>
    -  </div>
    -</div>
    -
    - -

    CSS

    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $form-floating-height:                  add(3.5rem, $input-height-border);
    -$form-floating-line-height:             1.25;
    -$form-floating-padding-x:               $input-padding-x;
    -$form-floating-padding-y:               1rem;
    -$form-floating-input-padding-t:         1.625rem;
    -$form-floating-input-padding-b:         .625rem;
    -$form-floating-label-height:            1.5em;
    -$form-floating-label-opacity:           .65;
    -$form-floating-label-transform:         scale(.85) translateY(-.5rem) translateX(.15rem);
    -$form-floating-label-disabled-color:    $gray-600;
    -$form-floating-transition:              opacity .1s ease-in-out, transform .1s ease-in-out;
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    html
    <div class="row g-2">
    +  <div class="col-md">
    +    <div class="form-floating">
    +      <input type="email" class="form-control" id="floatingInputGrid" placeholder="name@example.com" value="mdo@example.com">
    +      <label for="floatingInputGrid">Email address</label>
    +    </div>
    +  </div>
    +  <div class="col-md">
    +    <div class="form-floating">
    +      <select class="form-select" id="floatingSelectGrid">
    +        <option selected>Open this select menu</option>
    +        <option value="1">One</option>
    +        <option value="2">Two</option>
    +        <option value="3">Three</option>
    +      </select>
    +      <label for="floatingSelectGrid">Works with selects</label>
    +    </div>
    +  </div>
    +</div>
    +

    CSS

    +

    Sass variables

    +
    $form-floating-height:                  add(3.5rem, $input-height-border);
    +$form-floating-line-height:             1.25;
    +$form-floating-padding-x:               $input-padding-x;
    +$form-floating-padding-y:               1rem;
    +$form-floating-input-padding-t:         1.625rem;
    +$form-floating-input-padding-b:         .625rem;
    +$form-floating-label-height:            1.5em;
    +$form-floating-label-opacity:           .65;
    +$form-floating-label-transform:         scale(.85) translateY(-.5rem) translateX(.15rem);
    +$form-floating-label-disabled-color:    $gray-600;
    +$form-floating-transition:              opacity .1s ease-in-out, transform .1s ease-in-out;
    +
    \ No newline at end of file diff --git a/docs/5.3/forms/form-control/index.html b/docs/5.3/forms/form-control/index.html index 2f63984b6f..7c411ed69f 100644 --- a/docs/5.3/forms/form-control/index.html +++ b/docs/5.3/forms/form-control/index.html @@ -1,668 +1,65 @@ - - - - - - - - - - - - - - - - -Form controls · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Form controls

    -
    -

    Give textual form controls like <input>s and <textarea>s an upgrade with custom styles, sizing, focus states, and more.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Example

    + Form controls · Bootstrap v5.3

    Form controls

    Give textual form controls like <input>s and <textarea>s an upgrade with custom styles, sizing, focus states, and more.

    +

    Example

    Form controls are styled with a mix of Sass and CSS variables, allowing them to adapt to color modes and support any customization method.

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="mb-3">
    -  <label for="exampleFormControlInput1" class="form-label">Email address</label>
    -  <input type="email" class="form-control" id="exampleFormControlInput1" placeholder="name@example.com">
    -</div>
    -<div class="mb-3">
    -  <label for="exampleFormControlTextarea1" class="form-label">Example textarea</label>
    -  <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea>
    -</div>
    -
    - -

    Sizing

    +
    html
    <div class="mb-3">
    +  <label for="exampleFormControlInput1" class="form-label">Email address</label>
    +  <input type="email" class="form-control" id="exampleFormControlInput1" placeholder="name@example.com">
    +</div>
    +<div class="mb-3">
    +  <label for="exampleFormControlTextarea1" class="form-label">Example textarea</label>
    +  <textarea class="form-control" id="exampleFormControlTextarea1" rows="3"></textarea>
    +</div>
    +

    Sizing

    Set heights using classes like .form-control-lg and .form-control-sm.

    -
    -
    - - +
    - - -
    - html -
    - - -
    -
    <input class="form-control form-control-lg" type="text" placeholder=".form-control-lg" aria-label=".form-control-lg example">
    -<input class="form-control" type="text" placeholder="Default input" aria-label="default input example">
    -<input class="form-control form-control-sm" type="text" placeholder=".form-control-sm" aria-label=".form-control-sm example">
    -
    - -

    Form text

    +
    html
    <input class="form-control form-control-lg" type="text" placeholder=".form-control-lg" aria-label=".form-control-lg example">
    +<input class="form-control" type="text" placeholder="Default input" aria-label="default input example">
    +<input class="form-control form-control-sm" type="text" placeholder=".form-control-sm" aria-label=".form-control-sm example">
    +

    Form text

    Block-level or inline-level form text can be created using .form-text.

    -
    -Form text should be explicitly associated with the form control it relates to using the aria-describedby attribute. This will ensure that assistive technologies—such as screen readers—will announce this form text when the user focuses or enters the control. -
    - +

    Form text should be explicitly associated with the form control it relates to using the aria-describedby attribute. This will ensure that assistive technologies—such as screen readers—will announce this form text when the user focuses or enters the control.

    Form text below inputs can be styled with .form-text. If a block-level element will be used, a top margin is added for easy spacing from the inputs above.

    -
    -
    - - +
    Your password must be 8-20 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji. -
    - -
    - html -
    - - -
    -
    <label for="inputPassword5" class="form-label">Password</label>
    -<input type="password" id="inputPassword5" class="form-control" aria-describedby="passwordHelpBlock">
    -<div id="passwordHelpBlock" class="form-text">
    -  Your password must be 8-20 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji.
    -</div>
    -
    - +
    html
    <label for="inputPassword5" class="form-label">Password</label>
    +<input type="password" id="inputPassword5" class="form-control" aria-describedby="passwordHelpBlock">
    +<div id="passwordHelpBlock" class="form-text">
    +  Your password must be 8-20 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji.
    +</div>

    Inline text can use any typical inline HTML element (be it a <span>, <small>, or something else) with nothing more than the .form-text class.

    -
    -
    - -
    +
    @@ -674,121 +71,53 @@ Form text should be explicitly associated with the form control it relates to us Must be 8-20 characters long.
    -
    - -
    - html -
    - - -
    -
    <div class="row g-3 align-items-center">
    -  <div class="col-auto">
    -    <label for="inputPassword6" class="col-form-label">Password</label>
    -  </div>
    -  <div class="col-auto">
    -    <input type="password" id="inputPassword6" class="form-control" aria-describedby="passwordHelpInline">
    -  </div>
    -  <div class="col-auto">
    -    <span id="passwordHelpInline" class="form-text">
    -      Must be 8-20 characters long.
    -    </span>
    -  </div>
    -</div>
    -
    - -

    Disabled

    +
    html
    <div class="row g-3 align-items-center">
    +  <div class="col-auto">
    +    <label for="inputPassword6" class="col-form-label">Password</label>
    +  </div>
    +  <div class="col-auto">
    +    <input type="password" id="inputPassword6" class="form-control" aria-describedby="passwordHelpInline">
    +  </div>
    +  <div class="col-auto">
    +    <span id="passwordHelpInline" class="form-text">
    +      Must be 8-20 characters long.
    +    </span>
    +  </div>
    +</div>
    +

    Disabled

    Add the disabled boolean attribute on an input to give it a grayed out appearance, remove pointer events, and prevent focusing.

    -
    -
    - - - - -
    - html -
    - - -
    -
    <input class="form-control" type="text" placeholder="Disabled input" aria-label="Disabled input example" disabled>
    -<input class="form-control" type="text" value="Disabled readonly input" aria-label="Disabled input example" disabled readonly>
    -
    - -

    Readonly

    -

    Add the readonly boolean attribute on an input to prevent modification of the input’s value. readonly inputs can still be focused and selected, while disabled inputs cannot.

    -
    -
    - - - -
    - html -
    - - -
    -
    <input class="form-control" type="text" value="Readonly input here..." aria-label="readonly input example" readonly>
    -
    - -

    Readonly plain text

    +
    +
    html
    <input class="form-control" type="text" placeholder="Disabled input" aria-label="Disabled input example" disabled>
    +<input class="form-control" type="text" value="Disabled readonly input" aria-label="Disabled input example" disabled readonly>
    +

    Readonly

    +

    Add the readonly boolean attribute on an input to prevent modification of the input’s value. readonly inputs can still be focused and selected, while disabled inputs cannot.

    +
    html
    <input class="form-control" type="text" value="Readonly input here..." aria-label="readonly input example" readonly>
    +

    Readonly plain text

    If you want to have <input readonly> elements in your form styled as plain text, replace .form-control with .form-control-plaintext to remove the default form field styling and preserve the correct margin and padding.

    -
    -
    - -
    - -
    - -
    +
    + +
    +
    -
    - -
    - -
    -
    - -
    - html -
    - - -
    -
      <div class="mb-3 row">
    -    <label for="staticEmail" class="col-sm-2 col-form-label">Email</label>
    -    <div class="col-sm-10">
    -      <input type="text" readonly class="form-control-plaintext" id="staticEmail" value="email@example.com">
    -    </div>
    -  </div>
    -  <div class="mb-3 row">
    -    <label for="inputPassword" class="col-sm-2 col-form-label">Password</label>
    -    <div class="col-sm-10">
    -      <input type="password" class="form-control" id="inputPassword">
    -    </div>
    -  </div>
    - -
    -
    - -
    +
    + +
    + +
    +
    html
    <div class="mb-3 row">
    +  <label for="staticEmail" class="col-sm-2 col-form-label">Email</label>
    +  <div class="col-sm-10">
    +    <input type="text" readonly class="form-control-plaintext" id="staticEmail" value="email@example.com">
    +  </div>
    +</div>
    +<div class="mb-3 row">
    +  <label for="inputPassword" class="col-sm-2 col-form-label">Password</label>
    +  <div class="col-sm-10">
    +    <input type="password" class="form-control" id="inputPassword">
    +  </div>
    +</div>
    +
    @@ -800,38 +129,21 @@ Form text should be explicitly associated with the form control it relates to us
    - - -
    - html -
    - - -
    -
    <form class="row g-3">
    -  <div class="col-auto">
    -    <label for="staticEmail2" class="visually-hidden">Email</label>
    -    <input type="text" readonly class="form-control-plaintext" id="staticEmail2" value="email@example.com">
    -  </div>
    -  <div class="col-auto">
    -    <label for="inputPassword2" class="visually-hidden">Password</label>
    -    <input type="password" class="form-control" id="inputPassword2" placeholder="Password">
    -  </div>
    -  <div class="col-auto">
    -    <button type="submit" class="btn btn-primary mb-3">Confirm identity</button>
    -  </div>
    -</form>
    -
    - -

    File input

    -
    -
    - -
    +
    html
    <form class="row g-3">
    +  <div class="col-auto">
    +    <label for="staticEmail2" class="visually-hidden">Email</label>
    +    <input type="text" readonly class="form-control-plaintext" id="staticEmail2" value="email@example.com">
    +  </div>
    +  <div class="col-auto">
    +    <label for="inputPassword2" class="visually-hidden">Password</label>
    +    <input type="password" class="form-control" id="inputPassword2" placeholder="Password">
    +  </div>
    +  <div class="col-auto">
    +    <button type="submit" class="btn btn-primary mb-3">Confirm identity</button>
    +  </div>
    +</form>
    +

    File input

    +
    @@ -850,69 +162,35 @@ Form text should be explicitly associated with the form control it relates to us
    -
    - -
    - html -
    - - -
    -
    <div class="mb-3">
    -  <label for="formFile" class="form-label">Default file input example</label>
    -  <input class="form-control" type="file" id="formFile">
    -</div>
    -<div class="mb-3">
    -  <label for="formFileMultiple" class="form-label">Multiple files input example</label>
    -  <input class="form-control" type="file" id="formFileMultiple" multiple>
    -</div>
    -<div class="mb-3">
    -  <label for="formFileDisabled" class="form-label">Disabled file input example</label>
    -  <input class="form-control" type="file" id="formFileDisabled" disabled>
    -</div>
    -<div class="mb-3">
    -  <label for="formFileSm" class="form-label">Small file input example</label>
    -  <input class="form-control form-control-sm" id="formFileSm" type="file">
    -</div>
    -<div>
    -  <label for="formFileLg" class="form-label">Large file input example</label>
    -  <input class="form-control form-control-lg" id="formFileLg" type="file">
    -</div>
    -
    - -

    Color

    +
    html
    <div class="mb-3">
    +  <label for="formFile" class="form-label">Default file input example</label>
    +  <input class="form-control" type="file" id="formFile">
    +</div>
    +<div class="mb-3">
    +  <label for="formFileMultiple" class="form-label">Multiple files input example</label>
    +  <input class="form-control" type="file" id="formFileMultiple" multiple>
    +</div>
    +<div class="mb-3">
    +  <label for="formFileDisabled" class="form-label">Disabled file input example</label>
    +  <input class="form-control" type="file" id="formFileDisabled" disabled>
    +</div>
    +<div class="mb-3">
    +  <label for="formFileSm" class="form-label">Small file input example</label>
    +  <input class="form-control form-control-sm" id="formFileSm" type="file">
    +</div>
    +<div>
    +  <label for="formFileLg" class="form-label">Large file input example</label>
    +  <input class="form-control form-control-lg" id="formFileLg" type="file">
    +</div>
    +

    Color

    Set the type="color" and add .form-control-color to the <input>. We use the modifier class to set fixed heights and override some inconsistencies between browsers.

    -
    -
    - - - - -
    - html -
    - - -
    -
    <label for="exampleColorInput" class="form-label">Color picker</label>
    -<input type="color" class="form-control form-control-color" id="exampleColorInput" value="#563d7c" title="Choose your color">
    -
    - -

    Datalists

    +
    +
    html
    <label for="exampleColorInput" class="form-label">Color picker</label>
    +<input type="color" class="form-control form-control-color" id="exampleColorInput" value="#563d7c" title="Choose your color">
    +

    Datalists

    Datalists allow you to create a group of <option>s that can be accessed (and autocompleted) from within an <input>. These are similar to <select> elements, but come with more menu styling limitations and differences. While most browsers and operating systems include some support for <datalist> elements, their styling is inconsistent at best.

    Learn more about support for datalist elements.

    -
    -
    - - +
    - -
    - html -
    - - -
    -
    <label for="exampleDataList" class="form-label">Datalist example</label>
    -<input class="form-control" list="datalistOptions" id="exampleDataList" placeholder="Type to search...">
    -<datalist id="datalistOptions">
    -  <option value="San Francisco">
    -  <option value="New York">
    -  <option value="Seattle">
    -  <option value="Los Angeles">
    -  <option value="Chicago">
    -</datalist>
    -
    - -

    CSS

    -

    Sass variables

    +
    html
    <label for="exampleDataList" class="form-label">Datalist example</label>
    +<input class="form-control" list="datalistOptions" id="exampleDataList" placeholder="Type to search...">
    +<datalist id="datalistOptions">
    +  <option value="San Francisco">
    +  <option value="New York">
    +  <option value="Seattle">
    +  <option value="Los Angeles">
    +  <option value="Chicago">
    +</datalist>
    +

    CSS

    +

    Sass variables

    $input-* are shared across most of our form controls (and not buttons).

    -
    -
    - scss/_variables.scss -
    - -
    -
    $input-padding-y:                       $input-btn-padding-y;
    -$input-padding-x:                       $input-btn-padding-x;
    -$input-font-family:                     $input-btn-font-family;
    -$input-font-size:                       $input-btn-font-size;
    -$input-font-weight:                     $font-weight-base;
    -$input-line-height:                     $input-btn-line-height;
    -
    -$input-padding-y-sm:                    $input-btn-padding-y-sm;
    -$input-padding-x-sm:                    $input-btn-padding-x-sm;
    -$input-font-size-sm:                    $input-btn-font-size-sm;
    -
    -$input-padding-y-lg:                    $input-btn-padding-y-lg;
    -$input-padding-x-lg:                    $input-btn-padding-x-lg;
    -$input-font-size-lg:                    $input-btn-font-size-lg;
    -
    -$input-bg:                              var(--#{$prefix}body-bg);
    -$input-disabled-color:                  null;
    -$input-disabled-bg:                     var(--#{$prefix}secondary-bg);
    -$input-disabled-border-color:           null;
    -
    -$input-color:                           var(--#{$prefix}body-color);
    -$input-border-color:                    var(--#{$prefix}border-color);
    -$input-border-width:                    $input-btn-border-width;
    -$input-box-shadow:                      var(--#{$prefix}box-shadow-inset);
    -
    -$input-border-radius:                   var(--#{$prefix}border-radius);
    -$input-border-radius-sm:                var(--#{$prefix}border-radius-sm);
    -$input-border-radius-lg:                var(--#{$prefix}border-radius-lg);
    -
    -$input-focus-bg:                        $input-bg;
    -$input-focus-border-color:              tint-color($component-active-bg, 50%);
    -$input-focus-color:                     $input-color;
    -$input-focus-width:                     $input-btn-focus-width;
    -$input-focus-box-shadow:                $input-btn-focus-box-shadow;
    -
    -$input-placeholder-color:               var(--#{$prefix}secondary-color);
    -$input-plaintext-color:                 var(--#{$prefix}body-color);
    -
    -$input-height-border:                   calc(#{$input-border-width} * 2); // stylelint-disable-line function-disallowed-list
    -
    -$input-height-inner:                    add($input-line-height * 1em, $input-padding-y * 2);
    -$input-height-inner-half:               add($input-line-height * .5em, $input-padding-y);
    -$input-height-inner-quarter:            add($input-line-height * .25em, $input-padding-y * .5);
    -
    -$input-height:                          add($input-line-height * 1em, add($input-padding-y * 2, $input-height-border, false));
    -$input-height-sm:                       add($input-line-height * 1em, add($input-padding-y-sm * 2, $input-height-border, false));
    -$input-height-lg:                       add($input-line-height * 1em, add($input-padding-y-lg * 2, $input-height-border, false));
    -
    -$input-transition:                      border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    -
    -$form-color-width:                      3rem;
    -
    +
    $input-padding-y:                       $input-btn-padding-y;
    +$input-padding-x:                       $input-btn-padding-x;
    +$input-font-family:                     $input-btn-font-family;
    +$input-font-size:                       $input-btn-font-size;
    +$input-font-weight:                     $font-weight-base;
    +$input-line-height:                     $input-btn-line-height;
    +
    +$input-padding-y-sm:                    $input-btn-padding-y-sm;
    +$input-padding-x-sm:                    $input-btn-padding-x-sm;
    +$input-font-size-sm:                    $input-btn-font-size-sm;
    +
    +$input-padding-y-lg:                    $input-btn-padding-y-lg;
    +$input-padding-x-lg:                    $input-btn-padding-x-lg;
    +$input-font-size-lg:                    $input-btn-font-size-lg;
    +
    +$input-bg:                              var(--#{$prefix}body-bg);
    +$input-disabled-color:                  null;
    +$input-disabled-bg:                     var(--#{$prefix}secondary-bg);
    +$input-disabled-border-color:           null;
    +
    +$input-color:                           var(--#{$prefix}body-color);
    +$input-border-color:                    var(--#{$prefix}border-color);
    +$input-border-width:                    $input-btn-border-width;
    +$input-box-shadow:                      var(--#{$prefix}box-shadow-inset);
    +
    +$input-border-radius:                   var(--#{$prefix}border-radius);
    +$input-border-radius-sm:                var(--#{$prefix}border-radius-sm);
    +$input-border-radius-lg:                var(--#{$prefix}border-radius-lg);
    +
    +$input-focus-bg:                        $input-bg;
    +$input-focus-border-color:              tint-color($component-active-bg, 50%);
    +$input-focus-color:                     $input-color;
    +$input-focus-width:                     $input-btn-focus-width;
    +$input-focus-box-shadow:                $input-btn-focus-box-shadow;
    +
    +$input-placeholder-color:               var(--#{$prefix}secondary-color);
    +$input-plaintext-color:                 var(--#{$prefix}body-color);
    +
    +$input-height-border:                   calc(#{$input-border-width} * 2); // stylelint-disable-line function-disallowed-list
    +
    +$input-height-inner:                    add($input-line-height * 1em, $input-padding-y * 2);
    +$input-height-inner-half:               add($input-line-height * .5em, $input-padding-y);
    +$input-height-inner-quarter:            add($input-line-height * .25em, $input-padding-y * .5);
    +
    +$input-height:                          add($input-line-height * 1em, add($input-padding-y * 2, $input-height-border, false));
    +$input-height-sm:                       add($input-line-height * 1em, add($input-padding-y-sm * 2, $input-height-border, false));
    +$input-height-lg:                       add($input-line-height * 1em, add($input-padding-y-lg * 2, $input-height-border, false));
    +
    +$input-transition:                      border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    +
    +$form-color-width:                      3rem;
    +

    $form-label-* and $form-text-* are for our <label>s and .form-text component.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $form-label-margin-bottom:              .5rem;
    -$form-label-font-size:                  null;
    -$form-label-font-style:                 null;
    -$form-label-font-weight:                null;
    -$form-label-color:                      null;
    -
    -
    -
    - scss/_variables.scss -
    - -
    -
    $form-text-margin-top:                  .25rem;
    -$form-text-font-size:                   $small-font-size;
    -$form-text-font-style:                  null;
    -$form-text-font-weight:                 null;
    -$form-text-color:                       var(--#{$prefix}secondary-color);
    -
    +
    $form-label-margin-bottom:              .5rem;
    +$form-label-font-size:                  null;
    +$form-label-font-style:                 null;
    +$form-label-font-weight:                null;
    +$form-label-color:                      null;
    +
    +
    $form-text-margin-top:                  .25rem;
    +$form-text-font-size:                   $small-font-size;
    +$form-text-font-style:                  null;
    +$form-text-font-weight:                 null;
    +$form-text-color:                       var(--#{$prefix}secondary-color);
    +

    $form-file-* are for file input.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $form-file-button-color:          $input-color;
    -$form-file-button-bg:             var(--#{$prefix}tertiary-bg);
    -$form-file-button-hover-bg:       var(--#{$prefix}secondary-bg);
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    $form-file-button-color:          $input-color;
    +$form-file-button-bg:             var(--#{$prefix}tertiary-bg);
    +$form-file-button-hover-bg:       var(--#{$prefix}secondary-bg);
    +
    \ No newline at end of file diff --git a/docs/5.3/forms/index.html b/docs/5.3/forms/index.html index a2578c00d8..3c82df39bf 100644 --- a/docs/5.3/forms/index.html +++ b/docs/5.3/forms/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/forms/overview/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/forms/input-group/index.html b/docs/5.3/forms/input-group/index.html index 923502c114..1e9d61d047 100644 --- a/docs/5.3/forms/input-group/index.html +++ b/docs/5.3/forms/input-group/index.html @@ -1,590 +1,35 @@ - - - - - - - - - - - - - - - - -Input group · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Input group

    -
    -

    Easily extend form controls by adding text, buttons, or button groups on either side of textual inputs, custom selects, and custom file inputs.

    - - -
    - - - - - -
    - - -

    Basic example

    + Input group · Bootstrap v5.3

    Input group

    Easily extend form controls by adding text, buttons, or button groups on either side of textual inputs, custom selects, and custom file inputs.

    +

    Basic example

    Place one add-on or button on either side of an input. You may also place one on both sides of an input. Remember to place <label>s outside the input group.

    -
    -
    - -
    +
    @
    - + @example.com
    @@ -612,88 +57,65 @@
    With textarea -
    +
    html
    <div class="input-group mb-3">
    +  <span class="input-group-text" id="basic-addon1">@</span>
    +  <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1">
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="input-group mb-3">
    -  <span class="input-group-text" id="basic-addon1">@</span>
    -  <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="basic-addon1">
    -</div>
    -
    -<div class="input-group mb-3">
    -  <input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username" aria-describedby="basic-addon2">
    -  <span class="input-group-text" id="basic-addon2">@example.com</span>
    -</div>
    -
    -<div class="mb-3">
    -  <label for="basic-url" class="form-label">Your vanity URL</label>
    -  <div class="input-group">
    -    <span class="input-group-text" id="basic-addon3">https://example.com/users/</span>
    -    <input type="text" class="form-control" id="basic-url" aria-describedby="basic-addon3 basic-addon4">
    -  </div>
    -  <div class="form-text" id="basic-addon4">Example help text goes outside the input group.</div>
    -</div>
    -
    -<div class="input-group mb-3">
    -  <span class="input-group-text">$</span>
    -  <input type="text" class="form-control" aria-label="Amount (to the nearest dollar)">
    -  <span class="input-group-text">.00</span>
    -</div>
    -
    -<div class="input-group mb-3">
    -  <input type="text" class="form-control" placeholder="Username" aria-label="Username">
    -  <span class="input-group-text">@</span>
    -  <input type="text" class="form-control" placeholder="Server" aria-label="Server">
    -</div>
    -
    -<div class="input-group">
    -  <span class="input-group-text">With textarea</span>
    -  <textarea class="form-control" aria-label="With textarea"></textarea>
    -</div>
    -
    +<div class="input-group mb-3"> + <input type="text" class="form-control" placeholder="Recipient’s username" aria-label="Recipient’s username" aria-describedby="basic-addon2"> + <span class="input-group-text" id="basic-addon2">@example.com</span> +</div> -

    Wrapping

    +<div class="mb-3"> + <label for="basic-url" class="form-label">Your vanity URL</label> + <div class="input-group"> + <span class="input-group-text" id="basic-addon3">https://example.com/users/</span> + <input type="text" class="form-control" id="basic-url" aria-describedby="basic-addon3 basic-addon4"> + </div> + <div class="form-text" id="basic-addon4">Example help text goes outside the input group.</div> +</div> + +<div class="input-group mb-3"> + <span class="input-group-text">$</span> + <input type="text" class="form-control" aria-label="Amount (to the nearest dollar)"> + <span class="input-group-text">.00</span> +</div> + +<div class="input-group mb-3"> + <input type="text" class="form-control" placeholder="Username" aria-label="Username"> + <span class="input-group-text">@</span> + <input type="text" class="form-control" placeholder="Server" aria-label="Server"> +</div> + +<div class="input-group"> + <span class="input-group-text">With textarea</span> + <textarea class="form-control" aria-label="With textarea"></textarea> +</div>
    +

    Wrapping

    Input groups wrap by default via flex-wrap: wrap in order to accommodate custom form field validation within an input group. You may disable this with .flex-nowrap.

    -
    -
    - -
    +
    @ -
    - -
    - html -
    - - -
    -
    <div class="input-group flex-nowrap">
    -  <span class="input-group-text" id="addon-wrapping">@</span>
    -  <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="addon-wrapping">
    -</div>
    -
    - -

    Sizing

    +
    html
    <div class="input-group flex-nowrap">
    +  <span class="input-group-text" id="addon-wrapping">@</span>
    +  <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="addon-wrapping">
    +</div>
    +

    Border radius

    +

    Due to limitations of browser support at the time, border-radius styles can only be applied to the first and last children within the .input-group class. Any non-visible element in one of those positions will cause the input group to render incorrectly. This will unfortunately not be fixed until v6 most likely.

    +
    + @ + + +
    html
    <div class="input-group">
    +  <span class="input-group-text" id="visible-addon">@</span>
    +  <input type="text" class="form-control" placeholder="Username" aria-label="Username" aria-describedby="visible-addon">
    +  <input type="text" class="form-control d-none" placeholder="Hidden input" aria-label="Hidden input" aria-describedby="visible-addon">
    +</div>
    +

    Sizing

    Add the relative form sizing classes to the .input-group itself and contents within will automatically resize—no need for repeating the form control size classes on each element.

    -

    Sizing on the individual input group elements isn’t supported.

    -
    -
    - -
    +

    Sizing on the individual input group elements isn’t supported.

    +
    Small
    @@ -706,40 +128,23 @@
    Large -
    +
    html
    <div class="input-group input-group-sm mb-3">
    +  <span class="input-group-text" id="inputGroup-sizing-sm">Small</span>
    +  <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-sm">
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="input-group input-group-sm mb-3">
    -  <span class="input-group-text" id="inputGroup-sizing-sm">Small</span>
    -  <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-sm">
    -</div>
    -
    -<div class="input-group mb-3">
    -  <span class="input-group-text" id="inputGroup-sizing-default">Default</span>
    -  <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default">
    -</div>
    -
    -<div class="input-group input-group-lg">
    -  <span class="input-group-text" id="inputGroup-sizing-lg">Large</span>
    -  <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-lg">
    -</div>
    -
    +<div class="input-group mb-3"> + <span class="input-group-text" id="inputGroup-sizing-default">Default</span> + <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-default"> +</div> -

    Checkboxes and radios

    -

    Place any checkbox or radio option within an input group’s addon instead of text. We recommend adding .mt-0 to the .form-check-input when there’s no visible text next to the input.

    -
    -
    - -
    +<div class="input-group input-group-lg"> + <span class="input-group-text" id="inputGroup-sizing-lg">Large</span> + <input type="text" class="form-control" aria-label="Sizing example input" aria-describedby="inputGroup-sizing-lg"> +</div>
    +

    Checkboxes and radios

    +

    Place any checkbox or radio option within an input group’s addon instead of text. We recommend adding .mt-0 to the .form-check-input when there’s no visible text next to the input.

    +
    @@ -751,67 +156,33 @@
    -
    +
    html
    <div class="input-group mb-3">
    +  <div class="input-group-text">
    +    <input class="form-check-input mt-0" type="checkbox" value="" aria-label="Checkbox for following text input">
    +  </div>
    +  <input type="text" class="form-control" aria-label="Text input with checkbox">
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="input-group mb-3">
    -  <div class="input-group-text">
    -    <input class="form-check-input mt-0" type="checkbox" value="" aria-label="Checkbox for following text input">
    -  </div>
    -  <input type="text" class="form-control" aria-label="Text input with checkbox">
    -</div>
    -
    -<div class="input-group">
    -  <div class="input-group-text">
    -    <input class="form-check-input mt-0" type="radio" value="" aria-label="Radio button for following text input">
    -  </div>
    -  <input type="text" class="form-control" aria-label="Text input with radio button">
    -</div>
    -
    - -

    Multiple inputs

    +<div class="input-group"> + <div class="input-group-text"> + <input class="form-check-input mt-0" type="radio" value="" aria-label="Radio button for following text input"> + </div> + <input type="text" class="form-control" aria-label="Text input with radio button"> +</div>
    +

    Multiple inputs

    While multiple <input>s are supported visually, validation styles are only available for input groups with a single <input>.

    -
    -
    - -
    +
    First and last name -
    - -
    - html -
    - - -
    -
    <div class="input-group">
    -  <span class="input-group-text">First and last name</span>
    -  <input type="text" aria-label="First name" class="form-control">
    -  <input type="text" aria-label="Last name" class="form-control">
    -</div>
    -
    - -

    Multiple addons

    +
    html
    <div class="input-group">
    +  <span class="input-group-text">First and last name</span>
    +  <input type="text" aria-label="First name" class="form-control">
    +  <input type="text" aria-label="Last name" class="form-control">
    +</div>
    +

    Multiple addons

    Multiple add-ons are supported and can be mixed with checkbox and radio input versions.

    -
    -
    - -
    +
    $ 0.00 @@ -821,42 +192,25 @@ $ 0.00 -
    +
    html
    <div class="input-group mb-3">
    +  <span class="input-group-text">$</span>
    +  <span class="input-group-text">0.00</span>
    +  <input type="text" class="form-control" aria-label="Dollar amount (with dot and two decimal places)">
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="input-group mb-3">
    -  <span class="input-group-text">$</span>
    -  <span class="input-group-text">0.00</span>
    -  <input type="text" class="form-control" aria-label="Dollar amount (with dot and two decimal places)">
    -</div>
    -
    -<div class="input-group">
    -  <input type="text" class="form-control" aria-label="Dollar amount (with dot and two decimal places)">
    -  <span class="input-group-text">$</span>
    -  <span class="input-group-text">0.00</span>
    -</div>
    -
    - -

    Button addons

    -
    -
    - -
    +<div class="input-group"> + <input type="text" class="form-control" aria-label="Dollar amount (with dot and two decimal places)"> + <span class="input-group-text">$</span> + <span class="input-group-text">0.00</span> +</div>
    +

    Button addons

    +
    - +
    @@ -867,49 +221,32 @@
    - + -
    +
    html
    <div class="input-group mb-3">
    +  <button class="btn btn-outline-secondary" type="button" id="button-addon1">Button</button>
    +  <input type="text" class="form-control" placeholder="" aria-label="Example text with button addon" aria-describedby="button-addon1">
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="input-group mb-3">
    -  <button class="btn btn-outline-secondary" type="button" id="button-addon1">Button</button>
    -  <input type="text" class="form-control" placeholder="" aria-label="Example text with button addon" aria-describedby="button-addon1">
    -</div>
    -
    -<div class="input-group mb-3">
    -  <input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username" aria-describedby="button-addon2">
    -  <button class="btn btn-outline-secondary" type="button" id="button-addon2">Button</button>
    -</div>
    -
    -<div class="input-group mb-3">
    -  <button class="btn btn-outline-secondary" type="button">Button</button>
    -  <button class="btn btn-outline-secondary" type="button">Button</button>
    -  <input type="text" class="form-control" placeholder="" aria-label="Example text with two button addons">
    -</div>
    -
    -<div class="input-group">
    -  <input type="text" class="form-control" placeholder="Recipient's username" aria-label="Recipient's username with two button addons">
    -  <button class="btn btn-outline-secondary" type="button">Button</button>
    -  <button class="btn btn-outline-secondary" type="button">Button</button>
    -</div>
    -
    +<div class="input-group mb-3"> + <input type="text" class="form-control" placeholder="Recipient’s username" aria-label="Recipient’s username" aria-describedby="button-addon2"> + <button class="btn btn-outline-secondary" type="button" id="button-addon2">Button</button> +</div> -

    Buttons with dropdowns

    -
    -
    - -
    +<div class="input-group mb-3"> + <button class="btn btn-outline-secondary" type="button">Button</button> + <button class="btn btn-outline-secondary" type="button">Button</button> + <input type="text" class="form-control" placeholder="" aria-label="Example text with two button addons"> +</div> + +<div class="input-group"> + <input type="text" class="form-control" placeholder="Recipient’s username" aria-label="Recipient’s username with two button addons"> + <button class="btn btn-outline-secondary" type="button">Button</button> + <button class="btn btn-outline-secondary" type="button">Button</button> +</div>
    +

    Buttons with dropdowns

    +
    -
    +
    html
    <div class="input-group mb-3">
    +  <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</button>
    +  <ul class="dropdown-menu">
    +    <li><a class="dropdown-item" href="#">Action</a></li>
    +    <li><a class="dropdown-item" href="#">Another action</a></li>
    +    <li><a class="dropdown-item" href="#">Something else here</a></li>
    +    <li><hr class="dropdown-divider"></li>
    +    <li><a class="dropdown-item" href="#">Separated link</a></li>
    +  </ul>
    +  <input type="text" class="form-control" aria-label="Text input with dropdown button">
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="input-group mb-3">
    -  <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</button>
    -  <ul class="dropdown-menu">
    -    <li><a class="dropdown-item" href="#">Action</a></li>
    -    <li><a class="dropdown-item" href="#">Another action</a></li>
    -    <li><a class="dropdown-item" href="#">Something else here</a></li>
    -    <li><hr class="dropdown-divider"></li>
    -    <li><a class="dropdown-item" href="#">Separated link</a></li>
    -  </ul>
    -  <input type="text" class="form-control" aria-label="Text input with dropdown button">
    -</div>
    -
    -<div class="input-group mb-3">
    -  <input type="text" class="form-control" aria-label="Text input with dropdown button">
    -  <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</button>
    -  <ul class="dropdown-menu dropdown-menu-end">
    -    <li><a class="dropdown-item" href="#">Action</a></li>
    -    <li><a class="dropdown-item" href="#">Another action</a></li>
    -    <li><a class="dropdown-item" href="#">Something else here</a></li>
    -    <li><hr class="dropdown-divider"></li>
    -    <li><a class="dropdown-item" href="#">Separated link</a></li>
    -  </ul>
    -</div>
    -
    -<div class="input-group">
    -  <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</button>
    -  <ul class="dropdown-menu">
    -    <li><a class="dropdown-item" href="#">Action before</a></li>
    -    <li><a class="dropdown-item" href="#">Another action before</a></li>
    -    <li><a class="dropdown-item" href="#">Something else here</a></li>
    -    <li><hr class="dropdown-divider"></li>
    -    <li><a class="dropdown-item" href="#">Separated link</a></li>
    -  </ul>
    -  <input type="text" class="form-control" aria-label="Text input with 2 dropdown buttons">
    -  <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</button>
    -  <ul class="dropdown-menu dropdown-menu-end">
    -    <li><a class="dropdown-item" href="#">Action</a></li>
    -    <li><a class="dropdown-item" href="#">Another action</a></li>
    -    <li><a class="dropdown-item" href="#">Something else here</a></li>
    -    <li><hr class="dropdown-divider"></li>
    -    <li><a class="dropdown-item" href="#">Separated link</a></li>
    -  </ul>
    -</div>
    -
    +<div class="input-group mb-3"> + <input type="text" class="form-control" aria-label="Text input with dropdown button"> + <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</button> + <ul class="dropdown-menu dropdown-menu-end"> + <li><a class="dropdown-item" href="#">Action</a></li> + <li><a class="dropdown-item" href="#">Another action</a></li> + <li><a class="dropdown-item" href="#">Something else here</a></li> + <li><hr class="dropdown-divider"></li> + <li><a class="dropdown-item" href="#">Separated link</a></li> + </ul> +</div> -

    Segmented buttons

    -
    -
    - -
    +<div class="input-group"> + <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</button> + <ul class="dropdown-menu"> + <li><a class="dropdown-item" href="#">Action before</a></li> + <li><a class="dropdown-item" href="#">Another action before</a></li> + <li><a class="dropdown-item" href="#">Something else here</a></li> + <li><hr class="dropdown-divider"></li> + <li><a class="dropdown-item" href="#">Separated link</a></li> + </ul> + <input type="text" class="form-control" aria-label="Text input with 2 dropdown buttons"> + <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Dropdown</button> + <ul class="dropdown-menu dropdown-menu-end"> + <li><a class="dropdown-item" href="#">Action</a></li> + <li><a class="dropdown-item" href="#">Another action</a></li> + <li><a class="dropdown-item" href="#">Something else here</a></li> + <li><hr class="dropdown-divider"></li> + <li><a class="dropdown-item" href="#">Separated link</a></li> + </ul> +</div>
    +

    Segmented buttons

    +
    +
    html
    <div class="input-group mb-3">
    +  <button type="button" class="btn btn-outline-secondary">Action</button>
    +  <button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    +    <span class="visually-hidden">Toggle Dropdown</span>
    +  </button>
    +  <ul class="dropdown-menu">
    +    <li><a class="dropdown-item" href="#">Action</a></li>
    +    <li><a class="dropdown-item" href="#">Another action</a></li>
    +    <li><a class="dropdown-item" href="#">Something else here</a></li>
    +    <li><hr class="dropdown-divider"></li>
    +    <li><a class="dropdown-item" href="#">Separated link</a></li>
    +  </ul>
    +  <input type="text" class="form-control" aria-label="Text input with segmented dropdown button">
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="input-group mb-3">
    -  <button type="button" class="btn btn-outline-secondary">Action</button>
    -  <button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    -    <span class="visually-hidden">Toggle Dropdown</span>
    -  </button>
    -  <ul class="dropdown-menu">
    -    <li><a class="dropdown-item" href="#">Action</a></li>
    -    <li><a class="dropdown-item" href="#">Another action</a></li>
    -    <li><a class="dropdown-item" href="#">Something else here</a></li>
    -    <li><hr class="dropdown-divider"></li>
    -    <li><a class="dropdown-item" href="#">Separated link</a></li>
    -  </ul>
    -  <input type="text" class="form-control" aria-label="Text input with segmented dropdown button">
    -</div>
    -
    -<div class="input-group">
    -  <input type="text" class="form-control" aria-label="Text input with segmented dropdown button">
    -  <button type="button" class="btn btn-outline-secondary">Action</button>
    -  <button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false">
    -    <span class="visually-hidden">Toggle Dropdown</span>
    -  </button>
    -  <ul class="dropdown-menu dropdown-menu-end">
    -    <li><a class="dropdown-item" href="#">Action</a></li>
    -    <li><a class="dropdown-item" href="#">Another action</a></li>
    -    <li><a class="dropdown-item" href="#">Something else here</a></li>
    -    <li><hr class="dropdown-divider"></li>
    -    <li><a class="dropdown-item" href="#">Separated link</a></li>
    -  </ul>
    -</div>
    -
    - -

    Custom forms

    +<div class="input-group"> + <input type="text" class="form-control" aria-label="Text input with segmented dropdown button"> + <button type="button" class="btn btn-outline-secondary">Action</button> + <button type="button" class="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false"> + <span class="visually-hidden">Toggle Dropdown</span> + </button> + <ul class="dropdown-menu dropdown-menu-end"> + <li><a class="dropdown-item" href="#">Action</a></li> + <li><a class="dropdown-item" href="#">Another action</a></li> + <li><a class="dropdown-item" href="#">Something else here</a></li> + <li><hr class="dropdown-divider"></li> + <li><a class="dropdown-item" href="#">Separated link</a></li> + </ul> +</div>
    +

    Custom forms

    Input groups include support for custom selects and custom file inputs. Browser default versions of these are not supported.

    -

    Custom select

    -
    -
    - -
    +

    Custom select

    +
    -
    +
    html
    <div class="input-group mb-3">
    +  <label class="input-group-text" for="inputGroupSelect01">Options</label>
    +  <select class="form-select" id="inputGroupSelect01">
    +    <option selected>Choose...</option>
    +    <option value="1">One</option>
    +    <option value="2">Two</option>
    +    <option value="3">Three</option>
    +  </select>
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="input-group mb-3">
    -  <label class="input-group-text" for="inputGroupSelect01">Options</label>
    -  <select class="form-select" id="inputGroupSelect01">
    -    <option selected>Choose...</option>
    -    <option value="1">One</option>
    -    <option value="2">Two</option>
    -    <option value="3">Three</option>
    -  </select>
    -</div>
    -
    -<div class="input-group mb-3">
    -  <select class="form-select" id="inputGroupSelect02">
    -    <option selected>Choose...</option>
    -    <option value="1">One</option>
    -    <option value="2">Two</option>
    -    <option value="3">Three</option>
    -  </select>
    -  <label class="input-group-text" for="inputGroupSelect02">Options</label>
    -</div>
    -
    -<div class="input-group mb-3">
    -  <button class="btn btn-outline-secondary" type="button">Button</button>
    -  <select class="form-select" id="inputGroupSelect03" aria-label="Example select with button addon">
    -    <option selected>Choose...</option>
    -    <option value="1">One</option>
    -    <option value="2">Two</option>
    -    <option value="3">Three</option>
    -  </select>
    -</div>
    -
    -<div class="input-group">
    -  <select class="form-select" id="inputGroupSelect04" aria-label="Example select with button addon">
    -    <option selected>Choose...</option>
    -    <option value="1">One</option>
    -    <option value="2">Two</option>
    -    <option value="3">Three</option>
    -  </select>
    -  <button class="btn btn-outline-secondary" type="button">Button</button>
    -</div>
    -
    +<div class="input-group mb-3"> + <select class="form-select" id="inputGroupSelect02"> + <option selected>Choose...</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> + <label class="input-group-text" for="inputGroupSelect02">Options</label> +</div> -

    Custom file input

    -
    -
    - -
    +<div class="input-group mb-3"> + <button class="btn btn-outline-secondary" type="button">Button</button> + <select class="form-select" id="inputGroupSelect03" aria-label="Example select with button addon"> + <option selected>Choose...</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> +</div> + +<div class="input-group"> + <select class="form-select" id="inputGroupSelect04" aria-label="Example select with button addon"> + <option selected>Choose...</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> + <button class="btn btn-outline-secondary" type="button">Button</button> +</div>
    +

    Custom file input

    +
    @@ -1202,130 +488,35 @@
    -
    +
    html
    <div class="input-group mb-3">
    +  <label class="input-group-text" for="inputGroupFile01">Upload</label>
    +  <input type="file" class="form-control" id="inputGroupFile01">
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="input-group mb-3">
    -  <label class="input-group-text" for="inputGroupFile01">Upload</label>
    -  <input type="file" class="form-control" id="inputGroupFile01">
    -</div>
    -
    -<div class="input-group mb-3">
    -  <input type="file" class="form-control" id="inputGroupFile02">
    -  <label class="input-group-text" for="inputGroupFile02">Upload</label>
    -</div>
    -
    -<div class="input-group mb-3">
    -  <button class="btn btn-outline-secondary" type="button" id="inputGroupFileAddon03">Button</button>
    -  <input type="file" class="form-control" id="inputGroupFile03" aria-describedby="inputGroupFileAddon03" aria-label="Upload">
    -</div>
    -
    -<div class="input-group">
    -  <input type="file" class="form-control" id="inputGroupFile04" aria-describedby="inputGroupFileAddon04" aria-label="Upload">
    -  <button class="btn btn-outline-secondary" type="button" id="inputGroupFileAddon04">Button</button>
    -</div>
    -
    +<div class="input-group mb-3"> + <input type="file" class="form-control" id="inputGroupFile02"> + <label class="input-group-text" for="inputGroupFile02">Upload</label> +</div> -

    CSS

    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $input-group-addon-padding-y:           $input-padding-y;
    -$input-group-addon-padding-x:           $input-padding-x;
    -$input-group-addon-font-weight:         $input-font-weight;
    -$input-group-addon-color:               $input-color;
    -$input-group-addon-bg:                  var(--#{$prefix}tertiary-bg);
    -$input-group-addon-border-color:        $input-border-color;
    -
    +<div class="input-group mb-3"> + <button class="btn btn-outline-secondary" type="button" id="inputGroupFileAddon03">Button</button> + <input type="file" class="form-control" id="inputGroupFile03" aria-describedby="inputGroupFileAddon03" aria-label="Upload"> +</div> -
    -
    -
    - - - - - - - - - - - - - - - +<div class="input-group"> + <input type="file" class="form-control" id="inputGroupFile04" aria-describedby="inputGroupFileAddon04" aria-label="Upload"> + <button class="btn btn-outline-secondary" type="button" id="inputGroupFileAddon04">Button</button> +</div> +

    CSS

    +

    Sass variables

    +
    $input-group-addon-padding-y:           $input-padding-y;
    +$input-group-addon-padding-x:           $input-padding-x;
    +$input-group-addon-font-weight:         $input-font-weight;
    +$input-group-addon-color:               $input-color;
    +$input-group-addon-bg:                  var(--#{$prefix}tertiary-bg);
    +$input-group-addon-border-color:        $input-border-color;
    +
    \ No newline at end of file diff --git a/docs/5.3/forms/layout/index.html b/docs/5.3/forms/layout/index.html index 6c7c1045e2..5b6bac2112 100644 --- a/docs/5.3/forms/layout/index.html +++ b/docs/5.3/forms/layout/index.html @@ -1,685 +1,87 @@ - - - - - - - - - - - - - - - - -Layout · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Layout

    -
    -

    Give your forms some structure—from inline to horizontal to custom grid implementations—with our form layout options.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Forms

    + Layout · Bootstrap v5.3

    Give your forms some structure—from inline to horizontal to custom grid implementations—with our form layout options.

    +

    Forms

    Every group of form fields should reside in a <form> element. Bootstrap provides no default styling for the <form> element, but there are some powerful browser features that are provided by default.

    • New to browser forms? Consider reviewing the MDN form docs for an overview and complete list of available attributes.
    • <button>s within a <form> default to type="submit", so strive to be specific and always include a type.

    Since Bootstrap applies display: block and width: 100% to almost all our form controls, forms will by default stack vertically. Additional classes can be used to vary this layout on a per-form basis.

    -

    Utilities

    -

    Margin utilities are the easiest way to add some structure to forms. They provide basic grouping of labels, controls, optional form text, and form validation messaging. We recommend sticking to margin-bottom utilities, and using a single direction throughout the form for consistency.

    +

    Utilities

    +

    Margin utilities are the easiest way to add some structure to forms. They provide basic grouping of labels, controls, optional form text, and form validation messaging. We recommend sticking to margin-bottom utilities, and using a single direction throughout the form for consistency.

    Feel free to build your forms however you like, with <fieldset>s, <div>s, or nearly any other element.

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="mb-3">
    -  <label for="formGroupExampleInput" class="form-label">Example label</label>
    -  <input type="text" class="form-control" id="formGroupExampleInput" placeholder="Example input placeholder">
    -</div>
    -<div class="mb-3">
    -  <label for="formGroupExampleInput2" class="form-label">Another label</label>
    -  <input type="text" class="form-control" id="formGroupExampleInput2" placeholder="Another input placeholder">
    -</div>
    -
    - -

    Form grid

    +
    html
    <div class="mb-3">
    +  <label for="formGroupExampleInput" class="form-label">Example label</label>
    +  <input type="text" class="form-control" id="formGroupExampleInput" placeholder="Example input placeholder">
    +</div>
    +<div class="mb-3">
    +  <label for="formGroupExampleInput2" class="form-label">Another label</label>
    +  <input type="text" class="form-control" id="formGroupExampleInput2" placeholder="Another input placeholder">
    +</div>
    +

    Form grid

    More complex forms can be built using our grid classes. Use these for form layouts that require multiple columns, varied widths, and additional alignment options. Requires the $enable-grid-classes Sass variable to be enabled (on by default).

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="row">
    -  <div class="col">
    -    <input type="text" class="form-control" placeholder="First name" aria-label="First name">
    -  </div>
    -  <div class="col">
    -    <input type="text" class="form-control" placeholder="Last name" aria-label="Last name">
    -  </div>
    -</div>
    -
    - -

    Gutters

    -

    By adding gutter modifier classes, you can have control over the gutter width in as well the inline as block direction. Also requires the $enable-grid-classes Sass variable to be enabled (on by default).

    -
    -
    - -
    +
    html
    <div class="row">
    +  <div class="col">
    +    <input type="text" class="form-control" placeholder="First name" aria-label="First name">
    +  </div>
    +  <div class="col">
    +    <input type="text" class="form-control" placeholder="Last name" aria-label="Last name">
    +  </div>
    +</div>
    +

    Gutters

    +

    By adding gutter modifier classes, you can have control over the gutter width in as well the inline as block direction. Also requires the $enable-grid-classes Sass variable to be enabled (on by default).

    +
    -
    - -
    - html -
    - - -
    -
    <div class="row g-3">
    -  <div class="col">
    -    <input type="text" class="form-control" placeholder="First name" aria-label="First name">
    -  </div>
    -  <div class="col">
    -    <input type="text" class="form-control" placeholder="Last name" aria-label="Last name">
    -  </div>
    -</div>
    -
    - +
    html
    <div class="row g-3">
    +  <div class="col">
    +    <input type="text" class="form-control" placeholder="First name" aria-label="First name">
    +  </div>
    +  <div class="col">
    +    <input type="text" class="form-control" placeholder="Last name" aria-label="Last name">
    +  </div>
    +</div>

    More complex layouts can also be created with the grid system.

    -
    -
    - -
    +
    @@ -722,71 +124,54 @@
    - - -
    - html -
    - - -
    -
    <form class="row g-3">
    -  <div class="col-md-6">
    -    <label for="inputEmail4" class="form-label">Email</label>
    -    <input type="email" class="form-control" id="inputEmail4">
    -  </div>
    -  <div class="col-md-6">
    -    <label for="inputPassword4" class="form-label">Password</label>
    -    <input type="password" class="form-control" id="inputPassword4">
    -  </div>
    -  <div class="col-12">
    -    <label for="inputAddress" class="form-label">Address</label>
    -    <input type="text" class="form-control" id="inputAddress" placeholder="1234 Main St">
    -  </div>
    -  <div class="col-12">
    -    <label for="inputAddress2" class="form-label">Address 2</label>
    -    <input type="text" class="form-control" id="inputAddress2" placeholder="Apartment, studio, or floor">
    -  </div>
    -  <div class="col-md-6">
    -    <label for="inputCity" class="form-label">City</label>
    -    <input type="text" class="form-control" id="inputCity">
    -  </div>
    -  <div class="col-md-4">
    -    <label for="inputState" class="form-label">State</label>
    -    <select id="inputState" class="form-select">
    -      <option selected>Choose...</option>
    -      <option>...</option>
    -    </select>
    -  </div>
    -  <div class="col-md-2">
    -    <label for="inputZip" class="form-label">Zip</label>
    -    <input type="text" class="form-control" id="inputZip">
    -  </div>
    -  <div class="col-12">
    -    <div class="form-check">
    -      <input class="form-check-input" type="checkbox" id="gridCheck">
    -      <label class="form-check-label" for="gridCheck">
    -        Check me out
    -      </label>
    -    </div>
    -  </div>
    -  <div class="col-12">
    -    <button type="submit" class="btn btn-primary">Sign in</button>
    -  </div>
    -</form>
    -
    - -

    Horizontal form

    -

    Create horizontal forms with the grid by adding the .row class to form groups and using the .col-*-* classes to specify the width of your labels and controls. Be sure to add .col-form-label to your <label>s as well so they’re vertically centered with their associated form controls.

    -

    At times, you maybe need to use margin or padding utilities to create that perfect alignment you need. For example, we’ve removed the padding-top on our stacked radio inputs label to better align the text baseline.

    -
    -
    - -
    +
    html
    <form class="row g-3">
    +  <div class="col-md-6">
    +    <label for="inputEmail4" class="form-label">Email</label>
    +    <input type="email" class="form-control" id="inputEmail4">
    +  </div>
    +  <div class="col-md-6">
    +    <label for="inputPassword4" class="form-label">Password</label>
    +    <input type="password" class="form-control" id="inputPassword4">
    +  </div>
    +  <div class="col-12">
    +    <label for="inputAddress" class="form-label">Address</label>
    +    <input type="text" class="form-control" id="inputAddress" placeholder="1234 Main St">
    +  </div>
    +  <div class="col-12">
    +    <label for="inputAddress2" class="form-label">Address 2</label>
    +    <input type="text" class="form-control" id="inputAddress2" placeholder="Apartment, studio, or floor">
    +  </div>
    +  <div class="col-md-6">
    +    <label for="inputCity" class="form-label">City</label>
    +    <input type="text" class="form-control" id="inputCity">
    +  </div>
    +  <div class="col-md-4">
    +    <label for="inputState" class="form-label">State</label>
    +    <select id="inputState" class="form-select">
    +      <option selected>Choose...</option>
    +      <option>...</option>
    +    </select>
    +  </div>
    +  <div class="col-md-2">
    +    <label for="inputZip" class="form-label">Zip</label>
    +    <input type="text" class="form-control" id="inputZip">
    +  </div>
    +  <div class="col-12">
    +    <div class="form-check">
    +      <input class="form-check-input" type="checkbox" id="gridCheck">
    +      <label class="form-check-label" for="gridCheck">
    +        Check me out
    +      </label>
    +    </div>
    +  </div>
    +  <div class="col-12">
    +    <button type="submit" class="btn btn-primary">Sign in</button>
    +  </div>
    +</form>
    +

    Horizontal form

    +

    Create horizontal forms with the grid by adding the .row class to form groups and using the .col-*-* classes to specify the width of your labels and controls. Be sure to add .col-form-label to your <label>s as well so they’re vertically centered with their associated form controls.

    +

    At times, you maybe need to use margin or padding utilities to create that perfect alignment you need. For example, we’ve removed the padding-top on our stacked radio inputs label to better align the text baseline.

    +
    @@ -833,74 +218,57 @@
    -
    - -
    - html -
    - - -
    -
    <form>
    -  <div class="row mb-3">
    -    <label for="inputEmail3" class="col-sm-2 col-form-label">Email</label>
    -    <div class="col-sm-10">
    -      <input type="email" class="form-control" id="inputEmail3">
    -    </div>
    -  </div>
    -  <div class="row mb-3">
    -    <label for="inputPassword3" class="col-sm-2 col-form-label">Password</label>
    -    <div class="col-sm-10">
    -      <input type="password" class="form-control" id="inputPassword3">
    -    </div>
    -  </div>
    -  <fieldset class="row mb-3">
    -    <legend class="col-form-label col-sm-2 pt-0">Radios</legend>
    -    <div class="col-sm-10">
    -      <div class="form-check">
    -        <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios1" value="option1" checked>
    -        <label class="form-check-label" for="gridRadios1">
    -          First radio
    -        </label>
    -      </div>
    -      <div class="form-check">
    -        <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios2" value="option2">
    -        <label class="form-check-label" for="gridRadios2">
    -          Second radio
    -        </label>
    -      </div>
    -      <div class="form-check disabled">
    -        <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios3" value="option3" disabled>
    -        <label class="form-check-label" for="gridRadios3">
    -          Third disabled radio
    -        </label>
    -      </div>
    -    </div>
    -  </fieldset>
    -  <div class="row mb-3">
    -    <div class="col-sm-10 offset-sm-2">
    -      <div class="form-check">
    -        <input class="form-check-input" type="checkbox" id="gridCheck1">
    -        <label class="form-check-label" for="gridCheck1">
    -          Example checkbox
    -        </label>
    -      </div>
    -    </div>
    -  </div>
    -  <button type="submit" class="btn btn-primary">Sign in</button>
    -</form>
    -
    - -

    Horizontal form label sizing

    +
    html
    <form>
    +  <div class="row mb-3">
    +    <label for="inputEmail3" class="col-sm-2 col-form-label">Email</label>
    +    <div class="col-sm-10">
    +      <input type="email" class="form-control" id="inputEmail3">
    +    </div>
    +  </div>
    +  <div class="row mb-3">
    +    <label for="inputPassword3" class="col-sm-2 col-form-label">Password</label>
    +    <div class="col-sm-10">
    +      <input type="password" class="form-control" id="inputPassword3">
    +    </div>
    +  </div>
    +  <fieldset class="row mb-3">
    +    <legend class="col-form-label col-sm-2 pt-0">Radios</legend>
    +    <div class="col-sm-10">
    +      <div class="form-check">
    +        <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios1" value="option1" checked>
    +        <label class="form-check-label" for="gridRadios1">
    +          First radio
    +        </label>
    +      </div>
    +      <div class="form-check">
    +        <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios2" value="option2">
    +        <label class="form-check-label" for="gridRadios2">
    +          Second radio
    +        </label>
    +      </div>
    +      <div class="form-check disabled">
    +        <input class="form-check-input" type="radio" name="gridRadios" id="gridRadios3" value="option3" disabled>
    +        <label class="form-check-label" for="gridRadios3">
    +          Third disabled radio
    +        </label>
    +      </div>
    +    </div>
    +  </fieldset>
    +  <div class="row mb-3">
    +    <div class="col-sm-10 offset-sm-2">
    +      <div class="form-check">
    +        <input class="form-check-input" type="checkbox" id="gridCheck1">
    +        <label class="form-check-label" for="gridCheck1">
    +          Example checkbox
    +        </label>
    +      </div>
    +    </div>
    +  </div>
    +  <button type="submit" class="btn btn-primary">Sign in</button>
    +</form>
    +

    Horizontal form label sizing

    Be sure to use .col-form-label-sm or .col-form-label-lg to your <label>s or <legend>s to correctly follow the size of .form-control-lg and .form-control-sm.

    -
    -
    - -
    +
    @@ -917,44 +285,27 @@
    -
    - -
    - html -
    - - -
    -
    <div class="row mb-3">
    -  <label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm">Email</label>
    -  <div class="col-sm-10">
    -    <input type="email" class="form-control form-control-sm" id="colFormLabelSm" placeholder="col-form-label-sm">
    -  </div>
    -</div>
    -<div class="row mb-3">
    -  <label for="colFormLabel" class="col-sm-2 col-form-label">Email</label>
    -  <div class="col-sm-10">
    -    <input type="email" class="form-control" id="colFormLabel" placeholder="col-form-label">
    -  </div>
    -</div>
    -<div class="row">
    -  <label for="colFormLabelLg" class="col-sm-2 col-form-label col-form-label-lg">Email</label>
    -  <div class="col-sm-10">
    -    <input type="email" class="form-control form-control-lg" id="colFormLabelLg" placeholder="col-form-label-lg">
    -  </div>
    -</div>
    -
    - -

    Column sizing

    -

    As shown in the previous examples, our grid system allows you to place any number of .cols within a .row. They’ll split the available width equally between them. You may also pick a subset of your columns to take up more or less space, while the remaining .cols equally split the rest, with specific column classes like .col-sm-7.

    -
    -
    - -
    +
    html
    <div class="row mb-3">
    +  <label for="colFormLabelSm" class="col-sm-2 col-form-label col-form-label-sm">Email</label>
    +  <div class="col-sm-10">
    +    <input type="email" class="form-control form-control-sm" id="colFormLabelSm" placeholder="col-form-label-sm">
    +  </div>
    +</div>
    +<div class="row mb-3">
    +  <label for="colFormLabel" class="col-sm-2 col-form-label">Email</label>
    +  <div class="col-sm-10">
    +    <input type="email" class="form-control" id="colFormLabel" placeholder="col-form-label">
    +  </div>
    +</div>
    +<div class="row">
    +  <label for="colFormLabelLg" class="col-sm-2 col-form-label col-form-label-lg">Email</label>
    +  <div class="col-sm-10">
    +    <input type="email" class="form-control form-control-lg" id="colFormLabelLg" placeholder="col-form-label-lg">
    +  </div>
    +</div>
    +

    Column sizing

    +

    As shown in the previous examples, our grid system allows you to place any number of .cols within a .row. They’ll split the available width equally between them. You may also pick a subset of your columns to take up more or less space, while the remaining .cols equally split the rest, with specific column classes like .col-sm-7.

    +
    @@ -964,37 +315,20 @@
    -
    - -
    - html -
    - - -
    -
    <div class="row g-3">
    -  <div class="col-sm-7">
    -    <input type="text" class="form-control" placeholder="City" aria-label="City">
    -  </div>
    -  <div class="col-sm">
    -    <input type="text" class="form-control" placeholder="State" aria-label="State">
    -  </div>
    -  <div class="col-sm">
    -    <input type="text" class="form-control" placeholder="Zip" aria-label="Zip">
    -  </div>
    -</div>
    -
    - -

    Auto-sizing

    +
    html
    <div class="row g-3">
    +  <div class="col-sm-7">
    +    <input type="text" class="form-control" placeholder="City" aria-label="City">
    +  </div>
    +  <div class="col-sm">
    +    <input type="text" class="form-control" placeholder="State" aria-label="State">
    +  </div>
    +  <div class="col-sm">
    +    <input type="text" class="form-control" placeholder="Zip" aria-label="Zip">
    +  </div>
    +</div>
    +

    Auto-sizing

    The example below uses a flexbox utility to vertically center the contents and changes .col to .col-auto so that your columns only take up as much space as needed. Put another way, the column sizes itself based on the contents.

    -
    -
    - -
    +
    @@ -1026,58 +360,41 @@
    - - -
    - html -
    - - -
    -
    <form class="row gy-2 gx-3 align-items-center">
    -  <div class="col-auto">
    -    <label class="visually-hidden" for="autoSizingInput">Name</label>
    -    <input type="text" class="form-control" id="autoSizingInput" placeholder="Jane Doe">
    -  </div>
    -  <div class="col-auto">
    -    <label class="visually-hidden" for="autoSizingInputGroup">Username</label>
    -    <div class="input-group">
    -      <div class="input-group-text">@</div>
    -      <input type="text" class="form-control" id="autoSizingInputGroup" placeholder="Username">
    -    </div>
    -  </div>
    -  <div class="col-auto">
    -    <label class="visually-hidden" for="autoSizingSelect">Preference</label>
    -    <select class="form-select" id="autoSizingSelect">
    -      <option selected>Choose...</option>
    -      <option value="1">One</option>
    -      <option value="2">Two</option>
    -      <option value="3">Three</option>
    -    </select>
    -  </div>
    -  <div class="col-auto">
    -    <div class="form-check">
    -      <input class="form-check-input" type="checkbox" id="autoSizingCheck">
    -      <label class="form-check-label" for="autoSizingCheck">
    -        Remember me
    -      </label>
    -    </div>
    -  </div>
    -  <div class="col-auto">
    -    <button type="submit" class="btn btn-primary">Submit</button>
    -  </div>
    -</form>
    -
    - +
    html
    <form class="row gy-2 gx-3 align-items-center">
    +  <div class="col-auto">
    +    <label class="visually-hidden" for="autoSizingInput">Name</label>
    +    <input type="text" class="form-control" id="autoSizingInput" placeholder="Jane Doe">
    +  </div>
    +  <div class="col-auto">
    +    <label class="visually-hidden" for="autoSizingInputGroup">Username</label>
    +    <div class="input-group">
    +      <div class="input-group-text">@</div>
    +      <input type="text" class="form-control" id="autoSizingInputGroup" placeholder="Username">
    +    </div>
    +  </div>
    +  <div class="col-auto">
    +    <label class="visually-hidden" for="autoSizingSelect">Preference</label>
    +    <select class="form-select" id="autoSizingSelect">
    +      <option selected>Choose...</option>
    +      <option value="1">One</option>
    +      <option value="2">Two</option>
    +      <option value="3">Three</option>
    +    </select>
    +  </div>
    +  <div class="col-auto">
    +    <div class="form-check">
    +      <input class="form-check-input" type="checkbox" id="autoSizingCheck">
    +      <label class="form-check-label" for="autoSizingCheck">
    +        Remember me
    +      </label>
    +    </div>
    +  </div>
    +  <div class="col-auto">
    +    <button type="submit" class="btn btn-primary">Submit</button>
    +  </div>
    +</form>

    You can then remix that once again with size-specific column classes.

    -
    -
    - -
    +
    @@ -1109,59 +426,42 @@
    - - -
    - html -
    - - -
    -
    <form class="row gx-3 gy-2 align-items-center">
    -  <div class="col-sm-3">
    -    <label class="visually-hidden" for="specificSizeInputName">Name</label>
    -    <input type="text" class="form-control" id="specificSizeInputName" placeholder="Jane Doe">
    -  </div>
    -  <div class="col-sm-3">
    -    <label class="visually-hidden" for="specificSizeInputGroupUsername">Username</label>
    -    <div class="input-group">
    -      <div class="input-group-text">@</div>
    -      <input type="text" class="form-control" id="specificSizeInputGroupUsername" placeholder="Username">
    -    </div>
    -  </div>
    -  <div class="col-sm-3">
    -    <label class="visually-hidden" for="specificSizeSelect">Preference</label>
    -    <select class="form-select" id="specificSizeSelect">
    -      <option selected>Choose...</option>
    -      <option value="1">One</option>
    -      <option value="2">Two</option>
    -      <option value="3">Three</option>
    -    </select>
    -  </div>
    -  <div class="col-auto">
    -    <div class="form-check">
    -      <input class="form-check-input" type="checkbox" id="autoSizingCheck2">
    -      <label class="form-check-label" for="autoSizingCheck2">
    -        Remember me
    -      </label>
    -    </div>
    -  </div>
    -  <div class="col-auto">
    -    <button type="submit" class="btn btn-primary">Submit</button>
    -  </div>
    -</form>
    -
    - -

    Inline forms

    -

    Use the .row-cols-* classes to create responsive horizontal layouts. By adding gutter modifier classes, we’ll have gutters in horizontal and vertical directions. On narrow mobile viewports, the .col-12 helps stack the form controls and more. The .align-items-center aligns the form elements to the middle, making the .form-check align properly.

    -
    -
    - -
    +
    html
    <form class="row gx-3 gy-2 align-items-center">
    +  <div class="col-sm-3">
    +    <label class="visually-hidden" for="specificSizeInputName">Name</label>
    +    <input type="text" class="form-control" id="specificSizeInputName" placeholder="Jane Doe">
    +  </div>
    +  <div class="col-sm-3">
    +    <label class="visually-hidden" for="specificSizeInputGroupUsername">Username</label>
    +    <div class="input-group">
    +      <div class="input-group-text">@</div>
    +      <input type="text" class="form-control" id="specificSizeInputGroupUsername" placeholder="Username">
    +    </div>
    +  </div>
    +  <div class="col-sm-3">
    +    <label class="visually-hidden" for="specificSizeSelect">Preference</label>
    +    <select class="form-select" id="specificSizeSelect">
    +      <option selected>Choose...</option>
    +      <option value="1">One</option>
    +      <option value="2">Two</option>
    +      <option value="3">Three</option>
    +    </select>
    +  </div>
    +  <div class="col-auto">
    +    <div class="form-check">
    +      <input class="form-check-input" type="checkbox" id="autoSizingCheck2">
    +      <label class="form-check-label" for="autoSizingCheck2">
    +        Remember me
    +      </label>
    +    </div>
    +  </div>
    +  <div class="col-auto">
    +    <button type="submit" class="btn btn-primary">Submit</button>
    +  </div>
    +</form>
    +

    Inline forms

    +

    Use the .row-cols-* classes to create responsive horizontal layouts. By adding gutter modifier classes, we'll have gutters in horizontal and vertical directions. On narrow mobile viewports, the .col-12 helps stack the form controls and more. The .align-items-center aligns the form elements to the middle, making the .form-check align properly.

    +
    @@ -1192,126 +492,39 @@
    - +
    html
    <form class="row row-cols-lg-auto g-3 align-items-center">
    +  <div class="col-12">
    +    <label class="visually-hidden" for="inlineFormInputGroupUsername">Username</label>
    +    <div class="input-group">
    +      <div class="input-group-text">@</div>
    +      <input type="text" class="form-control" id="inlineFormInputGroupUsername" placeholder="Username">
    +    </div>
    +  </div>
     
    -  
    - html -
    - - -
    -
    <form class="row row-cols-lg-auto g-3 align-items-center">
    -  <div class="col-12">
    -    <label class="visually-hidden" for="inlineFormInputGroupUsername">Username</label>
    -    <div class="input-group">
    -      <div class="input-group-text">@</div>
    -      <input type="text" class="form-control" id="inlineFormInputGroupUsername" placeholder="Username">
    -    </div>
    -  </div>
    -
    -  <div class="col-12">
    -    <label class="visually-hidden" for="inlineFormSelectPref">Preference</label>
    -    <select class="form-select" id="inlineFormSelectPref">
    -      <option selected>Choose...</option>
    -      <option value="1">One</option>
    -      <option value="2">Two</option>
    -      <option value="3">Three</option>
    -    </select>
    -  </div>
    -
    -  <div class="col-12">
    -    <div class="form-check">
    -      <input class="form-check-input" type="checkbox" id="inlineFormCheck">
    -      <label class="form-check-label" for="inlineFormCheck">
    -        Remember me
    -      </label>
    -    </div>
    -  </div>
    -
    -  <div class="col-12">
    -    <button type="submit" class="btn btn-primary">Submit</button>
    -  </div>
    -</form>
    -
    + <div class="col-12"> + <label class="visually-hidden" for="inlineFormSelectPref">Preference</label> + <select class="form-select" id="inlineFormSelectPref"> + <option selected>Choose...</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> + </div> + <div class="col-12"> + <div class="form-check"> + <input class="form-check-input" type="checkbox" id="inlineFormCheck"> + <label class="form-check-label" for="inlineFormCheck"> + Remember me + </label> + </div> + </div> -
    -
    -
    - - - - - - - - - - - - - - - + <div class="col-12"> + <button type="submit" class="btn btn-primary">Submit</button> + </div> +</form>
    \ No newline at end of file diff --git a/docs/5.3/forms/overview/index.html b/docs/5.3/forms/overview/index.html index 1808183445..cc83ae19f9 100644 --- a/docs/5.3/forms/overview/index.html +++ b/docs/5.3/forms/overview/index.html @@ -1,634 +1,31 @@ - - - - - - - - - - - - - - - - -Forms · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Forms

    -
    -

    Examples and usage guidelines for form control styles, layout options, and custom components for creating a wide variety of forms.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - - - -

    Overview

    -

    Bootstrap’s form controls expand on our Rebooted form styles with classes. Use these classes to opt into their customized displays for a more consistent rendering across browsers and devices.

    + Forms · Bootstrap v5.3

    Examples and usage guidelines for form control styles, layout options, and custom components for creating a wide variety of forms.

    +
    On this page

    Overview

    +

    Bootstrap’s form controls expand on our Rebooted form styles with classes. Use these classes to opt into their customized displays for a more consistent rendering across browsers and devices.

    Be sure to use an appropriate type attribute on all inputs (e.g., email for email address or number for numerical information) to take advantage of newer input controls like email verification, number selection, and more.

    -

    Here’s a quick example to demonstrate Bootstrap’s form styles. Keep reading for documentation on required classes, form layout, and more.

    -
    -
    - -
    +

    Here’s a quick example to demonstrate Bootstrap’s form styles. Keep reading for documentation on required classes, form layout, and more.

    +
    @@ -643,45 +40,29 @@
    - - -
    - html -
    - - -
    -
    <form>
    -  <div class="mb-3">
    -    <label for="exampleInputEmail1" class="form-label">Email address</label>
    -    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
    -    <div id="emailHelp" class="form-text">We'll never share your email with anyone else.</div>
    -  </div>
    -  <div class="mb-3">
    -    <label for="exampleInputPassword1" class="form-label">Password</label>
    -    <input type="password" class="form-control" id="exampleInputPassword1">
    -  </div>
    -  <div class="mb-3 form-check">
    -    <input type="checkbox" class="form-check-input" id="exampleCheck1">
    -    <label class="form-check-label" for="exampleCheck1">Check me out</label>
    -  </div>
    -  <button type="submit" class="btn btn-primary">Submit</button>
    -</form>
    -
    - -

    Disabled forms

    +
    html
    <form>
    +  <div class="mb-3">
    +    <label for="exampleInputEmail1" class="form-label">Email address</label>
    +    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp">
    +    <div id="emailHelp" class="form-text">We'll never share your email with anyone else.</div>
    +  </div>
    +  <div class="mb-3">
    +    <label for="exampleInputPassword1" class="form-label">Password</label>
    +    <input type="password" class="form-control" id="exampleInputPassword1">
    +  </div>
    +  <div class="mb-3 form-check">
    +    <input type="checkbox" class="form-check-input" id="exampleCheck1">
    +    <label class="form-check-label" for="exampleCheck1">Check me out</label>
    +  </div>
    +  <button type="submit" class="btn btn-primary">Submit</button>
    +</form>
    +

    Disabled forms

    Add the disabled boolean attribute on an input to prevent user interactions and make it appear lighter.

    -
    <input class="form-control" id="disabledInput" type="text" placeholder="Disabled input here..." disabled>
    -

    Add the disabled attribute to a <fieldset> to disable all the controls within. Browsers treat all native form controls (<input>, <select>, and <button> elements) inside a <fieldset disabled> as disabled, preventing both keyboard and mouse interactions on them.

    +
    <input class="form-control" id="disabledInput" type="text" placeholder="Disabled input here..." disabled>
    +
    +

    Add the disabled attribute to a <fieldset> to disable all the controls within. Browsers treat all native form controls (<input>, <select>, and <button> elements) inside a <fieldset disabled> as disabled, preventing both keyboard and mouse interactions on them.

    However, if your form also includes custom button-like elements such as <a class="btn btn-*">...</a>, these will only be given a style of pointer-events: none, meaning they are still focusable and operable using the keyboard. In this case, you must manually modify these controls by adding tabindex="-1" to prevent them from receiving focus and aria-disabled="disabled" to signal their state to assistive technologies.

    -
    -
    - -
    +
    Disabled fieldset example
    @@ -698,53 +79,39 @@
    - - -
    - html -
    - - -
    -
    <form>
    -  <fieldset disabled>
    -    <legend>Disabled fieldset example</legend>
    -    <div class="mb-3">
    -      <label for="disabledTextInput" class="form-label">Disabled input</label>
    -      <input type="text" id="disabledTextInput" class="form-control" placeholder="Disabled input">
    -    </div>
    -    <div class="mb-3">
    -      <label for="disabledSelect" class="form-label">Disabled select menu</label>
    -      <select id="disabledSelect" class="form-select">
    -        <option>Disabled select</option>
    -      </select>
    -    </div>
    -    <div class="mb-3">
    -      <div class="form-check">
    -        <input class="form-check-input" type="checkbox" id="disabledFieldsetCheck" disabled>
    -        <label class="form-check-label" for="disabledFieldsetCheck">
    -          Can't check this
    -        </label>
    -      </div>
    -    </div>
    -    <button type="submit" class="btn btn-primary">Submit</button>
    -  </fieldset>
    -</form>
    -
    - -

    Accessibility

    +
    html
    <form>
    +  <fieldset disabled>
    +    <legend>Disabled fieldset example</legend>
    +    <div class="mb-3">
    +      <label for="disabledTextInput" class="form-label">Disabled input</label>
    +      <input type="text" id="disabledTextInput" class="form-control" placeholder="Disabled input">
    +    </div>
    +    <div class="mb-3">
    +      <label for="disabledSelect" class="form-label">Disabled select menu</label>
    +      <select id="disabledSelect" class="form-select">
    +        <option>Disabled select</option>
    +      </select>
    +    </div>
    +    <div class="mb-3">
    +      <div class="form-check">
    +        <input class="form-check-input" type="checkbox" id="disabledFieldsetCheck" disabled>
    +        <label class="form-check-label" for="disabledFieldsetCheck">
    +          Can’t check this
    +        </label>
    +      </div>
    +    </div>
    +    <button type="submit" class="btn btn-primary">Submit</button>
    +  </fieldset>
    +</form>
    +

    Accessibility

    Ensure that all form controls have an appropriate accessible name so that their purpose can be conveyed to users of assistive technologies. The simplest way to achieve this is to use a <label> element, or—in the case of buttons—to include sufficiently descriptive text as part of the <button>...</button> content.

    -

    For situations where it’s not possible to include a visible <label> or appropriate text content, there are alternative ways of still providing an accessible name, such as:

    +

    For situations where it’s not possible to include a visible <label> or appropriate text content, there are alternative ways of still providing an accessible name, such as:

    • <label> elements hidden using the .visually-hidden class
    • Pointing to an existing element that can act as a label using aria-labelledby
    • @@ -753,114 +120,33 @@

    If none of these are present, assistive technologies may resort to using the placeholder attribute as a fallback for the accessible name on <input> and <textarea> elements. The examples in this section provide a few suggested, case-specific approaches.

    While using visually hidden content (.visually-hidden, aria-label, and even placeholder content, which disappears once a form field has content) will benefit assistive technology users, a lack of visible label text may still be problematic for certain users. Some form of visible label is generally the best approach, both for accessibility and usability.

    -

    CSS

    -

    Many form variables are set at a general level to be re-used and extended by individual form components. You’ll see these most often as $input-btn-* and $input-* variables.

    -

    Sass variables

    -

    $input-btn-* variables are shared global variables between our buttons and our form components. You’ll find these frequently reassigned as values to other component-specific variables.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $input-btn-padding-y:         .375rem;
    -$input-btn-padding-x:         .75rem;
    -$input-btn-font-family:       null;
    -$input-btn-font-size:         $font-size-base;
    -$input-btn-line-height:       $line-height-base;
    -
    -$input-btn-focus-width:         $focus-ring-width;
    -$input-btn-focus-color-opacity: $focus-ring-opacity;
    -$input-btn-focus-color:         $focus-ring-color;
    -$input-btn-focus-blur:          $focus-ring-blur;
    -$input-btn-focus-box-shadow:    $focus-ring-box-shadow;
    -
    -$input-btn-padding-y-sm:      .25rem;
    -$input-btn-padding-x-sm:      .5rem;
    -$input-btn-font-size-sm:      $font-size-sm;
    -
    -$input-btn-padding-y-lg:      .5rem;
    -$input-btn-padding-x-lg:      1rem;
    -$input-btn-font-size-lg:      $font-size-lg;
    -
    -$input-btn-border-width:      var(--#{$prefix}border-width);
    -
    +

    CSS

    +

    Many form variables are set at a general level to be re-used and extended by individual form components. You’ll see these most often as $input-btn-* and $input-* variables.

    +

    Sass variables

    +

    $input-btn-* variables are shared global variables between our buttons and our form components. You’ll find these frequently reassigned as values to other component-specific variables.

    +
    $input-btn-padding-y:         .375rem;
    +$input-btn-padding-x:         .75rem;
    +$input-btn-font-family:       null;
    +$input-btn-font-size:         $font-size-base;
    +$input-btn-line-height:       $line-height-base;
     
    -      
    -
    -
    +$input-btn-focus-width: $focus-ring-width; +$input-btn-focus-color-opacity: $focus-ring-opacity; +$input-btn-focus-color: $focus-ring-color; +$input-btn-focus-blur: $focus-ring-blur; +$input-btn-focus-box-shadow: $focus-ring-box-shadow; +$input-btn-padding-y-sm: .25rem; +$input-btn-padding-x-sm: .5rem; +$input-btn-font-size-sm: $font-size-sm; - +$input-btn-padding-y-lg: .5rem; +$input-btn-padding-x-lg: 1rem; +$input-btn-font-size-lg: $font-size-lg; - - - - - - - - - - - +$input-btn-border-width: var(--#{$prefix}border-width); +
    \ No newline at end of file diff --git a/docs/5.3/forms/range/index.html b/docs/5.3/forms/range/index.html index beaacc094b..4ba89c2e3b 100644 --- a/docs/5.3/forms/range/index.html +++ b/docs/5.3/forms/range/index.html @@ -1,758 +1,68 @@ - - - - - - - - - - - - - - - - -Range · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Range

    -
    -

    Use our custom range inputs for consistent cross-browser styling and built-in customization.

    - - -
    - - -
    - - On this page -
    -
    - -
    -
    - - -
    - - -

    Overview

    -

    Create custom <input type="range"> controls with .form-range. The track (the background) and thumb (the value) are both styled to appear the same across browsers. As only Firefox supports “filling” their track from the left or right of the thumb as a means to visually indicate progress, we do not currently support it.

    -
    -
    - - - - -
    - html -
    - - -
    -
    <label for="customRange1" class="form-label">Example range</label>
    -<input type="range" class="form-range" id="customRange1">
    -
    - -

    Disabled

    + Range · Bootstrap v5.3

    Use our custom range inputs for consistent cross-browser styling and built-in customization.

    +
    On this page

    Overview

    +

    Create custom <input type="range"> controls with .form-range. The track (the background) and thumb (the value) are both styled to appear the same across browsers. As only Firefox supports “filling” their track from the left or right of the thumb as a means to visually indicate progress, we do not currently support it.

    +
    +
    html
    <label for="customRange1" class="form-label">Example range</label>
    +<input type="range" class="form-range" id="customRange1">
    +

    Disabled

    Add the disabled boolean attribute on an input to give it a grayed out appearance, remove pointer events, and prevent focusing.

    -
    -
    - - - - -
    - html -
    - - -
    -
    <label for="disabledRange" class="form-label">Disabled range</label>
    -<input type="range" class="form-range" id="disabledRange" disabled>
    -
    - -

    Min and max

    +
    +
    html
    <label for="disabledRange" class="form-label">Disabled range</label>
    +<input type="range" class="form-range" id="disabledRange" disabled>
    +

    Min and max

    Range inputs have implicit values for min and max0 and 100, respectively. You may specify new values for those using the min and max attributes.

    -
    -
    - - - +
    +
    html
    <label for="customRange2" class="form-label">Example range</label>
    +<input type="range" class="form-range" min="0" max="5" id="customRange2">
    +

    Steps

    +

    By default, range inputs “snap” to integer values. To change this, you can specify a step value. In the example below, we double the number of steps by using step="0.5".

    +
    +
    html
    <label for="customRange3" class="form-label">Example range</label>
    +<input type="range" class="form-range" min="0" max="5" step="0.5" id="customRange3">
    +

    CSS

    +

    Sass variables

    +
    $form-range-track-width:          100%;
    +$form-range-track-height:         .5rem;
    +$form-range-track-cursor:         pointer;
    +$form-range-track-bg:             var(--#{$prefix}secondary-bg);
    +$form-range-track-border-radius:  1rem;
    +$form-range-track-box-shadow:     var(--#{$prefix}box-shadow-inset);
     
    -  
    - html -
    - - -
    -
    <label for="customRange2" class="form-label">Example range</label>
    -<input type="range" class="form-range" min="0" max="5" id="customRange2">
    -
    - -

    Steps

    -

    By default, range inputs “snap” to integer values. To change this, you can specify a step value. In the example below, we double the number of steps by using step="0.5".

    -
    -
    - - - - -
    - html -
    - - -
    -
    <label for="customRange3" class="form-label">Example range</label>
    -<input type="range" class="form-range" min="0" max="5" step="0.5" id="customRange3">
    -
    - -

    CSS

    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $form-range-track-width:          100%;
    -$form-range-track-height:         .5rem;
    -$form-range-track-cursor:         pointer;
    -$form-range-track-bg:             var(--#{$prefix}secondary-bg);
    -$form-range-track-border-radius:  1rem;
    -$form-range-track-box-shadow:     var(--#{$prefix}box-shadow-inset);
    -
    -$form-range-thumb-width:                   1rem;
    -$form-range-thumb-height:                  $form-range-thumb-width;
    -$form-range-thumb-bg:                      $component-active-bg;
    -$form-range-thumb-border:                  0;
    -$form-range-thumb-border-radius:           1rem;
    -$form-range-thumb-box-shadow:              0 .1rem .25rem rgba($black, .1);
    -$form-range-thumb-focus-box-shadow:        0 0 0 1px $body-bg, $input-focus-box-shadow;
    -$form-range-thumb-focus-box-shadow-width:  $input-focus-width; // For focus box shadow issue in Edge
    -$form-range-thumb-active-bg:               tint-color($component-active-bg, 70%);
    -$form-range-thumb-disabled-bg:             var(--#{$prefix}secondary-color);
    -$form-range-thumb-transition:              background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - +$form-range-thumb-width: 1rem; +$form-range-thumb-height: $form-range-thumb-width; +$form-range-thumb-bg: $component-active-bg; +$form-range-thumb-border: 0; +$form-range-thumb-border-radius: 1rem; +$form-range-thumb-box-shadow: 0 .1rem .25rem rgba($black, .1); +$form-range-thumb-focus-box-shadow: 0 0 0 1px $body-bg, $input-focus-box-shadow; +$form-range-thumb-focus-box-shadow-width: $input-focus-width; // For focus box shadow issue in Edge +$form-range-thumb-active-bg: tint-color($component-active-bg, 70%); +$form-range-thumb-disabled-bg: var(--#{$prefix}secondary-color); +$form-range-thumb-transition: background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out; +
    \ No newline at end of file diff --git a/docs/5.3/forms/select/index.html b/docs/5.3/forms/select/index.html index 7603a4d517..106dcaf015 100644 --- a/docs/5.3/forms/select/index.html +++ b/docs/5.3/forms/select/index.html @@ -1,602 +1,42 @@ - - - - - - - - - - - - - - - - -Select · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Select

    -
    -

    Customize the native <select>s with custom CSS that changes the element’s initial appearance.

    - - -
    - - -
    - - On this page -
    -
    - -
    -
    - - -
    - - -

    Default

    -

    Custom <select> menus need only a custom class, .form-select to trigger the custom styles. Custom styles are limited to the <select>’s initial appearance and cannot modify the <option>s due to browser limitations.

    -
    -
    - - - - -
    - html -
    - - -
    -
    <select class="form-select" aria-label="Default select example">
    -  <option selected>Open this select menu</option>
    -  <option value="1">One</option>
    -  <option value="2">Two</option>
    -  <option value="3">Three</option>
    -</select>
    -
    - -

    Sizing

    +
    html
    <select class="form-select" aria-label="Default select example">
    +  <option selected>Open this select menu</option>
    +  <option value="1">One</option>
    +  <option value="2">Two</option>
    +  <option value="3">Three</option>
    +</select>
    +

    Sizing

    You may also choose from small and large custom selects to match our similarly sized text inputs.

    -
    -
    - - @@ -608,247 +48,101 @@ - - -
    - html -
    - - -
    -
    <select class="form-select form-select-lg mb-3" aria-label="Large select example">
    -  <option selected>Open this select menu</option>
    -  <option value="1">One</option>
    -  <option value="2">Two</option>
    -  <option value="3">Three</option>
    -</select>
    -
    -<select class="form-select form-select-sm" aria-label="Small select example">
    -  <option selected>Open this select menu</option>
    -  <option value="1">One</option>
    -  <option value="2">Two</option>
    -  <option value="3">Three</option>
    -</select>
    -
    +
    html
    <select class="form-select form-select-lg mb-3" aria-label="Large select example">
    +  <option selected>Open this select menu</option>
    +  <option value="1">One</option>
    +  <option value="2">Two</option>
    +  <option value="3">Three</option>
    +</select>
     
    +<select class="form-select form-select-sm" aria-label="Small select example">
    +  <option selected>Open this select menu</option>
    +  <option value="1">One</option>
    +  <option value="2">Two</option>
    +  <option value="3">Three</option>
    +</select>

    The multiple attribute is also supported:

    -
    -
    - - - - -
    - html -
    - - -
    -
    <select class="form-select" multiple aria-label="Multiple select example">
    -  <option selected>Open this select menu</option>
    -  <option value="1">One</option>
    -  <option value="2">Two</option>
    -  <option value="3">Three</option>
    -</select>
    -
    - +
    html
    <select class="form-select" multiple aria-label="Multiple select example">
    +  <option selected>Open this select menu</option>
    +  <option value="1">One</option>
    +  <option value="2">Two</option>
    +  <option value="3">Three</option>
    +</select>

    As is the size attribute:

    -
    -
    - - - - -
    - html -
    - - -
    -
    <select class="form-select" size="3" aria-label="Size 3 select example">
    -  <option selected>Open this select menu</option>
    -  <option value="1">One</option>
    -  <option value="2">Two</option>
    -  <option value="3">Three</option>
    -</select>
    -
    - -

    Disabled

    +
    html
    <select class="form-select" size="3" aria-label="Size 3 select example">
    +  <option selected>Open this select menu</option>
    +  <option value="1">One</option>
    +  <option value="2">Two</option>
    +  <option value="3">Three</option>
    +</select>
    +

    Disabled

    Add the disabled boolean attribute on a select to give it a grayed out appearance and remove pointer events.

    -
    -
    - - - +
    html
    <select class="form-select" aria-label="Disabled select example" disabled>
    +  <option selected>Open this select menu</option>
    +  <option value="1">One</option>
    +  <option value="2">Two</option>
    +  <option value="3">Three</option>
    +</select>
    +

    CSS

    +

    Sass variables

    +
    $form-select-padding-y:             $input-padding-y;
    +$form-select-padding-x:             $input-padding-x;
    +$form-select-font-family:           $input-font-family;
    +$form-select-font-size:             $input-font-size;
    +$form-select-indicator-padding:     $form-select-padding-x * 3; // Extra padding for background-image
    +$form-select-font-weight:           $input-font-weight;
    +$form-select-line-height:           $input-line-height;
    +$form-select-color:                 $input-color;
    +$form-select-bg:                    $input-bg;
    +$form-select-disabled-color:        null;
    +$form-select-disabled-bg:           $input-disabled-bg;
    +$form-select-disabled-border-color: $input-disabled-border-color;
    +$form-select-bg-position:           right $form-select-padding-x center;
    +$form-select-bg-size:               16px 12px; // In pixels because image dimensions
    +$form-select-indicator-color:       $gray-800;
    +$form-select-indicator:             url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='#{$form-select-indicator-color}' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/></svg>");
     
    -  
    - html -
    - - -
    -
    <select class="form-select" aria-label="Disabled select example" disabled>
    -  <option selected>Open this select menu</option>
    -  <option value="1">One</option>
    -  <option value="2">Two</option>
    -  <option value="3">Three</option>
    -</select>
    -
    +$form-select-feedback-icon-padding-end: $form-select-padding-x * 2.5 + $form-select-indicator-padding; +$form-select-feedback-icon-position: center right $form-select-indicator-padding; +$form-select-feedback-icon-size: $input-height-inner-half $input-height-inner-half; -

    CSS

    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $form-select-padding-y:             $input-padding-y;
    -$form-select-padding-x:             $input-padding-x;
    -$form-select-font-family:           $input-font-family;
    -$form-select-font-size:             $input-font-size;
    -$form-select-indicator-padding:     $form-select-padding-x * 3; // Extra padding for background-image
    -$form-select-font-weight:           $input-font-weight;
    -$form-select-line-height:           $input-line-height;
    -$form-select-color:                 $input-color;
    -$form-select-bg:                    $input-bg;
    -$form-select-disabled-color:        null;
    -$form-select-disabled-bg:           $input-disabled-bg;
    -$form-select-disabled-border-color: $input-disabled-border-color;
    -$form-select-bg-position:           right $form-select-padding-x center;
    -$form-select-bg-size:               16px 12px; // In pixels because image dimensions
    -$form-select-indicator-color:       $gray-800;
    -$form-select-indicator:             url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='none' stroke='#{$form-select-indicator-color}' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/></svg>");
    -
    -$form-select-feedback-icon-padding-end: $form-select-padding-x * 2.5 + $form-select-indicator-padding;
    -$form-select-feedback-icon-position:    center right $form-select-indicator-padding;
    -$form-select-feedback-icon-size:        $input-height-inner-half $input-height-inner-half;
    -
    -$form-select-border-width:        $input-border-width;
    -$form-select-border-color:        $input-border-color;
    -$form-select-border-radius:       $input-border-radius;
    -$form-select-box-shadow:          var(--#{$prefix}box-shadow-inset);
    -
    -$form-select-focus-border-color:  $input-focus-border-color;
    -$form-select-focus-width:         $input-focus-width;
    -$form-select-focus-box-shadow:    0 0 0 $form-select-focus-width $input-btn-focus-color;
    -
    -$form-select-padding-y-sm:        $input-padding-y-sm;
    -$form-select-padding-x-sm:        $input-padding-x-sm;
    -$form-select-font-size-sm:        $input-font-size-sm;
    -$form-select-border-radius-sm:    $input-border-radius-sm;
    -
    -$form-select-padding-y-lg:        $input-padding-y-lg;
    -$form-select-padding-x-lg:        $input-padding-x-lg;
    -$form-select-font-size-lg:        $input-font-size-lg;
    -$form-select-border-radius-lg:    $input-border-radius-lg;
    -
    -$form-select-transition:          $input-transition;
    -
    +$form-select-border-width: $input-border-width; +$form-select-border-color: $input-border-color; +$form-select-border-radius: $input-border-radius; +$form-select-box-shadow: var(--#{$prefix}box-shadow-inset); - - - +$form-select-focus-border-color: $input-focus-border-color; +$form-select-focus-width: $input-focus-width; +$form-select-focus-box-shadow: 0 0 0 $form-select-focus-width $input-btn-focus-color; +$form-select-padding-y-sm: $input-padding-y-sm; +$form-select-padding-x-sm: $input-padding-x-sm; +$form-select-font-size-sm: $input-font-size-sm; +$form-select-border-radius-sm: $input-border-radius-sm; - +$form-select-padding-y-lg: $input-padding-y-lg; +$form-select-padding-x-lg: $input-padding-x-lg; +$form-select-font-size-lg: $input-font-size-lg; +$form-select-border-radius-lg: $input-border-radius-lg; - - - - - - - - - - - +$form-select-transition: $input-transition; +
    \ No newline at end of file diff --git a/docs/5.3/forms/validation/index.html b/docs/5.3/forms/validation/index.html index 725aa7640c..4955a25292 100644 --- a/docs/5.3/forms/validation/index.html +++ b/docs/5.3/forms/validation/index.html @@ -1,582 +1,31 @@ - - - - - - - - - - - - - - - - -Validation · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Validation

    -
    -

    Provide valuable, actionable feedback to your users with HTML5 form validation, via browser default behaviors or custom styles and JavaScript.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -
    -We are aware that currently the client-side custom validation styles and tooltips are not accessible, since they are not exposed to assistive technologies. While we work on a solution, we’d recommend either using the server-side option or the default browser validation method. -
    - -

    How it works

    -

    Here’s how form validation works with Bootstrap:

    + Validation · Bootstrap v5.3

    Validation

    Provide valuable, actionable feedback to your users with HTML5 form validation, via browser default behaviors or custom styles and JavaScript.

    +

    We are aware that currently the client-side custom validation styles and tooltips are not accessible, since they are not exposed to assistive technologies. While we work on a solution, we’d recommend either using the server-side option or the default browser validation method.

    +

    How it works

    +

    Here’s how form validation works with Bootstrap:

      -
    • HTML form validation is applied via CSS’s two pseudo-classes, :invalid and :valid. It applies to <input>, <select>, and <textarea> elements.
    • +
    • HTML form validation is applied via CSS’s two pseudo-classes, :invalid and :valid. It applies to <input>, <select>, and <textarea> elements.
    • Bootstrap scopes the :invalid and :valid styles to parent .was-validated class, usually applied to the <form>. Otherwise, any required field without a value shows up as invalid on page load. This way, you may choose when to activate them (typically after form submission is attempted).
    • To reset the appearance of the form (for instance, in the case of dynamic form submissions using Ajax), remove the .was-validated class from the <form> again after submission.
    • As a fallback, .is-invalid and .is-valid classes may be used instead of the pseudo-classes for server-side validation. They do not require a .was-validated parent class.
    • @@ -586,13 +35,10 @@ We are aware that currently the client-side custom validation styles and tooltip
    • You may provide custom validity messages with setCustomValidity in JavaScript.

    With that in mind, consider the following demos for our custom form validation styles, optional server-side classes, and browser defaults.

    -

    Custom styles

    -

    For custom Bootstrap form validation messages, you’ll need to add the novalidate boolean attribute to your <form>. This disables the browser default feedback tooltips, but still provides access to the form validation APIs in JavaScript. Try to submit the form below; our JavaScript will intercept the submit button and relay feedback to you. When attempting to submit, you’ll see the :invalid and :valid styles applied to your form controls.

    +

    Custom styles

    +

    For custom Bootstrap form validation messages, you’ll need to add the novalidate boolean attribute to your <form>. This disables the browser default feedback tooltips, but still provides access to the form validation APIs in JavaScript. Try to submit the form below; our JavaScript will intercept the submit button and relay feedback to you. When attempting to submit, you’ll see the :invalid and :valid styles applied to your form controls.

    Custom feedback styles apply custom colors, borders, focus styles, and background icons to better communicate feedback. Background icons for <select>s are only available with .form-select, and not .form-control.

    -
    -
    - -
    +
    @@ -655,112 +101,94 @@ We are aware that currently the client-side custom validation styles and tooltip
    - +
    html
    <form class="row g-3 needs-validation" novalidate>
    +  <div class="col-md-4">
    +    <label for="validationCustom01" class="form-label">First name</label>
    +    <input type="text" class="form-control" id="validationCustom01" value="Mark" required>
    +    <div class="valid-feedback">
    +      Looks good!
    +    </div>
    +  </div>
    +  <div class="col-md-4">
    +    <label for="validationCustom02" class="form-label">Last name</label>
    +    <input type="text" class="form-control" id="validationCustom02" value="Otto" required>
    +    <div class="valid-feedback">
    +      Looks good!
    +    </div>
    +  </div>
    +  <div class="col-md-4">
    +    <label for="validationCustomUsername" class="form-label">Username</label>
    +    <div class="input-group has-validation">
    +      <span class="input-group-text" id="inputGroupPrepend">@</span>
    +      <input type="text" class="form-control" id="validationCustomUsername" aria-describedby="inputGroupPrepend" required>
    +      <div class="invalid-feedback">
    +        Please choose a username.
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col-md-6">
    +    <label for="validationCustom03" class="form-label">City</label>
    +    <input type="text" class="form-control" id="validationCustom03" required>
    +    <div class="invalid-feedback">
    +      Please provide a valid city.
    +    </div>
    +  </div>
    +  <div class="col-md-3">
    +    <label for="validationCustom04" class="form-label">State</label>
    +    <select class="form-select" id="validationCustom04" required>
    +      <option selected disabled value="">Choose...</option>
    +      <option>...</option>
    +    </select>
    +    <div class="invalid-feedback">
    +      Please select a valid state.
    +    </div>
    +  </div>
    +  <div class="col-md-3">
    +    <label for="validationCustom05" class="form-label">Zip</label>
    +    <input type="text" class="form-control" id="validationCustom05" required>
    +    <div class="invalid-feedback">
    +      Please provide a valid zip.
    +    </div>
    +  </div>
    +  <div class="col-12">
    +    <div class="form-check">
    +      <input class="form-check-input" type="checkbox" value="" id="invalidCheck" required>
    +      <label class="form-check-label" for="invalidCheck">
    +        Agree to terms and conditions
    +      </label>
    +      <div class="invalid-feedback">
    +        You must agree before submitting.
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col-12">
    +    <button class="btn btn-primary" type="submit">Submit form</button>
    +  </div>
    +</form>
    +
    // Example starter JavaScript for disabling form submissions if there are invalid fields
    +(() => {
    +  'use strict'
     
    -  
    - html -
    - - -
    -
    <form class="row g-3 needs-validation" novalidate>
    -  <div class="col-md-4">
    -    <label for="validationCustom01" class="form-label">First name</label>
    -    <input type="text" class="form-control" id="validationCustom01" value="Mark" required>
    -    <div class="valid-feedback">
    -      Looks good!
    -    </div>
    -  </div>
    -  <div class="col-md-4">
    -    <label for="validationCustom02" class="form-label">Last name</label>
    -    <input type="text" class="form-control" id="validationCustom02" value="Otto" required>
    -    <div class="valid-feedback">
    -      Looks good!
    -    </div>
    -  </div>
    -  <div class="col-md-4">
    -    <label for="validationCustomUsername" class="form-label">Username</label>
    -    <div class="input-group has-validation">
    -      <span class="input-group-text" id="inputGroupPrepend">@</span>
    -      <input type="text" class="form-control" id="validationCustomUsername" aria-describedby="inputGroupPrepend" required>
    -      <div class="invalid-feedback">
    -        Please choose a username.
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col-md-6">
    -    <label for="validationCustom03" class="form-label">City</label>
    -    <input type="text" class="form-control" id="validationCustom03" required>
    -    <div class="invalid-feedback">
    -      Please provide a valid city.
    -    </div>
    -  </div>
    -  <div class="col-md-3">
    -    <label for="validationCustom04" class="form-label">State</label>
    -    <select class="form-select" id="validationCustom04" required>
    -      <option selected disabled value="">Choose...</option>
    -      <option>...</option>
    -    </select>
    -    <div class="invalid-feedback">
    -      Please select a valid state.
    -    </div>
    -  </div>
    -  <div class="col-md-3">
    -    <label for="validationCustom05" class="form-label">Zip</label>
    -    <input type="text" class="form-control" id="validationCustom05" required>
    -    <div class="invalid-feedback">
    -      Please provide a valid zip.
    -    </div>
    -  </div>
    -  <div class="col-12">
    -    <div class="form-check">
    -      <input class="form-check-input" type="checkbox" value="" id="invalidCheck" required>
    -      <label class="form-check-label" for="invalidCheck">
    -        Agree to terms and conditions
    -      </label>
    -      <div class="invalid-feedback">
    -        You must agree before submitting.
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col-12">
    -    <button class="btn btn-primary" type="submit">Submit form</button>
    -  </div>
    -</form>
    -
    + // Fetch all the forms we want to apply custom Bootstrap validation styles to + const forms = document.querySelectorAll('.needs-validation') -
    // Example starter JavaScript for disabling form submissions if there are invalid fields
    -(() => {
    -  'use strict'
    -
    -  // Fetch all the forms we want to apply custom Bootstrap validation styles to
    -  const forms = document.querySelectorAll('.needs-validation')
    -
    -  // Loop over them and prevent submission
    -  Array.from(forms).forEach(form => {
    -    form.addEventListener('submit', event => {
    -      if (!form.checkValidity()) {
    -        event.preventDefault()
    -        event.stopPropagation()
    -      }
    -
    -      form.classList.add('was-validated')
    -    }, false)
    -  })
    -})()
    -
    + // Loop over them and prevent submission + Array.from(forms).forEach(form => { + form.addEventListener('submit', event => { + if (!form.checkValidity()) { + event.preventDefault() + event.stopPropagation() + } -

    Browser defaults

    -

    Not interested in custom validation feedback messages or writing JavaScript to change form behaviors? All good, you can use the browser defaults. Try submitting the form below. Depending on your browser and OS, you’ll see a slightly different style of feedback.

    + form.classList.add('was-validated') + }, false) + }) +})() +
    +

    Browser defaults

    +

    Not interested in custom validation feedback messages or writing JavaScript to change form behaviors? All good, you can use the browser defaults. Try submitting the form below. Depending on your browser and OS, you’ll see a slightly different style of feedback.

    While these feedback styles cannot be styled with CSS, you can still customize the feedback text through JavaScript.

    -
    -
    - -
    +
    @@ -802,71 +230,54 @@ We are aware that currently the client-side custom validation styles and tooltip
    - - -
    - html -
    - - -
    -
    <form class="row g-3">
    -  <div class="col-md-4">
    -    <label for="validationDefault01" class="form-label">First name</label>
    -    <input type="text" class="form-control" id="validationDefault01" value="Mark" required>
    -  </div>
    -  <div class="col-md-4">
    -    <label for="validationDefault02" class="form-label">Last name</label>
    -    <input type="text" class="form-control" id="validationDefault02" value="Otto" required>
    -  </div>
    -  <div class="col-md-4">
    -    <label for="validationDefaultUsername" class="form-label">Username</label>
    -    <div class="input-group">
    -      <span class="input-group-text" id="inputGroupPrepend2">@</span>
    -      <input type="text" class="form-control" id="validationDefaultUsername" aria-describedby="inputGroupPrepend2" required>
    -    </div>
    -  </div>
    -  <div class="col-md-6">
    -    <label for="validationDefault03" class="form-label">City</label>
    -    <input type="text" class="form-control" id="validationDefault03" required>
    -  </div>
    -  <div class="col-md-3">
    -    <label for="validationDefault04" class="form-label">State</label>
    -    <select class="form-select" id="validationDefault04" required>
    -      <option selected disabled value="">Choose...</option>
    -      <option>...</option>
    -    </select>
    -  </div>
    -  <div class="col-md-3">
    -    <label for="validationDefault05" class="form-label">Zip</label>
    -    <input type="text" class="form-control" id="validationDefault05" required>
    -  </div>
    -  <div class="col-12">
    -    <div class="form-check">
    -      <input class="form-check-input" type="checkbox" value="" id="invalidCheck2" required>
    -      <label class="form-check-label" for="invalidCheck2">
    -        Agree to terms and conditions
    -      </label>
    -    </div>
    -  </div>
    -  <div class="col-12">
    -    <button class="btn btn-primary" type="submit">Submit form</button>
    -  </div>
    -</form>
    -
    - -

    Server-side

    +
    html
    <form class="row g-3">
    +  <div class="col-md-4">
    +    <label for="validationDefault01" class="form-label">First name</label>
    +    <input type="text" class="form-control" id="validationDefault01" value="Mark" required>
    +  </div>
    +  <div class="col-md-4">
    +    <label for="validationDefault02" class="form-label">Last name</label>
    +    <input type="text" class="form-control" id="validationDefault02" value="Otto" required>
    +  </div>
    +  <div class="col-md-4">
    +    <label for="validationDefaultUsername" class="form-label">Username</label>
    +    <div class="input-group">
    +      <span class="input-group-text" id="inputGroupPrepend2">@</span>
    +      <input type="text" class="form-control" id="validationDefaultUsername" aria-describedby="inputGroupPrepend2" required>
    +    </div>
    +  </div>
    +  <div class="col-md-6">
    +    <label for="validationDefault03" class="form-label">City</label>
    +    <input type="text" class="form-control" id="validationDefault03" required>
    +  </div>
    +  <div class="col-md-3">
    +    <label for="validationDefault04" class="form-label">State</label>
    +    <select class="form-select" id="validationDefault04" required>
    +      <option selected disabled value="">Choose...</option>
    +      <option>...</option>
    +    </select>
    +  </div>
    +  <div class="col-md-3">
    +    <label for="validationDefault05" class="form-label">Zip</label>
    +    <input type="text" class="form-control" id="validationDefault05" required>
    +  </div>
    +  <div class="col-12">
    +    <div class="form-check">
    +      <input class="form-check-input" type="checkbox" value="" id="invalidCheck2" required>
    +      <label class="form-check-label" for="invalidCheck2">
    +        Agree to terms and conditions
    +      </label>
    +    </div>
    +  </div>
    +  <div class="col-12">
    +    <button class="btn btn-primary" type="submit">Submit form</button>
    +  </div>
    +</form>
    +

    Server-side

    We recommend using client-side validation, but in case you require server-side validation, you can indicate invalid and valid form fields with .is-invalid and .is-valid. Note that .invalid-feedback is also supported with these classes.

    For invalid fields, ensure that the invalid feedback/error message is associated with the relevant form field using aria-describedby (noting that this attribute allows more than one id to be referenced, in case the field already points to additional form text).

    To fix issues with border radius, input groups require an additional .has-validation class.

    -
    -
    - -
    +
    @@ -929,95 +340,78 @@ We are aware that currently the client-side custom validation styles and tooltip
    - - -
    - html -
    - - -
    -
    <form class="row g-3">
    -  <div class="col-md-4">
    -    <label for="validationServer01" class="form-label">First name</label>
    -    <input type="text" class="form-control is-valid" id="validationServer01" value="Mark" required>
    -    <div class="valid-feedback">
    -      Looks good!
    -    </div>
    -  </div>
    -  <div class="col-md-4">
    -    <label for="validationServer02" class="form-label">Last name</label>
    -    <input type="text" class="form-control is-valid" id="validationServer02" value="Otto" required>
    -    <div class="valid-feedback">
    -      Looks good!
    -    </div>
    -  </div>
    -  <div class="col-md-4">
    -    <label for="validationServerUsername" class="form-label">Username</label>
    -    <div class="input-group has-validation">
    -      <span class="input-group-text" id="inputGroupPrepend3">@</span>
    -      <input type="text" class="form-control is-invalid" id="validationServerUsername" aria-describedby="inputGroupPrepend3 validationServerUsernameFeedback" required>
    -      <div id="validationServerUsernameFeedback" class="invalid-feedback">
    -        Please choose a username.
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col-md-6">
    -    <label for="validationServer03" class="form-label">City</label>
    -    <input type="text" class="form-control is-invalid" id="validationServer03" aria-describedby="validationServer03Feedback" required>
    -    <div id="validationServer03Feedback" class="invalid-feedback">
    -      Please provide a valid city.
    -    </div>
    -  </div>
    -  <div class="col-md-3">
    -    <label for="validationServer04" class="form-label">State</label>
    -    <select class="form-select is-invalid" id="validationServer04" aria-describedby="validationServer04Feedback" required>
    -      <option selected disabled value="">Choose...</option>
    -      <option>...</option>
    -    </select>
    -    <div id="validationServer04Feedback" class="invalid-feedback">
    -      Please select a valid state.
    -    </div>
    -  </div>
    -  <div class="col-md-3">
    -    <label for="validationServer05" class="form-label">Zip</label>
    -    <input type="text" class="form-control is-invalid" id="validationServer05" aria-describedby="validationServer05Feedback" required>
    -    <div id="validationServer05Feedback" class="invalid-feedback">
    -      Please provide a valid zip.
    -    </div>
    -  </div>
    -  <div class="col-12">
    -    <div class="form-check">
    -      <input class="form-check-input is-invalid" type="checkbox" value="" id="invalidCheck3" aria-describedby="invalidCheck3Feedback" required>
    -      <label class="form-check-label" for="invalidCheck3">
    -        Agree to terms and conditions
    -      </label>
    -      <div id="invalidCheck3Feedback" class="invalid-feedback">
    -        You must agree before submitting.
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col-12">
    -    <button class="btn btn-primary" type="submit">Submit form</button>
    -  </div>
    -</form>
    -
    - -

    Supported elements

    +
    html
    <form class="row g-3">
    +  <div class="col-md-4">
    +    <label for="validationServer01" class="form-label">First name</label>
    +    <input type="text" class="form-control is-valid" id="validationServer01" value="Mark" required>
    +    <div class="valid-feedback">
    +      Looks good!
    +    </div>
    +  </div>
    +  <div class="col-md-4">
    +    <label for="validationServer02" class="form-label">Last name</label>
    +    <input type="text" class="form-control is-valid" id="validationServer02" value="Otto" required>
    +    <div class="valid-feedback">
    +      Looks good!
    +    </div>
    +  </div>
    +  <div class="col-md-4">
    +    <label for="validationServerUsername" class="form-label">Username</label>
    +    <div class="input-group has-validation">
    +      <span class="input-group-text" id="inputGroupPrepend3">@</span>
    +      <input type="text" class="form-control is-invalid" id="validationServerUsername" aria-describedby="inputGroupPrepend3 validationServerUsernameFeedback" required>
    +      <div id="validationServerUsernameFeedback" class="invalid-feedback">
    +        Please choose a username.
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col-md-6">
    +    <label for="validationServer03" class="form-label">City</label>
    +    <input type="text" class="form-control is-invalid" id="validationServer03" aria-describedby="validationServer03Feedback" required>
    +    <div id="validationServer03Feedback" class="invalid-feedback">
    +      Please provide a valid city.
    +    </div>
    +  </div>
    +  <div class="col-md-3">
    +    <label for="validationServer04" class="form-label">State</label>
    +    <select class="form-select is-invalid" id="validationServer04" aria-describedby="validationServer04Feedback" required>
    +      <option selected disabled value="">Choose...</option>
    +      <option>...</option>
    +    </select>
    +    <div id="validationServer04Feedback" class="invalid-feedback">
    +      Please select a valid state.
    +    </div>
    +  </div>
    +  <div class="col-md-3">
    +    <label for="validationServer05" class="form-label">Zip</label>
    +    <input type="text" class="form-control is-invalid" id="validationServer05" aria-describedby="validationServer05Feedback" required>
    +    <div id="validationServer05Feedback" class="invalid-feedback">
    +      Please provide a valid zip.
    +    </div>
    +  </div>
    +  <div class="col-12">
    +    <div class="form-check">
    +      <input class="form-check-input is-invalid" type="checkbox" value="" id="invalidCheck3" aria-describedby="invalidCheck3Feedback" required>
    +      <label class="form-check-label" for="invalidCheck3">
    +        Agree to terms and conditions
    +      </label>
    +      <div id="invalidCheck3Feedback" class="invalid-feedback">
    +        You must agree before submitting.
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col-12">
    +    <button class="btn btn-primary" type="submit">Submit form</button>
    +  </div>
    +</form>
    +

    Supported elements

    Validation styles are available for the following form controls and components:

    • <input>s and <textarea>s with .form-control (including up to one .form-control in input groups)
    • <select>s with .form-select
    • .form-checks
    -
    -
    - -
    +
    @@ -1060,70 +454,53 @@ We are aware that currently the client-side custom validation styles and tooltip
    - +
    html
    <form class="was-validated">
    +  <div class="mb-3">
    +    <label for="validationTextarea" class="form-label">Textarea</label>
    +    <textarea class="form-control" id="validationTextarea" placeholder="Required example textarea" required></textarea>
    +    <div class="invalid-feedback">
    +      Please enter a message in the textarea.
    +    </div>
    +  </div>
     
    -  
    - html -
    - - -
    -
    <form class="was-validated">
    -  <div class="mb-3">
    -    <label for="validationTextarea" class="form-label">Textarea</label>
    -    <textarea class="form-control" id="validationTextarea" placeholder="Required example textarea" required></textarea>
    -    <div class="invalid-feedback">
    -      Please enter a message in the textarea.
    -    </div>
    -  </div>
    -
    -  <div class="form-check mb-3">
    -    <input type="checkbox" class="form-check-input" id="validationFormCheck1" required>
    -    <label class="form-check-label" for="validationFormCheck1">Check this checkbox</label>
    -    <div class="invalid-feedback">Example invalid feedback text</div>
    -  </div>
    -
    -  <div class="form-check">
    -    <input type="radio" class="form-check-input" id="validationFormCheck2" name="radio-stacked" required>
    -    <label class="form-check-label" for="validationFormCheck2">Toggle this radio</label>
    -  </div>
    -  <div class="form-check mb-3">
    -    <input type="radio" class="form-check-input" id="validationFormCheck3" name="radio-stacked" required>
    -    <label class="form-check-label" for="validationFormCheck3">Or toggle this other radio</label>
    -    <div class="invalid-feedback">More example invalid feedback text</div>
    -  </div>
    -
    -  <div class="mb-3">
    -    <select class="form-select" required aria-label="select example">
    -      <option value="">Open this select menu</option>
    -      <option value="1">One</option>
    -      <option value="2">Two</option>
    -      <option value="3">Three</option>
    -    </select>
    -    <div class="invalid-feedback">Example invalid select feedback</div>
    -  </div>
    -
    -  <div class="mb-3">
    -    <input type="file" class="form-control" aria-label="file example" required>
    -    <div class="invalid-feedback">Example invalid form file feedback</div>
    -  </div>
    -
    -  <div class="mb-3">
    -    <button class="btn btn-primary" type="submit" disabled>Submit form</button>
    -  </div>
    -</form>
    -
    + <div class="form-check mb-3"> + <input type="checkbox" class="form-check-input" id="validationFormCheck1" required> + <label class="form-check-label" for="validationFormCheck1">Check this checkbox</label> + <div class="invalid-feedback">Example invalid feedback text</div> + </div> -

    Tooltips

    + <div class="form-check"> + <input type="radio" class="form-check-input" id="validationFormCheck2" name="radio-stacked" required> + <label class="form-check-label" for="validationFormCheck2">Toggle this radio</label> + </div> + <div class="form-check mb-3"> + <input type="radio" class="form-check-input" id="validationFormCheck3" name="radio-stacked" required> + <label class="form-check-label" for="validationFormCheck3">Or toggle this other radio</label> + <div class="invalid-feedback">More example invalid feedback text</div> + </div> + + <div class="mb-3"> + <select class="form-select" required aria-label="select example"> + <option value="">Open this select menu</option> + <option value="1">One</option> + <option value="2">Two</option> + <option value="3">Three</option> + </select> + <div class="invalid-feedback">Example invalid select feedback</div> + </div> + + <div class="mb-3"> + <input type="file" class="form-control" aria-label="file example" required> + <div class="invalid-feedback">Example invalid form file feedback</div> + </div> + + <div class="mb-3"> + <button class="btn btn-primary" type="submit" disabled>Submit form</button> + </div> +</form>
    +

    Tooltips

    If your form layout allows it, you can swap the .{valid|invalid}-feedback classes for .{valid|invalid}-tooltip classes to display validation feedback in a styled tooltip. Be sure to have a parent with position: relative on it for tooltip positioning. In the example below, our column classes have this already, but your project may require an alternative setup.

    -
    -
    - -
    +
    @@ -1175,426 +552,283 @@ We are aware that currently the client-side custom validation styles and tooltip
    - - -
    - html -
    - - -
    -
    <form class="row g-3 needs-validation" novalidate>
    -  <div class="col-md-4 position-relative">
    -    <label for="validationTooltip01" class="form-label">First name</label>
    -    <input type="text" class="form-control" id="validationTooltip01" value="Mark" required>
    -    <div class="valid-tooltip">
    -      Looks good!
    -    </div>
    -  </div>
    -  <div class="col-md-4 position-relative">
    -    <label for="validationTooltip02" class="form-label">Last name</label>
    -    <input type="text" class="form-control" id="validationTooltip02" value="Otto" required>
    -    <div class="valid-tooltip">
    -      Looks good!
    -    </div>
    -  </div>
    -  <div class="col-md-4 position-relative">
    -    <label for="validationTooltipUsername" class="form-label">Username</label>
    -    <div class="input-group has-validation">
    -      <span class="input-group-text" id="validationTooltipUsernamePrepend">@</span>
    -      <input type="text" class="form-control" id="validationTooltipUsername" aria-describedby="validationTooltipUsernamePrepend" required>
    -      <div class="invalid-tooltip">
    -        Please choose a unique and valid username.
    -      </div>
    -    </div>
    -  </div>
    -  <div class="col-md-6 position-relative">
    -    <label for="validationTooltip03" class="form-label">City</label>
    -    <input type="text" class="form-control" id="validationTooltip03" required>
    -    <div class="invalid-tooltip">
    -      Please provide a valid city.
    -    </div>
    -  </div>
    -  <div class="col-md-3 position-relative">
    -    <label for="validationTooltip04" class="form-label">State</label>
    -    <select class="form-select" id="validationTooltip04" required>
    -      <option selected disabled value="">Choose...</option>
    -      <option>...</option>
    -    </select>
    -    <div class="invalid-tooltip">
    -      Please select a valid state.
    -    </div>
    -  </div>
    -  <div class="col-md-3 position-relative">
    -    <label for="validationTooltip05" class="form-label">Zip</label>
    -    <input type="text" class="form-control" id="validationTooltip05" required>
    -    <div class="invalid-tooltip">
    -      Please provide a valid zip.
    -    </div>
    -  </div>
    -  <div class="col-12">
    -    <button class="btn btn-primary" type="submit">Submit form</button>
    -  </div>
    -</form>
    -
    - -

    CSS

    -

    Variables

    +
    html
    <form class="row g-3 needs-validation" novalidate>
    +  <div class="col-md-4 position-relative">
    +    <label for="validationTooltip01" class="form-label">First name</label>
    +    <input type="text" class="form-control" id="validationTooltip01" value="Mark" required>
    +    <div class="valid-tooltip">
    +      Looks good!
    +    </div>
    +  </div>
    +  <div class="col-md-4 position-relative">
    +    <label for="validationTooltip02" class="form-label">Last name</label>
    +    <input type="text" class="form-control" id="validationTooltip02" value="Otto" required>
    +    <div class="valid-tooltip">
    +      Looks good!
    +    </div>
    +  </div>
    +  <div class="col-md-4 position-relative">
    +    <label for="validationTooltipUsername" class="form-label">Username</label>
    +    <div class="input-group has-validation">
    +      <span class="input-group-text" id="validationTooltipUsernamePrepend">@</span>
    +      <input type="text" class="form-control" id="validationTooltipUsername" aria-describedby="validationTooltipUsernamePrepend" required>
    +      <div class="invalid-tooltip">
    +        Please choose a unique and valid username.
    +      </div>
    +    </div>
    +  </div>
    +  <div class="col-md-6 position-relative">
    +    <label for="validationTooltip03" class="form-label">City</label>
    +    <input type="text" class="form-control" id="validationTooltip03" required>
    +    <div class="invalid-tooltip">
    +      Please provide a valid city.
    +    </div>
    +  </div>
    +  <div class="col-md-3 position-relative">
    +    <label for="validationTooltip04" class="form-label">State</label>
    +    <select class="form-select" id="validationTooltip04" required>
    +      <option selected disabled value="">Choose...</option>
    +      <option>...</option>
    +    </select>
    +    <div class="invalid-tooltip">
    +      Please select a valid state.
    +    </div>
    +  </div>
    +  <div class="col-md-3 position-relative">
    +    <label for="validationTooltip05" class="form-label">Zip</label>
    +    <input type="text" class="form-control" id="validationTooltip05" required>
    +    <div class="invalid-tooltip">
    +      Please provide a valid zip.
    +    </div>
    +  </div>
    +  <div class="col-12">
    +    <button class="btn btn-primary" type="submit">Submit form</button>
    +  </div>
    +</form>
    +

    CSS

    +

    Variables

    Added in v5.3.0 - -

    As part of Bootstrap’s evolving CSS variables approach, forms now use local CSS variables for validation for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    -
    -
    - scss/_root.scss -
    - -
    -
    --#{$prefix}form-valid-color: #{$form-valid-color};
    ---#{$prefix}form-valid-border-color: #{$form-valid-border-color};
    ---#{$prefix}form-invalid-color: #{$form-invalid-color};
    ---#{$prefix}form-invalid-border-color: #{$form-invalid-border-color};
    +

    As part of Bootstrap’s evolving CSS variables approach, forms now use local CSS variables for validation for enhanced real-time customization. Values for the CSS variables are set via Sass, so Sass customization is still supported, too.

    +
    --#{$prefix}form-valid-color: #{$form-valid-color};
    +--#{$prefix}form-valid-border-color: #{$form-valid-border-color};
    +--#{$prefix}form-invalid-color: #{$form-invalid-color};
    +--#{$prefix}form-invalid-border-color: #{$form-invalid-border-color};
    +

    These variables are also color mode adaptive, meaning they change color while in dark mode.

    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $form-feedback-margin-top:          $form-text-margin-top;
    -$form-feedback-font-size:           $form-text-font-size;
    -$form-feedback-font-style:          $form-text-font-style;
    -$form-feedback-valid-color:         $success;
    -$form-feedback-invalid-color:       $danger;
    -
    -$form-feedback-icon-valid-color:    $form-feedback-valid-color;
    -$form-feedback-icon-valid:          url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'><path fill='#{$form-feedback-icon-valid-color}' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1'/></svg>");
    -$form-feedback-icon-invalid-color:  $form-feedback-invalid-color;
    -$form-feedback-icon-invalid:        url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='#{$form-feedback-icon-invalid-color}'><circle cx='6' cy='6' r='4.5'/><path stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/><circle cx='6' cy='8.2' r='.6' fill='#{$form-feedback-icon-invalid-color}' stroke='none'/></svg>");
    -
    -
    -
    - scss/_variables.scss -
    - -
    -
    $form-valid-color:                  $form-feedback-valid-color;
    -$form-valid-border-color:           $form-feedback-valid-color;
    -$form-invalid-color:                $form-feedback-invalid-color;
    -$form-invalid-border-color:         $form-feedback-invalid-color;
    -
    -
    -
    $form-valid-color-dark:             $green-300;
    -$form-valid-border-color-dark:      $green-300;
    -$form-invalid-color-dark:           $red-300;
    -$form-invalid-border-color-dark:    $red-300;
    -
    -

    Sass mixins

    +

    Sass variables

    +
    $form-feedback-margin-top:          $form-text-margin-top;
    +$form-feedback-font-size:           $form-text-font-size;
    +$form-feedback-font-style:          $form-text-font-style;
    +$form-feedback-valid-color:         $success;
    +$form-feedback-invalid-color:       $danger;
    +
    +$form-feedback-icon-valid-color:    $form-feedback-valid-color;
    +$form-feedback-icon-valid:          url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'><path fill='#{$form-feedback-icon-valid-color}' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1'/></svg>");
    +$form-feedback-icon-invalid-color:  $form-feedback-invalid-color;
    +$form-feedback-icon-invalid:        url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='#{$form-feedback-icon-invalid-color}'><circle cx='6' cy='6' r='4.5'/><path stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/><circle cx='6' cy='8.2' r='.6' fill='#{$form-feedback-icon-invalid-color}' stroke='none'/></svg>");
    +
    +
    $form-valid-color:                  $form-feedback-valid-color;
    +$form-valid-border-color:           $form-feedback-valid-color;
    +$form-invalid-color:                $form-feedback-invalid-color;
    +$form-invalid-border-color:         $form-feedback-invalid-color;
    +
    +
    $form-valid-color-dark:             $green-300;
    +$form-valid-border-color-dark:      $green-300;
    +$form-invalid-color-dark:           $red-300;
    +$form-invalid-border-color-dark:    $red-300;
    +
    +

    Sass mixins

    Two mixins are combined, through our loop, to generate our form validation feedback styles.

    -
    -
    - scss/mixins/_forms.scss -
    - -
    -
    @mixin form-validation-state-selector($state) {
    -  @if ($state == "valid" or $state == "invalid") {
    -    .was-validated #{if(&, "&", "")}:#{$state},
    -    #{if(&, "&", "")}.is-#{$state} {
    -      @content;
    -    }
    -  } @else {
    -    #{if(&, "&", "")}.is-#{$state} {
    -      @content;
    -    }
    -  }
    -}
    -
    -@mixin form-validation-state(
    -  $state,
    -  $color,
    -  $icon,
    -  $tooltip-color: color-contrast($color),
    -  $tooltip-bg-color: rgba($color, $form-feedback-tooltip-opacity),
    -  $focus-box-shadow: 0 0 $input-btn-focus-blur $input-focus-width rgba($color, $input-btn-focus-color-opacity),
    -  $border-color: $color
    -) {
    -  .#{$state}-feedback {
    -    display: none;
    -    width: 100%;
    -    margin-top: $form-feedback-margin-top;
    -    @include font-size($form-feedback-font-size);
    -    font-style: $form-feedback-font-style;
    -    color: $color;
    -  }
    -
    -  .#{$state}-tooltip {
    -    position: absolute;
    -    top: 100%;
    -    z-index: 5;
    -    display: none;
    -    max-width: 100%; // Contain to parent when possible
    -    padding: $form-feedback-tooltip-padding-y $form-feedback-tooltip-padding-x;
    -    margin-top: .1rem;
    -    @include font-size($form-feedback-tooltip-font-size);
    -    line-height: $form-feedback-tooltip-line-height;
    -    color: $tooltip-color;
    -    background-color: $tooltip-bg-color;
    -    @include border-radius($form-feedback-tooltip-border-radius);
    -  }
    -
    -  @include form-validation-state-selector($state) {
    -    ~ .#{$state}-feedback,
    -    ~ .#{$state}-tooltip {
    -      display: block;
    -    }
    -  }
    -
    -  .form-control {
    -    @include form-validation-state-selector($state) {
    -      border-color: $border-color;
    -
    -      @if $enable-validation-icons {
    -        padding-right: $input-height-inner;
    -        background-image: escape-svg($icon);
    -        background-repeat: no-repeat;
    -        background-position: right $input-height-inner-quarter center;
    -        background-size: $input-height-inner-half $input-height-inner-half;
    -      }
    -
    -      &:focus {
    -        border-color: $border-color;
    -        @if $enable-shadows {
    -          @include box-shadow($input-box-shadow, $focus-box-shadow);
    -        } @else {
    -          // Avoid using mixin so we can pass custom focus shadow properly
    -          box-shadow: $focus-box-shadow;
    -        }
    -      }
    -    }
    -  }
    -
    -  // stylelint-disable-next-line selector-no-qualifying-type
    -  textarea.form-control {
    -    @include form-validation-state-selector($state) {
    -      @if $enable-validation-icons {
    -        padding-right: $input-height-inner;
    -        background-position: top $input-height-inner-quarter right $input-height-inner-quarter;
    -      }
    -    }
    -  }
    -
    -  .form-select {
    -    @include form-validation-state-selector($state) {
    -      border-color: $border-color;
    -
    -      @if $enable-validation-icons {
    -        &:not([multiple]):not([size]),
    -        &:not([multiple])[size="1"] {
    -          --#{$prefix}form-select-bg-icon: #{escape-svg($icon)};
    -          padding-right: $form-select-feedback-icon-padding-end;
    -          background-position: $form-select-bg-position, $form-select-feedback-icon-position;
    -          background-size: $form-select-bg-size, $form-select-feedback-icon-size;
    -        }
    -      }
    -
    -      &:focus {
    -        border-color: $border-color;
    -        @if $enable-shadows {
    -          @include box-shadow($form-select-box-shadow, $focus-box-shadow);
    -        } @else {
    -          // Avoid using mixin so we can pass custom focus shadow properly
    -          box-shadow: $focus-box-shadow;
    -        }
    -      }
    -    }
    -  }
    -
    -  .form-control-color {
    -    @include form-validation-state-selector($state) {
    -      @if $enable-validation-icons {
    -        width: add($form-color-width, $input-height-inner);
    -      }
    -    }
    -  }
    -
    -  .form-check-input {
    -    @include form-validation-state-selector($state) {
    -      border-color: $border-color;
    -
    -      &:checked {
    -        background-color: $color;
    -      }
    -
    -      &:focus {
    -        box-shadow: $focus-box-shadow;
    -      }
    -
    -      ~ .form-check-label {
    -        color: $color;
    -      }
    -    }
    -  }
    -  .form-check-inline .form-check-input {
    -    ~ .#{$state}-feedback {
    -      margin-left: .5em;
    -    }
    -  }
    -
    -  .input-group {
    -    > .form-control:not(:focus),
    -    > .form-select:not(:focus),
    -    > .form-floating:not(:focus-within) {
    -      @include form-validation-state-selector($state) {
    -        @if $state == "valid" {
    -          z-index: 3;
    -        } @else if $state == "invalid" {
    -          z-index: 4;
    -        }
    -      }
    -    }
    -  }
    -}
    -
    -

    Sass maps

    +
    @mixin form-validation-state-selector($state) {
    +  @if ($state == "valid" or $state == "invalid") {
    +    .was-validated #{if(&, "&", "")}:#{$state},
    +    #{if(&, "&", "")}.is-#{$state} {
    +      @content;
    +    }
    +  } @else {
    +    #{if(&, "&", "")}.is-#{$state} {
    +      @content;
    +    }
    +  }
    +}
    +
    +@mixin form-validation-state(
    +  $state,
    +  $color,
    +  $icon,
    +  $tooltip-color: color-contrast($color),
    +  $tooltip-bg-color: rgba($color, $form-feedback-tooltip-opacity),
    +  $focus-box-shadow: 0 0 $input-btn-focus-blur $input-focus-width rgba($color, $input-btn-focus-color-opacity),
    +  $border-color: $color
    +) {
    +  .#{$state}-feedback {
    +    display: none;
    +    width: 100%;
    +    margin-top: $form-feedback-margin-top;
    +    @include font-size($form-feedback-font-size);
    +    font-style: $form-feedback-font-style;
    +    color: $color;
    +  }
    +
    +  .#{$state}-tooltip {
    +    position: absolute;
    +    top: 100%;
    +    z-index: 5;
    +    display: none;
    +    max-width: 100%; // Contain to parent when possible
    +    padding: $form-feedback-tooltip-padding-y $form-feedback-tooltip-padding-x;
    +    margin-top: .1rem;
    +    @include font-size($form-feedback-tooltip-font-size);
    +    line-height: $form-feedback-tooltip-line-height;
    +    color: $tooltip-color;
    +    background-color: $tooltip-bg-color;
    +    @include border-radius($form-feedback-tooltip-border-radius);
    +  }
    +
    +  @include form-validation-state-selector($state) {
    +    ~ .#{$state}-feedback,
    +    ~ .#{$state}-tooltip {
    +      display: block;
    +    }
    +  }
    +
    +  .form-control {
    +    @include form-validation-state-selector($state) {
    +      border-color: $border-color;
    +
    +      @if $enable-validation-icons {
    +        padding-right: $input-height-inner;
    +        background-image: escape-svg($icon);
    +        background-repeat: no-repeat;
    +        background-position: right $input-height-inner-quarter center;
    +        background-size: $input-height-inner-half $input-height-inner-half;
    +      }
    +
    +      &:focus {
    +        border-color: $border-color;
    +        @if $enable-shadows {
    +          @include box-shadow($input-box-shadow, $focus-box-shadow);
    +        } @else {
    +          // Avoid using mixin so we can pass custom focus shadow properly
    +          box-shadow: $focus-box-shadow;
    +        }
    +      }
    +    }
    +  }
    +
    +  // stylelint-disable-next-line selector-no-qualifying-type
    +  textarea.form-control {
    +    @include form-validation-state-selector($state) {
    +      @if $enable-validation-icons {
    +        padding-right: $input-height-inner;
    +        background-position: top $input-height-inner-quarter right $input-height-inner-quarter;
    +      }
    +    }
    +  }
    +
    +  .form-select {
    +    @include form-validation-state-selector($state) {
    +      border-color: $border-color;
    +
    +      @if $enable-validation-icons {
    +        &:not([multiple]):not([size]),
    +        &:not([multiple])[size="1"] {
    +          --#{$prefix}form-select-bg-icon: #{escape-svg($icon)};
    +          padding-right: $form-select-feedback-icon-padding-end;
    +          background-position: $form-select-bg-position, $form-select-feedback-icon-position;
    +          background-size: $form-select-bg-size, $form-select-feedback-icon-size;
    +        }
    +      }
    +
    +      &:focus {
    +        border-color: $border-color;
    +        @if $enable-shadows {
    +          @include box-shadow($form-select-box-shadow, $focus-box-shadow);
    +        } @else {
    +          // Avoid using mixin so we can pass custom focus shadow properly
    +          box-shadow: $focus-box-shadow;
    +        }
    +      }
    +    }
    +  }
    +
    +  .form-control-color {
    +    @include form-validation-state-selector($state) {
    +      @if $enable-validation-icons {
    +        width: add($form-color-width, $input-height-inner);
    +      }
    +    }
    +  }
    +
    +  .form-check-input {
    +    @include form-validation-state-selector($state) {
    +      border-color: $border-color;
    +
    +      &:checked {
    +        background-color: $color;
    +      }
    +
    +      &:focus {
    +        box-shadow: $focus-box-shadow;
    +      }
    +
    +      ~ .form-check-label {
    +        color: $color;
    +      }
    +    }
    +  }
    +  .form-check-inline .form-check-input {
    +    ~ .#{$state}-feedback {
    +      margin-left: .5em;
    +    }
    +  }
    +
    +  .input-group {
    +    > .form-control:not(:focus),
    +    > .form-select:not(:focus),
    +    > .form-floating:not(:focus-within) {
    +      @include form-validation-state-selector($state) {
    +        @if $state == "valid" {
    +          z-index: 3;
    +        } @else if $state == "invalid" {
    +          z-index: 4;
    +        }
    +      }
    +    }
    +  }
    +}
    +
    +

    Sass maps

    This is the validation Sass map from _variables.scss. Override or extend this to generate different or additional states.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $form-validation-states: (
    -  "valid": (
    -    "color": var(--#{$prefix}form-valid-color),
    -    "icon": $form-feedback-icon-valid,
    -    "tooltip-color": #fff,
    -    "tooltip-bg-color": var(--#{$prefix}success),
    -    "focus-box-shadow": 0 0 $input-btn-focus-blur $input-focus-width rgba(var(--#{$prefix}success-rgb), $input-btn-focus-color-opacity),
    -    "border-color": var(--#{$prefix}form-valid-border-color),
    -  ),
    -  "invalid": (
    -    "color": var(--#{$prefix}form-invalid-color),
    -    "icon": $form-feedback-icon-invalid,
    -    "tooltip-color": #fff,
    -    "tooltip-bg-color": var(--#{$prefix}danger),
    -    "focus-box-shadow": 0 0 $input-btn-focus-blur $input-focus-width rgba(var(--#{$prefix}danger-rgb), $input-btn-focus-color-opacity),
    -    "border-color": var(--#{$prefix}form-invalid-border-color),
    -  )
    -);
    -
    +
    $form-validation-states: (
    +  "valid": (
    +    "color": var(--#{$prefix}form-valid-color),
    +    "icon": $form-feedback-icon-valid,
    +    "tooltip-color": #fff,
    +    "tooltip-bg-color": var(--#{$prefix}success),
    +    "focus-box-shadow": 0 0 $input-btn-focus-blur $input-focus-width rgba(var(--#{$prefix}success-rgb), $input-btn-focus-color-opacity),
    +    "border-color": var(--#{$prefix}form-valid-border-color),
    +  ),
    +  "invalid": (
    +    "color": var(--#{$prefix}form-invalid-color),
    +    "icon": $form-feedback-icon-invalid,
    +    "tooltip-color": #fff,
    +    "tooltip-bg-color": var(--#{$prefix}danger),
    +    "focus-box-shadow": 0 0 $input-btn-focus-blur $input-focus-width rgba(var(--#{$prefix}danger-rgb), $input-btn-focus-color-opacity),
    +    "border-color": var(--#{$prefix}form-invalid-border-color),
    +  )
    +);
    +

    Maps of $form-validation-states can contain three optional parameters to override tooltips and focus styles.

    -

    Sass loops

    +

    Sass loops

    Used to iterate over $form-validation-states map values to generate our validation styles. Any modifications to the above Sass map will be reflected in your compiled CSS via this loop.

    -
    -
    @each $state, $data in $form-validation-states {
    -  @include form-validation-state($state, $data...);
    -}
    -
    -

    Customizing

    -

    Validation states can be customized via Sass with the $form-validation-states map. Located in our _variables.scss file, this Sass map is how we generate the default valid/invalid validation states. Included is a nested map for customizing each state’s color, icon, tooltip color, and focus shadow. While no other states are supported by browsers, those using custom styles can easily add more complex form feedback.

    - -
    -
    -
    - - - - - - - - - - - - - - - +
    @each $state, $data in $form-validation-states {
    +  @include form-validation-state($state, $data...);
    +}
    +
    +

    Customizing

    +

    Validation states can be customized via Sass with the $form-validation-states map. Located in our _variables.scss file, this Sass map is how we generate the default valid/invalid validation states. Included is a nested map for customizing each state’s color, icon, tooltip color, and focus shadow. While no other states are supported by browsers, those using custom styles can easily add more complex form feedback.

    \ No newline at end of file diff --git a/docs/5.3/getting-started/accessibility/index.html b/docs/5.3/getting-started/accessibility/index.html index a3580803c2..e44126584f 100644 --- a/docs/5.3/getting-started/accessibility/index.html +++ b/docs/5.3/getting-started/accessibility/index.html @@ -1,675 +1,62 @@ - - - - - - - - - - - - - - - - -Accessibility · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Accessibility

    -
    -

    A brief overview of Bootstrap’s features and limitations for the creation of accessible content.

    - - -
    - - - - - -
    - - -

    Bootstrap provides an easy-to-use framework of ready-made styles, layout tools, and interactive components, allowing developers to create websites and applications that are visually appealing, functionally rich, and accessible out of the box.

    -

    Overview and limitations

    -

    The overall accessibility of any project built with Bootstrap depends in large part on the author’s markup, additional styling, and scripting they’ve included. However, provided that these have been implemented correctly, it should be perfectly possible to create websites and applications with Bootstrap that fulfill WCAG 2.2 (A/AA/AAA), Section 508, and similar accessibility standards and requirements.

    -

    Structural markup

    -

    Bootstrap’s styling and layout can be applied to a wide range of markup structures. This documentation aims to provide developers with best practice examples to demonstrate the use of Bootstrap itself and illustrate appropriate semantic markup, including ways in which potential accessibility concerns can be addressed.

    -

    Interactive components

    -

    Bootstrap’s interactive components—such as modal dialogs, dropdown menus, and custom tooltips—are designed to work for touch, mouse, and keyboard users. Through the use of relevant WAI-ARIA roles and attributes, these components should also be understandable and operable using assistive technologies (such as screen readers).

    -

    Because Bootstrap’s components are purposely designed to be fairly generic, authors may need to include further ARIA roles and attributes, as well as JavaScript behavior, to more accurately convey the precise nature and functionality of their component. This is usually noted in the documentation.

    -

    Color contrast

    -

    Some combinations of colors that currently make up Bootstrap’s default palette—used throughout the framework for things such as button variations, alert variations, form validation indicators—may lead to insufficient color contrast (below the recommended WCAG 2.2 text color contrast ratio of 4.5:1 and the WCAG 2.2 non-text color contrast ratio of 3:1), particularly when used against a light background. Authors are encouraged to test their specific uses of color and, where necessary, manually modify/extend these default colors to ensure adequate color contrast ratios.

    -

    Visually hidden content

    + Accessibility · Bootstrap v5.3

    Accessibility

    A brief overview of Bootstrap’s features and limitations for the creation of accessible content.

    +

    Bootstrap provides an easy-to-use framework of ready-made styles, layout tools, and interactive components, allowing developers to create websites and applications that are visually appealing, functionally rich, and accessible out of the box.

    +

    Overview and limitations

    +

    The overall accessibility of any project built with Bootstrap depends in large part on the author’s markup, additional styling, and scripting they’ve included. However, provided that these have been implemented correctly, it should be perfectly possible to create websites and applications with Bootstrap that fulfill WCAG 2.2 (A/AA/AAA), Section 508, and similar accessibility standards and requirements.

    +

    Structural markup

    +

    Bootstrap’s styling and layout can be applied to a wide range of markup structures. This documentation aims to provide developers with best practice examples to demonstrate the use of Bootstrap itself and illustrate appropriate semantic markup, including ways in which potential accessibility concerns can be addressed.

    +

    Interactive components

    +

    Bootstrap’s interactive components—such as modal dialogs, dropdown menus, and custom tooltips—are designed to work for touch, mouse, and keyboard users. Through the use of relevant WAI-ARIA roles and attributes, these components should also be understandable and operable using assistive technologies (such as screen readers).

    +

    Because Bootstrap’s components are purposely designed to be fairly generic, authors may need to include further ARIA roles and attributes, as well as JavaScript behavior, to more accurately convey the precise nature and functionality of their component. This is usually noted in the documentation.

    +

    Color contrast

    +

    Some combinations of colors that currently make up Bootstrap’s default palette—used throughout the framework for things such as button variations, alert variations, form validation indicators—may lead to insufficient color contrast (below the recommended WCAG 2.2 text color contrast ratio of 4.5:1 and the WCAG 2.2 non-text color contrast ratio of 3:1), particularly when used against a light background. Authors are encouraged to test their specific uses of color and, where necessary, manually modify/extend these default colors to ensure adequate color contrast ratios.

    +

    Visually hidden content

    Content which should be visually hidden, but remain accessible to assistive technologies such as screen readers, can be styled using the .visually-hidden class. This can be useful in situations where additional visual information or cues (such as meaning denoted through the use of color) need to also be conveyed to non-visual users.

    -
    <p class="text-danger">
    -  <span class="visually-hidden">Danger: </span>
    -  This action is not reversible
    -</p>
    -

    For visually hidden interactive controls, such as traditional “skip” links, use the .visually-hidden-focusable class. This will ensure that the control becomes visible once focused (for sighted keyboard users). Watch out, compared to the equivalent .sr-only and .sr-only-focusable classes in past versions, Bootstrap 5’s .visually-hidden-focusable is a standalone class, and must not be used in combination with the .visually-hidden class.

    -
    <a class="visually-hidden-focusable" href="#content">Skip to main content</a>
    -

    Reduced motion

    +
    <p class="text-danger">
    +  <span class="visually-hidden">Danger: </span>
    +  This action is not reversible
    +</p>
    +
    +

    For visually hidden interactive controls, such as traditional “skip” links, use the .visually-hidden-focusable class. This will ensure that the control becomes visible once focused (for sighted keyboard users). Watch out, compared to the equivalent .sr-only and .sr-only-focusable classes in past versions, Bootstrap 5’s .visually-hidden-focusable is a standalone class, and must not be used in combination with the .visually-hidden class.

    +
    <a class="visually-hidden-focusable" href="#content">Skip to main content</a>
    +
    +

    Reduced motion

    Bootstrap includes support for the prefers-reduced-motion media feature. In browsers/environments that allow the user to specify their preference for reduced motion, most CSS transition effects in Bootstrap (for instance, when a modal dialog is opened or closed, or the sliding animation in carousels) will be disabled, and meaningful animations (such as spinners) will be slowed down.

    -

    On browsers that support prefers-reduced-motion, and where the user has not explicitly signaled that they’d prefer reduced motion (i.e. where prefers-reduced-motion: no-preference), Bootstrap enables smooth scrolling using the scroll-behavior property.

    -

    Additional resources

    +

    On browsers that support prefers-reduced-motion, and where the user has not explicitly signaled that they’d prefer reduced motion (i.e. where prefers-reduced-motion: no-preference), Bootstrap enables smooth scrolling using the scroll-behavior property.

    +

    Additional resources

    - -
    -
    -
    - - - - - - - - - - - - - - - +
    \ No newline at end of file diff --git a/docs/5.3/getting-started/best-practices/index.html b/docs/5.3/getting-started/best-practices/index.html index 375d153c1c..59ddf27215 100644 --- a/docs/5.3/getting-started/best-practices/index.html +++ b/docs/5.3/getting-started/best-practices/index.html @@ -1,630 +1,35 @@ - - - - - - - - - - - - - - - - -Best practices · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Best practices

    -
    -

    Learn about some of the best practices we’ve gathered from years of working on and using Bootstrap.

    - - -
    - - - -
    - - -

    We’ve designed and developed Bootstrap to work in a number of environments. Here are some of the best practices we’ve gathered from years of working on and using it ourselves.

    -
    -Heads up! This copy is a work in progress. -
    - -

    General outline

    + Best practices · Bootstrap v5.3

    Best practices

    Learn about some of the best practices we’ve gathered from years of working on and using Bootstrap.

    +

    We’ve designed and developed Bootstrap to work in a number of environments. Here are some of the best practices we’ve gathered from years of working on and using it ourselves.

    +

    Heads up! This copy is a work in progress.

    +

    General outline

    • Working with CSS
    • Working with Sass files
    • Building new CSS components
    • Working with flexbox
    • Ask in our GitHub Discussions
    • -
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    \ No newline at end of file diff --git a/docs/5.3/getting-started/browsers-devices/index.html b/docs/5.3/getting-started/browsers-devices/index.html index 2e9c23fc45..0e34a4e4aa 100644 --- a/docs/5.3/getting-started/browsers-devices/index.html +++ b/docs/5.3/getting-started/browsers-devices/index.html @@ -1,745 +1,123 @@ - - - - - - - - - - - - - - - - -Browsers and devices · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Browsers and devices

    -
    -

    Learn about the browsers and devices, from modern to old, that are supported by Bootstrap, including known quirks and bugs for each.

    - - -
    - - - - - -
    - - -

    Supported browsers

    + Browsers and devices · Bootstrap v5.3

    Browsers and devices

    Learn about the browsers and devices, from modern to old, that are supported by Bootstrap, including known quirks and bugs for each.

    +

    Supported browsers

    Bootstrap supports the latest, stable releases of all major browsers and platforms.

    -

    Alternative browsers which use the latest version of WebKit, Blink, or Gecko, whether directly or via the platform’s web view API, are not explicitly supported. However, Bootstrap should (in most cases) display and function correctly in these browsers as well. More specific support information is provided below.

    +

    Alternative browsers which use the latest version of WebKit, Blink, or Gecko, whether directly or via the platform’s web view API, are not explicitly supported. However, Bootstrap should (in most cases) display and function correctly in these browsers as well. More specific support information is provided below.

    You can find our supported range of browsers and their versions in our .browserslistrc file:

    -
    # https://github.com/browserslist/browserslist#readme
    + 
    # https://github.com/browserslist/browserslist#readme
     
    ->= 0.5%
    +>= 0.5%
     last 2 major versions
     not dead
    -Chrome >= 60
    -Firefox >= 60
    +Chrome >= 60
    +Firefox >= 60
     Firefox ESR
    -iOS >= 12
    -Safari >= 12
    +iOS >= 12
    +Safari >= 12
     not Explorer <= 11
     not kaios <= 2.5 # fix floating label issues in Firefox (see https://github.com/postcss/autoprefixer/issues/1533)
    -

    We use Autoprefixer to handle intended browser support via CSS prefixes, which uses Browserslist to manage these browser versions. Consult their documentation for how to integrate these tools into your projects.

    -

    Mobile devices

    -

    Generally speaking, Bootstrap supports the latest versions of each major platform’s default browsers. Note that proxy browsers (such as Opera Mini, Opera Mobile’s Turbo mode, UC Browser Mini, Amazon Silk) are not supported.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    ChromeFirefoxSafariAndroid Browser & WebView
    AndroidSupportedSupportedv6.0+
    iOSSupportedSupportedSupported
    +
    +

    We use Autoprefixer to handle intended browser support via CSS prefixes, which uses Browserslist to manage these browser versions. Consult their documentation for how to integrate these tools into your projects.

    +

    Mobile devices

    +

    Generally speaking, Bootstrap supports the latest versions of each major platform’s default browsers. Note that proxy browsers (such as Opera Mini, Opera Mobile’s Turbo mode, UC Browser Mini, Amazon Silk) are not supported.

    +
    -

    Desktop browsers

    + + + + + + + + + + + + + + + + + + + + + + + + +
    ChromeFirefoxSafariAndroid Browser & WebView
    AndroidSupportedSupportedv6.0+
    iOSSupportedSupportedSupported
    +

    Desktop browsers

    Similarly, the latest versions of most desktop browsers are supported.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ChromeFirefoxMicrosoft EdgeOperaSafari
    MacSupportedSupportedSupportedSupportedSupported
    WindowsSupportedSupportedSupportedSupported
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ChromeFirefoxMicrosoft EdgeOperaSafari
    MacSupportedSupportedSupportedSupportedSupported
    WindowsSupportedSupportedSupportedSupported

    For Firefox, in addition to the latest normal stable release, we also support the latest Extended Support Release (ESR) version of Firefox.

    Unofficially, Bootstrap should look and behave well enough in Chromium and Chrome for Linux, and Firefox for Linux, though they are not officially supported.

    -

    Internet Explorer

    +

    Internet Explorer

    Internet Explorer is not supported. If you require Internet Explorer support, please use Bootstrap v4.

    -

    Modals and dropdowns on mobile

    -

    Overflow and scrolling

    -

    Support for overflow: hidden; on the <body> element is quite limited in iOS and Android. To that end, when you scroll past the top or bottom of a modal in either of those devices’ browsers, the <body> content will begin to scroll. See Chrome bug #175502 (fixed in Chrome v40) and WebKit bug #153852.

    -

    iOS text fields and scrolling

    +

    Modals and dropdowns on mobile

    +

    Overflow and scrolling

    +

    Support for overflow: hidden; on the <body> element is quite limited in iOS and Android. To that end, when you scroll past the top or bottom of a modal in either of those devices’ browsers, the <body> content will begin to scroll. See Chrome bug #175502 (fixed in Chrome v40) and WebKit bug #153852.

    +

    iOS text fields and scrolling

    As of iOS 9.2, while a modal is open, if the initial touch of a scroll gesture is within the boundary of a textual <input> or a <textarea>, the <body> content underneath the modal will be scrolled instead of the modal itself. See WebKit bug #153856.

    - -

    The .dropdown-backdrop element isn’t used on iOS in the nav because of the complexity of z-indexing. Thus, to close dropdowns in navbars, you must directly click the dropdown element (or any other element which will fire a click event in iOS).

    -

    Browser zooming

    + +

    The .dropdown-backdrop element isn’t used on iOS in the nav because of the complexity of z-indexing. Thus, to close dropdowns in navbars, you must directly click the dropdown element (or any other element which will fire a click event in iOS).

    +

    Browser zooming

    Page zooming inevitably presents rendering artifacts in some components, both in Bootstrap and the rest of the web. Depending on the issue, we may be able to fix it (search first and then open an issue if need be). However, we tend to ignore these as they often have no direct solution other than hacky workarounds.

    -

    Validators

    -

    In order to provide the best possible experience to old and buggy browsers, Bootstrap uses CSS browser hacks in several places to target special CSS to certain browser versions in order to work around bugs in the browsers themselves. These hacks understandably cause CSS validators to complain that they are invalid. In a couple places, we also use bleeding-edge CSS features that aren’t yet fully standardized, but these are used purely for progressive enhancement.

    -

    These validation warnings don’t matter in practice since the non-hacky portion of our CSS does fully validate and the hacky portions don’t interfere with the proper functioning of the non-hacky portion, hence why we deliberately ignore these particular warnings.

    -

    Our HTML docs likewise have some trivial and inconsequential HTML validation warnings due to our inclusion of a workaround for a certain Firefox bug.

    - -
    -
    -
    - - - - - - - - - - - - - - - +

    Validators

    +

    In order to provide the best possible experience to old and buggy browsers, Bootstrap uses CSS browser hacks in several places to target special CSS to certain browser versions in order to work around bugs in the browsers themselves. These hacks understandably cause CSS validators to complain that they are invalid. In a couple places, we also use bleeding-edge CSS features that aren’t yet fully standardized, but these are used purely for progressive enhancement.

    +

    These validation warnings don’t matter in practice since the non-hacky portion of our CSS does fully validate and the hacky portions don’t interfere with the proper functioning of the non-hacky portion, hence why we deliberately ignore these particular warnings.

    +

    Our HTML docs likewise have some trivial and inconsequential HTML validation warnings due to our inclusion of a workaround for a certain Firefox bug.

    \ No newline at end of file diff --git a/docs/5.3/getting-started/build-tools/index.html b/docs/5.3/getting-started/build-tools/index.html index 6a806fa1ba..93d65fe91c 100644 --- a/docs/5.3/getting-started/build-tools/index.html +++ b/docs/5.3/getting-started/build-tools/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/getting-started/contribute/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/getting-started/contents/index.html b/docs/5.3/getting-started/contents/index.html index 3cd6fadab6..f65853fd86 100644 --- a/docs/5.3/getting-started/contents/index.html +++ b/docs/5.3/getting-started/contents/index.html @@ -1,770 +1,158 @@ - - - - - - - - + Contents · Bootstrap v5.3

    Discover what’s included in Bootstrap, including our compiled and source code flavors.

    +

    Compiled Bootstrap

    +

    Once downloaded, unzip the compressed folder and you’ll see something like this:

    - - - - - - - -Contents · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Contents

    -
    -

    Discover what’s included in Bootstrap, including our compiled and source code flavors.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Compiled Bootstrap

    -

    Once downloaded, unzip the compressed folder and you’ll see something like this:

    - -
    bootstrap/
    -├── css/
    -│   ├── bootstrap-grid.css
    -│   ├── bootstrap-grid.css.map
    -│   ├── bootstrap-grid.min.css
    -│   ├── bootstrap-grid.min.css.map
    -│   ├── bootstrap-grid.rtl.css
    -│   ├── bootstrap-grid.rtl.css.map
    -│   ├── bootstrap-grid.rtl.min.css
    -│   ├── bootstrap-grid.rtl.min.css.map
    -│   ├── bootstrap-reboot.css
    -│   ├── bootstrap-reboot.css.map
    -│   ├── bootstrap-reboot.min.css
    -│   ├── bootstrap-reboot.min.css.map
    -│   ├── bootstrap-reboot.rtl.css
    -│   ├── bootstrap-reboot.rtl.css.map
    -│   ├── bootstrap-reboot.rtl.min.css
    -│   ├── bootstrap-reboot.rtl.min.css.map
    -│   ├── bootstrap-utilities.css
    -│   ├── bootstrap-utilities.css.map
    -│   ├── bootstrap-utilities.min.css
    -│   ├── bootstrap-utilities.min.css.map
    -│   ├── bootstrap-utilities.rtl.css
    -│   ├── bootstrap-utilities.rtl.css.map
    -│   ├── bootstrap-utilities.rtl.min.css
    -│   ├── bootstrap-utilities.rtl.min.css.map
    -│   ├── bootstrap.css
    -│   ├── bootstrap.css.map
    -│   ├── bootstrap.min.css
    -│   ├── bootstrap.min.css.map
    -│   ├── bootstrap.rtl.css
    -│   ├── bootstrap.rtl.css.map
    -│   ├── bootstrap.rtl.min.css
    -│   └── bootstrap.rtl.min.css.map
    -└── js/
    -    ├── bootstrap.bundle.js
    -    ├── bootstrap.bundle.js.map
    -    ├── bootstrap.bundle.min.js
    -    ├── bootstrap.bundle.min.js.map
    -    ├── bootstrap.esm.js
    -    ├── bootstrap.esm.js.map
    -    ├── bootstrap.esm.min.js
    -    ├── bootstrap.esm.min.js.map
    -    ├── bootstrap.js
    -    ├── bootstrap.js.map
    -    ├── bootstrap.min.js
    -    └── bootstrap.min.js.map
    -

    This is the most basic form of Bootstrap: compiled files for quick drop-in usage in nearly any web project. We provide compiled CSS and JS (bootstrap.*), as well as compiled and minified CSS and JS (bootstrap.min.*). Source maps (bootstrap.*.map) are available for use with certain browsers’ developer tools. Bundled JS files (bootstrap.bundle.js and minified bootstrap.bundle.min.js) include Popper.

    -

    CSS files

    +
    bootstrap/
    +├── css/
    +│   ├── bootstrap-grid.css
    +│   ├── bootstrap-grid.css.map
    +│   ├── bootstrap-grid.min.css
    +│   ├── bootstrap-grid.min.css.map
    +│   ├── bootstrap-grid.rtl.css
    +│   ├── bootstrap-grid.rtl.css.map
    +│   ├── bootstrap-grid.rtl.min.css
    +│   ├── bootstrap-grid.rtl.min.css.map
    +│   ├── bootstrap-reboot.css
    +│   ├── bootstrap-reboot.css.map
    +│   ├── bootstrap-reboot.min.css
    +│   ├── bootstrap-reboot.min.css.map
    +│   ├── bootstrap-reboot.rtl.css
    +│   ├── bootstrap-reboot.rtl.css.map
    +│   ├── bootstrap-reboot.rtl.min.css
    +│   ├── bootstrap-reboot.rtl.min.css.map
    +│   ├── bootstrap-utilities.css
    +│   ├── bootstrap-utilities.css.map
    +│   ├── bootstrap-utilities.min.css
    +│   ├── bootstrap-utilities.min.css.map
    +│   ├── bootstrap-utilities.rtl.css
    +│   ├── bootstrap-utilities.rtl.css.map
    +│   ├── bootstrap-utilities.rtl.min.css
    +│   ├── bootstrap-utilities.rtl.min.css.map
    +│   ├── bootstrap.css
    +│   ├── bootstrap.css.map
    +│   ├── bootstrap.min.css
    +│   ├── bootstrap.min.css.map
    +│   ├── bootstrap.rtl.css
    +│   ├── bootstrap.rtl.css.map
    +│   ├── bootstrap.rtl.min.css
    +│   └── bootstrap.rtl.min.css.map
    +└── js/
    +    ├── bootstrap.bundle.js
    +    ├── bootstrap.bundle.js.map
    +    ├── bootstrap.bundle.min.js
    +    ├── bootstrap.bundle.min.js.map
    +    ├── bootstrap.esm.js
    +    ├── bootstrap.esm.js.map
    +    ├── bootstrap.esm.min.js
    +    ├── bootstrap.esm.min.js.map
    +    ├── bootstrap.js
    +    ├── bootstrap.js.map
    +    ├── bootstrap.min.js
    +    └── bootstrap.min.js.map
    +
    +

    This is the most basic form of Bootstrap: compiled files for quick drop-in usage in nearly any web project. We provide compiled CSS and JS (bootstrap.*), as well as compiled and minified CSS and JS (bootstrap.min.*). Source maps (bootstrap.*.map) are available for use with certain browsers’ developer tools. Bundled JS files (bootstrap.bundle.js and minified bootstrap.bundle.min.js) include Popper.

    +

    CSS files

    Bootstrap includes a handful of options for including some or all of our compiled CSS.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    CSS filesLayoutContentComponentsUtilities
    bootstrap.css
    bootstrap.min.css
    bootstrap.rtl.css
    bootstrap.rtl.min.css
    IncludedIncludedIncludedIncluded
    bootstrap-grid.css
    bootstrap-grid.rtl.css
    bootstrap-grid.min.css
    bootstrap-grid.rtl.min.css
    Only grid systemOnly flex utilities
    bootstrap-utilities.css
    bootstrap-utilities.rtl.css
    bootstrap-utilities.min.css
    bootstrap-utilities.rtl.min.css
    Included
    bootstrap-reboot.css
    bootstrap-reboot.rtl.css
    bootstrap-reboot.min.css
    bootstrap-reboot.rtl.min.css
    Only Reboot
    +
    -

    JS files

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    CSS filesLayoutContentComponentsUtilities
    bootstrap.css
    bootstrap.min.css
    bootstrap.rtl.css
    bootstrap.rtl.min.css
    IncludedIncludedIncludedIncluded
    bootstrap-grid.css
    bootstrap-grid.rtl.css
    bootstrap-grid.min.css
    bootstrap-grid.rtl.min.css
    Only grid systemOnly flex utilities
    bootstrap-utilities.css
    bootstrap-utilities.rtl.css
    bootstrap-utilities.min.css
    bootstrap-utilities.rtl.min.css
    Included
    bootstrap-reboot.css
    bootstrap-reboot.rtl.css
    bootstrap-reboot.min.css
    bootstrap-reboot.rtl.min.css
    Only Reboot
    +

    JS files

    Similarly, we have options for including some or all of our compiled JavaScript.

    -
    - - - - - - - - - - - - - - - - -
    JS FilesPopper
    bootstrap.bundle.js
    bootstrap.bundle.min.js
    Included
    bootstrap.js
    bootstrap.min.js
    +
    -

    Bootstrap source code

    + + + + + + + + + + + + + + + +
    JS FilesPopper
    bootstrap.bundle.js
    bootstrap.bundle.min.js
    Included
    bootstrap.js
    bootstrap.min.js
    +

    Bootstrap source code

    The Bootstrap source code download includes the compiled CSS and JavaScript assets, along with source Sass, JavaScript, and documentation. More specifically, it includes the following and more:

    -
    bootstrap/
    -├── dist/
    -│   ├── css/
    -│   └── js/
    -├── site/
    -│   └──content/
    -│      └── docs/
    -│          └── 5.3/
    -│              └── examples/
    -├── js/
    -└── scss/
    -

    The scss/ and js/ are the source code for our CSS and JavaScript. The dist/ folder includes everything listed in the compiled download section above. The site/content/docs/ folder includes the source code for our hosted documentation, including our live examples of Bootstrap usage.

    -

    Beyond that, any other included file provides support for packages, license information, and development.

    - -
    -
    -
    - - - - - - - - - - - - - - - +
    bootstrap/
    +├── dist/
    +│   ├── css/
    +│   └── js/
    +├── site/
    +│   └──content/
    +│      └── docs/
    +│          └── 5.3/
    +│              └── examples/
    +├── js/
    +└── scss/
    +
    +

    The scss/ and js/ are the source code for our CSS and JavaScript. The dist/ folder includes everything listed in the compiled download section above. The site/content/docs/ folder includes the source code for our hosted documentation, including our live examples of Bootstrap usage.

    +

    Beyond that, any other included file provides support for packages, license information, and development.

    \ No newline at end of file diff --git a/docs/5.3/getting-started/contribute/index.html b/docs/5.3/getting-started/contribute/index.html index 8eb57bb3d8..f01ed1b3ae 100644 --- a/docs/5.3/getting-started/contribute/index.html +++ b/docs/5.3/getting-started/contribute/index.html @@ -1,699 +1,81 @@ - - - - - - - - - - - - - - - - -Contribute · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Contribute

    -
    -

    Help develop Bootstrap with our documentation build scripts and tests.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Tooling setup

    -

    Bootstrap uses npm scripts to build the documentation and compile source files. Our package.json houses these scripts for compiling code, running tests, and more. These aren’t intended for use outside our repository and documentation.

    -

    To use our build system and run our documentation locally, you’ll need a copy of Bootstrap’s source files and Node. Follow these steps and you should be ready to rock:

    + Contribute · Bootstrap v5.3

    Contribute

    Help develop Bootstrap with our documentation build scripts and tests.

    +

    Tooling setup

    +

    Bootstrap uses npm scripts to build the documentation and compile source files. Our package.json houses these scripts for compiling code, running tests, and more. These aren’t intended for use outside our repository and documentation.

    +

    To use our build system and run our documentation locally, you’ll need a copy of Bootstrap’s source files and Node. Follow these steps and you should be ready to rock:

    1. Download and install Node.js, which we use to manage our dependencies.
    2. -
    3. Either download Bootstrap’s sources or fork and clone Bootstrap’s repository.
    4. +
    5. Either download Bootstrap’s sources or fork and clone Bootstrap’s repository.
    6. Navigate to the root /bootstrap directory and run npm install to install our local dependencies listed in package.json.
    -

    When completed, you’ll be able to run the various commands provided from the command line.

    -

    Using npm scripts

    +

    When completed, you’ll be able to run the various commands provided from the command line.

    +

    Using npm scripts

    Our package.json includes numerous tasks for developing the project. Run npm run to see all the npm scripts in your terminal. Primary tasks include:

    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    TaskDescription
    npm startCompiles CSS and JavaScript, builds the documentation, and starts a local server.
    npm run distCreates the dist/ directory with compiled files. Uses Sass, Autoprefixer, and terser.
    npm testRuns tests locally after running npm run dist
    npm run docs-serveBuilds and runs the documentation locally.
    +
    -
    -Get started with Bootstrap via npm with our starter project! Head to the Sass & JS example template repository to see how to build and customize Bootstrap in your own npm project. Includes Sass compiler, Autoprefixer, Stylelint, PurgeCSS, and Bootstrap Icons. -
    -

    Sass

    -

    Bootstrap uses Dart Sass for compiling our Sass source files into CSS files (included in our build process), and we recommend you do the same if you’re compiling Sass using your own asset pipeline. We previously used Node Sass for Bootstrap v4, but LibSass and packages built on top of it, including Node Sass, are now deprecated.

    -

    Dart Sass uses a rounding precision of 10 and for efficiency reasons does not allow adjustment of this value. We don’t lower this precision during further processing of our generated CSS, such as during minification, but if you chose to do so we recommend maintaining a precision of at least 6 to prevent issues with browser rounding.

    -

    Autoprefixer

    + + + + + + + + + + + + + + + + + + + + + + +
    TaskDescription
    npm startCompiles CSS and JavaScript, builds the documentation, and starts a local server.
    npm run distCreates the dist/ directory with compiled files. Uses Sass, Autoprefixer, and terser.
    npm testRuns tests locally after running npm run dist
    npm run docs-serveBuilds and runs the documentation locally.
    +

    Get started with Bootstrap via npm with our starter project! Head to the Sass & JS example template repository to see how to build and customize Bootstrap in your own npm project. Includes Sass compiler, Autoprefixer, Stylelint, PurgeCSS, and Bootstrap Icons.

    +

    Sass

    +

    Bootstrap uses Dart Sass for compiling our Sass source files into CSS files (included in our build process), and we recommend you do the same if you’re compiling Sass using your own asset pipeline. We previously used Node Sass for Bootstrap v4, but LibSass and packages built on top of it, including Node Sass, are now deprecated.

    +

    Dart Sass uses a rounding precision of 10 and for efficiency reasons does not allow adjustment of this value. We don’t lower this precision during further processing of our generated CSS, such as during minification, but if you chose to do so we recommend maintaining a precision of at least 6 to prevent issues with browser rounding.

    +

    Autoprefixer

    Bootstrap uses Autoprefixer (included in our build process) to automatically add vendor prefixes to some CSS properties at build time. Doing so saves us time and code by allowing us to write key parts of our CSS a single time while eliminating the need for vendor mixins like those found in v3.

    We maintain the list of browsers supported through Autoprefixer in a separate file within our GitHub repository. See .browserslistrc for details.

    -

    RTLCSS

    +

    RTLCSS

    Bootstrap uses RTLCSS to process compiled CSS and convert them to RTL – basically replacing horizontal direction aware properties (e.g. padding-left) with their opposite. It allows us only write our CSS a single time and make minor tweaks using RTLCSS control and value directives.

    -

    Local documentation

    -

    Running our documentation locally requires the use of Hugo, which gets installed via the hugo-bin npm package. Hugo is a blazingly fast and quite extensible static site generator that provides us: basic includes, Markdown-based files, templates, and more. Here’s how to get it started:

    +

    Local documentation

    +

    Running our documentation locally requires the use of Astro. Astro is a modern static site generator that allows us to build our documentation with a combination of Markdown and React components. Here’s how to get it started:

    1. Run through the tooling setup above to install all dependencies.
    2. From the root /bootstrap directory, run npm run docs-serve in the command line.
    3. -
    4. Open http://localhost:9001/ in your browser, and voilà.
    5. +
    6. Open http://localhost:4321/ in your browser, and voilà.
    -

    Learn more about using Hugo by reading its documentation.

    -

    Troubleshooting

    -

    Should you encounter problems with installing dependencies, uninstall all previous dependency versions (global and local). Then, rerun npm install.

    - -
    -
    -
    - - - - - - - - - - - - - - - +

    Learn more about using Astro by reading its documentation.

    +

    Troubleshooting

    +

    Should you encounter problems with installing dependencies, uninstall all previous dependency versions (global and local). Then, rerun npm install.

    \ No newline at end of file diff --git a/docs/5.3/getting-started/download/index.html b/docs/5.3/getting-started/download/index.html index 3b44432a04..a40008d951 100644 --- a/docs/5.3/getting-started/download/index.html +++ b/docs/5.3/getting-started/download/index.html @@ -1,727 +1,109 @@ - - - - - - - - - - - - - - - - -Download · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Download

    -
    -

    Download Bootstrap to get the compiled CSS and JavaScript, source code, or include it with your favorite package managers like npm, RubyGems, and more.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Compiled CSS and JS

    + Download · Bootstrap v5.3

    Download Bootstrap to get the compiled CSS and JavaScript, source code, or include it with your favorite package managers like npm, RubyGems, and more.

    +

    Compiled CSS and JS

    Download ready-to-use compiled code for Bootstrap v5.3.5 to easily drop into your project, which includes:

    -

    This doesn’t include documentation, source files, or any optional JavaScript dependencies like Popper.

    -

    Download

    -

    Source files

    +

    This doesn’t include documentation, source files, or any optional JavaScript dependencies like Popper.

    +Download +

    Source files

    Compile Bootstrap with your own asset pipeline by downloading our source Sass, JavaScript, and documentation files. This option requires some additional tooling:

    -

    Should you require our full set of build tools, they are included for developing Bootstrap and its docs, but they’re likely unsuitable for your own purposes.

    -

    Download source

    -

    Examples

    -

    If you want to download and examine our examples, you can grab the already built examples:

    -

    Download Examples

    -

    CDN via jsDelivr

    -

    Skip the download with jsDelivr to deliver cached version of Bootstrap’s compiled CSS and JS to your project.

    -
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-SgOJa3DmI69IUzQ2PVdRZhwQ+dy64/BUtbMJw1MZ8t5HZApcHrRKUc4W0kG879m7" crossorigin="anonymous">
    -<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.bundle.min.js" integrity="sha384-k6d4wzSIapyDyv1kpU366/PK5hCdSbCRGRCMv+eplOQJWyd1fbcAu9OCUj5zNLiq" crossorigin="anonymous"></script>
    -

    If you’re using our compiled JavaScript and prefer to include Popper separately, add Popper before our JS, via a CDN preferably.

    -
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script>
    -<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.min.js" integrity="sha384-VQqxDN0EQCkWoxt/0vsQvZswzTHUVOImccYmSyhJTp7kGtPed0Qcx8rK9h9YEgx+" crossorigin="anonymous"></script>
    -

    Alternative CDNs

    +

    Should you require our full set of build tools, they are included for developing Bootstrap and its docs, but they’re likely unsuitable for your own purposes.

    +Download source +

    Examples

    +

    If you want to download and examine our examples, you can grab the already built examples:

    +Download Examples +

    CDN via jsDelivr

    +

    Skip the download with jsDelivr to deliver cached version of Bootstrap’s compiled CSS and JS to your project.

    +
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-SgOJa3DmI69IUzQ2PVdRZhwQ+dy64/BUtbMJw1MZ8t5HZApcHrRKUc4W0kG879m7" crossorigin="anonymous">
    +<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.bundle.min.js" integrity="sha384-k6d4wzSIapyDyv1kpU366/PK5hCdSbCRGRCMv+eplOQJWyd1fbcAu9OCUj5zNLiq" crossorigin="anonymous"></script>
    +
    +

    If you’re using our compiled JavaScript and prefer to include Popper separately, add Popper before our JS, via a CDN preferably.

    +
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script>
    +<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.min.js" integrity="sha384-VQqxDN0EQCkWoxt/0vsQvZswzTHUVOImccYmSyhJTp7kGtPed0Qcx8rK9h9YEgx+" crossorigin="anonymous"></script>
    +
    +

    Alternative CDNs

    We recommend jsDelivr and use it ourselves in our documentation. However, in some cases—like in some specific countries or environments—you may need to use other CDN providers like cdnjs or unpkg.

    -

    You’ll find the same files on these CDN providers, albeit with different URLs. With cdnjs, you can use this direct Bootstrap package link to copy and paste ready-to-use HTML snippets for each dist file from any version of Bootstrap.

    -
    -If the SRI hashes differ for a given file, you shouldn’t use the files from that CDN, because it means that the file was modified by someone else. -
    - -

    Note that you should compare same length hashes, e.g. sha384 with sha384, otherwise it’s expected for them to be different. +

    You’ll find the same files on these CDN providers, albeit with different URLs. With cdnjs, you can use this direct Bootstrap package link to copy and paste ready-to-use HTML snippets for each dist file from any version of Bootstrap.

    +

    If the SRI hashes differ for a given file, you shouldn’t use the files from that CDN, because it means that the file was modified by someone else.

    +

    Note that you should compare same length hashes, e.g. sha384 with sha384, otherwise it’s expected for them to be different. As such, you can use an online tool like SRI Hash Generator to make sure that the hashes are the same for a given file. Alternatively, assuming you have OpenSSL installed, you can achieve the same from the CLI, for example:

    -
    openssl dgst -sha384 -binary bootstrap.min.js | openssl base64 -A
    -

    Package managers

    -

    Pull in Bootstrap’s source files into nearly any project with some of the most popular package managers. No matter the package manager, Bootstrap will require a Sass compiler and Autoprefixer for a setup that matches our official compiled versions.

    -

    npm

    +
    openssl dgst -sha384 -binary bootstrap.min.js | openssl base64 -A
    +
    +

    Package managers

    +

    Pull in Bootstrap’s source files into nearly any project with some of the most popular package managers. No matter the package manager, Bootstrap will require a Sass compiler and Autoprefixer for a setup that matches our official compiled versions.

    +

    npm

    Install Bootstrap in your Node.js powered apps with the npm package:

    -
    npm install bootstrap@5.3.5
    -

    const bootstrap = require('bootstrap') or import bootstrap from 'bootstrap' will load all of Bootstrap’s plugins onto a bootstrap object. -The bootstrap module itself exports all of our plugins. You can manually load Bootstrap’s plugins individually by loading the /js/dist/*.js files under the package’s top-level directory.

    -

    Bootstrap’s package.json contains some additional metadata under the following keys:

    +
    npm install bootstrap@5.3.5
    +
    +

    const bootstrap = require('bootstrap') or import bootstrap from 'bootstrap' will load all of Bootstrap’s plugins onto a bootstrap object. +The bootstrap module itself exports all of our plugins. You can manually load Bootstrap’s plugins individually by loading the /js/dist/*.js files under the package’s top-level directory.

    +

    Bootstrap’s package.json contains some additional metadata under the following keys:

      -
    • sass - path to Bootstrap’s main Sass source file
    • -
    • style - path to Bootstrap’s non-minified CSS that’s been compiled using the default settings (no customization)
    • +
    • sass - path to Bootstrap’s main Sass source file
    • +
    • style - path to Bootstrap’s non-minified CSS that’s been compiled using the default settings (no customization)
    -
    -Get started with Bootstrap via npm with our starter project! Head to the Sass & JS example template repository to see how to build and customize Bootstrap in your own npm project. Includes Sass compiler, Autoprefixer, Stylelint, PurgeCSS, and Bootstrap Icons. -
    - -

    yarn

    +

    Get started with Bootstrap via npm with our starter project! Head to the Sass & JS example template repository to see how to build and customize Bootstrap in your own npm project. Includes Sass compiler, Autoprefixer, Stylelint, PurgeCSS, and Bootstrap Icons.

    +

    yarn

    Install Bootstrap in your Node.js powered apps with the yarn package:

    -
    yarn add bootstrap@5.3.5
    -
    -

    Yarn 2+ (aka Yarn Berry) doesn’t support the node_modules directory by default: using our Sass & JS example needs some adjustments:

    -
    yarn config set nodeLinker node-modules # Use the node_modules linker
    -touch yarn.lock # Create an empty yarn.lock file
    -yarn install # Install the dependencies
    -yarn start # Start the project
    -
    -
    - -

    RubyGems

    +
    yarn add bootstrap@5.3.5
    +
    +

    Yarn 2+ (aka Yarn Berry) doesn’t support the node_modules directory by default: using our Sass & JS example needs some adjustments:

    yarn config set nodeLinker node-modules # Use the node_modules linker
    +touch yarn.lock # Create an empty yarn.lock file
    +yarn install # Install the dependencies
    +yarn start # Start the project
    +
    +

    Bun

    +

    Install Bootstrap in your Bun or Node.js powered apps with the Bun CLI:

    +
    bun add bootstrap@5.3.5
    +
    +

    RubyGems

    Install Bootstrap in your Ruby apps using Bundler (recommended) and RubyGems by adding the following line to your Gemfile:

    -
    gem 'bootstrap', '~> 5.3.5'
    -

    Alternatively, if you’re not using Bundler, you can install the gem by running this command:

    -
    gem install bootstrap -v 5.3.5
    -

    See the gem’s README for further details.

    -

    Composer

    -

    You can also install and manage Bootstrap’s Sass and JavaScript using Composer:

    -
    composer require twbs/bootstrap:5.3.5
    -

    NuGet

    -

    If you develop in .NET Framework, you can also install and manage Bootstrap’s CSS or Sass and JavaScript using NuGet. Newer projects should use libman or another method as NuGet is designed for compiled code, not frontend assets.

    -
    Install-Package bootstrap
    -
    Install-Package bootstrap.sass
    -
    -
    -
    -
    - - - - - - - - - - - - - - - +
    gem 'bootstrap', '~> 5.3.5'
    +
    +

    Alternatively, if you’re not using Bundler, you can install the gem by running this command:

    +
    gem install bootstrap -v 5.3.5
    +
    +

    See the gem’s README for further details.

    +

    Composer

    +

    You can also install and manage Bootstrap’s Sass and JavaScript using Composer:

    +
    composer require twbs/bootstrap:5.3.5
    +
    +

    NuGet

    +

    If you develop in .NET Framework, you can also install and manage Bootstrap’s CSS or Sass and JavaScript using NuGet. Newer projects should use libman or another method as NuGet is designed for compiled code, not frontend assets.

    +
    Install-Package bootstrap
    +
    +
    Install-Package bootstrap.sass
    +
    \ No newline at end of file diff --git a/docs/5.3/getting-started/index.html b/docs/5.3/getting-started/index.html index 349df656a8..77668bc23d 100644 --- a/docs/5.3/getting-started/index.html +++ b/docs/5.3/getting-started/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/getting-started/introduction/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/getting-started/introduction/index.html b/docs/5.3/getting-started/introduction/index.html index c15654c426..17d3c6c4e8 100644 --- a/docs/5.3/getting-started/introduction/index.html +++ b/docs/5.3/getting-started/introduction/index.html @@ -1,643 +1,100 @@ - - - - - - - - - - - - - - - - -Get started with Bootstrap · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Get started with Bootstrap

    -
    -

    Bootstrap is a powerful, feature-packed frontend toolkit. Build anything—from prototype to production—in minutes.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Quick start

    -

    Get started by including Bootstrap’s production-ready CSS and JavaScript via CDN without the need for any build steps. See it in practice with this Bootstrap CodePen demo.

    -
    + Get started with Bootstrap · Bootstrap v5.3

    Get started with Bootstrap

    Bootstrap is a powerful, feature-packed frontend toolkit. Build anything—from prototype to production—in minutes.

    +

    Quick start

    +

    Get started by including Bootstrap’s production-ready CSS and JavaScript via CDN without the need for any build steps. See it in practice with this Bootstrap CodePen demo.

    +
    1. Create a new index.html file in your project root. Include the <meta name="viewport"> tag as well for proper responsive behavior in mobile devices.

      -
      <!doctype html>
      -<html lang="en">
      -  <head>
      -    <meta charset="utf-8">
      -    <meta name="viewport" content="width=device-width, initial-scale=1">
      -    <title>Bootstrap demo</title>
      -  </head>
      -  <body>
      -    <h1>Hello, world!</h1>
      -  </body>
      -</html>
      -
    2. +
      <!doctype html>
      +<html lang="en">
      +  <head>
      +    <meta charset="utf-8">
      +    <meta name="viewport" content="width=device-width, initial-scale=1">
      +    <title>Bootstrap demo</title>
      +  </head>
      +  <body>
      +    <h1>Hello, world!</h1>
      +  </body>
      +</html>
      +
      +
    3. -

      Include Bootstrap’s CSS and JS. Place the <link> tag in the <head> for our CSS, and the <script> tag for our JavaScript bundle (including Popper for positioning dropdowns, popovers, and tooltips) before the closing </body>. Learn more about our CDN links.

      -
      <!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 href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-SgOJa3DmI69IUzQ2PVdRZhwQ+dy64/BUtbMJw1MZ8t5HZApcHrRKUc4W0kG879m7" crossorigin="anonymous">
      -  </head>
      -  <body>
      -    <h1>Hello, world!</h1>
      -    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.bundle.min.js" integrity="sha384-k6d4wzSIapyDyv1kpU366/PK5hCdSbCRGRCMv+eplOQJWyd1fbcAu9OCUj5zNLiq" crossorigin="anonymous"></script>
      -  </body>
      -</html>
      -

      You can also include Popper and our JS separately. If you don’t plan to use dropdowns, popovers, or tooltips, save some kilobytes by not including Popper.

      -
      <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script>
      -<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.min.js" integrity="sha384-VQqxDN0EQCkWoxt/0vsQvZswzTHUVOImccYmSyhJTp7kGtPed0Qcx8rK9h9YEgx+" crossorigin="anonymous"></script>
      -
    4. +

      Include Bootstrap’s CSS and JS. Place the <link> tag in the <head> for our CSS, and the <script> tag for our JavaScript bundle (including Popper for positioning dropdowns, popovers, and tooltips) before the closing </body>. Learn more about our CDN links.

      +
      <!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 href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-SgOJa3DmI69IUzQ2PVdRZhwQ+dy64/BUtbMJw1MZ8t5HZApcHrRKUc4W0kG879m7" crossorigin="anonymous">
      +  </head>
      +  <body>
      +    <h1>Hello, world!</h1>
      +    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.bundle.min.js" integrity="sha384-k6d4wzSIapyDyv1kpU366/PK5hCdSbCRGRCMv+eplOQJWyd1fbcAu9OCUj5zNLiq" crossorigin="anonymous"></script>
      +  </body>
      +</html>
      +
      +

      You can also include Popper and our JS separately. If you don’t plan to use dropdowns, popovers, or tooltips, save some kilobytes by not including Popper.

      +
      <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script>
      +<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.min.js" integrity="sha384-VQqxDN0EQCkWoxt/0vsQvZswzTHUVOImccYmSyhJTp7kGtPed0Qcx8rK9h9YEgx+" crossorigin="anonymous"></script>
      +
      +
    5. -

      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, adding dozens of components, and utilizing our official examples.

      +

      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, adding dozens of components, and utilizing our official examples.

    - +

    As reference, here are our primary CDN links.

    -
    - - - - - - - - - - - - - - - - -
    DescriptionURL
    CSShttps://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/css/bootstrap.min.css
    JShttps://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.bundle.min.js
    +
    -

    You can also use the CDN to fetch any of our additional builds listed in the Contents page.

    -

    Next steps

    + + + + + + + + + + + + + + + +
    DescriptionURL
    CSShttps://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/css/bootstrap.min.css
    JShttps://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.bundle.min.js
    +

    You can also use the CDN to fetch any of our additional builds listed in the Contents page.

    +

    Next steps

    -

    JS components

    -

    Curious which components explicitly require our JavaScript and Popper? If you’re at all unsure about the general page structure, keep reading for an example page template.

    +

    JS components

    +

    Curious which components explicitly require our JavaScript and Popper? If you’re at all unsure about the general page structure, keep reading for an example page template.

    • Accordions for extending our Collapse plugin
    • Alerts for dismissing
    • @@ -653,29 +110,32 @@
    • Toasts for displaying and dismissing
    • Tooltips and popovers for displaying and positioning (also requires Popper)
    -

    Important globals

    -

    Bootstrap employs a handful of important global styles and settings, all of which are almost exclusively geared towards the normalization of cross browser styles. Let’s dive in.

    -

    HTML5 doctype

    -

    Bootstrap requires the use of the HTML5 doctype. Without it, you’ll see some funky and incomplete styling.

    -
    <!doctype html>
    -<html lang="en">
    -  ...
    -</html>
    -

    Viewport meta

    +

    Important globals

    +

    Bootstrap employs a handful of important global styles and settings, all of which are almost exclusively geared towards the normalization of cross browser styles. Let’s dive in.

    +

    HTML5 doctype

    +

    Bootstrap requires the use of the HTML5 doctype. Without it, you’ll see some funky and incomplete styling.

    +
    <!doctype html>
    +<html lang="en">
    +  ...
    +</html>
    +
    +

    Viewport meta

    Bootstrap is developed mobile first, a strategy in which we optimize code for mobile devices first and then scale up components as necessary using CSS media queries. To ensure proper rendering and touch zooming for all devices, add the responsive viewport meta tag to your <head>.

    -
    <meta name="viewport" content="width=device-width, initial-scale=1">
    -

    You can see an example of this in action in the quick start.

    -

    Box-sizing

    +
    <meta name="viewport" content="width=device-width, initial-scale=1">
    +
    +

    You can see an example of this in action in the quick start.

    +

    Box-sizing

    For more straightforward sizing in CSS, we switch the global box-sizing value from content-box to border-box. This ensures padding does not affect the final computed width of an element, but it can cause problems with some third-party software like Google Maps and Google Custom Search Engine.

    On the rare occasion you need to override it, use something like the following:

    -
    .selector-for-some-widget {
    -  box-sizing: content-box;
    -}
    -

    With the above snippet, nested elements—including generated content via ::before and ::after—will all inherit the specified box-sizing for that .selector-for-some-widget.

    +
    .selector-for-some-widget {
    +  box-sizing: content-box;
    +}
    +
    +

    With the above snippet, nested elements—including generated content via ::before and ::after—will all inherit the specified box-sizing for that .selector-for-some-widget.

    Learn more about box model and sizing at CSS Tricks.

    -

    Reboot

    -

    For improved cross-browser rendering, we use Reboot to correct inconsistencies across browsers and devices while providing slightly more opinionated resets to common HTML elements.

    -

    Community

    +

    Reboot

    +

    For improved cross-browser rendering, we use Reboot to correct inconsistencies across browsers and devices while providing slightly more opinionated resets to common HTML elements.

    +

    Community

    Stay up-to-date on the development of Bootstrap and reach out to the community with these helpful resources.

    • Read and subscribe to The Official Bootstrap Blog.
    • @@ -685,81 +145,8 @@
    • Implementation help may be found at Stack Overflow (tagged bootstrap-5).
    • Developers should use the keyword bootstrap on packages that modify or add to the functionality of Bootstrap when distributing through npm or similar delivery mechanisms for maximum discoverability.
    -

    You can also follow @getbootstrap on X for the latest gossip and awesome music videos.

    - -
    -
    -
    - - - - - - - - - - - - - - - +

    You can also follow @getbootstrap on X for the latest gossip and awesome music videos.

    \ No newline at end of file diff --git a/docs/5.3/getting-started/javascript/index.html b/docs/5.3/getting-started/javascript/index.html index 75649f8d75..9b08eb6038 100644 --- a/docs/5.3/getting-started/javascript/index.html +++ b/docs/5.3/getting-started/javascript/index.html @@ -1,930 +1,297 @@ - - - - - - - - - - - - - - - - -JavaScript · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    JavaScript

    -
    -

    Bring Bootstrap to life with our optional JavaScript plugins. Learn about each plugin, our data and programmatic API options, and more.

    - - -
    - - - - - -
    - - -

    Individual or compiled

    -

    Plugins can be included individually (using Bootstrap’s individual js/dist/*.js), or all at once using bootstrap.js or the minified bootstrap.min.js (don’t include both).

    -

    If you use a bundler (Webpack, Parcel, Vite…), you can use /js/dist/*.js files which are UMD ready.

    -

    Usage with JavaScript frameworks

    -

    While the Bootstrap CSS can be used with any framework, the Bootstrap JavaScript is not fully compatible with JavaScript frameworks like React, Vue, and Angular which assume full knowledge of the DOM. Both Bootstrap and the framework may attempt to mutate the same DOM element, resulting in bugs like dropdowns that are stuck in the “open” position.

    + JavaScript · Bootstrap v5.3

    JavaScript

    Bring Bootstrap to life with our optional JavaScript plugins. Learn about each plugin, our data and programmatic API options, and more.

    +

    Individual or compiled

    +

    Plugins can be included individually (using Bootstrap’s individual js/dist/*.js), or all at once using bootstrap.js or the minified bootstrap.min.js (don’t include both).

    +

    If you use a bundler (Webpack, Parcel, Vite…), you can use /js/dist/*.js files which are UMD ready.

    +

    Usage with JavaScript frameworks

    +

    While the Bootstrap CSS can be used with any framework, the Bootstrap JavaScript is not fully compatible with JavaScript frameworks like React, Vue, and Angular which assume full knowledge of the DOM. Both Bootstrap and the framework may attempt to mutate the same DOM element, resulting in bugs like dropdowns that are stuck in the “open” position.

    A better alternative for those using this type of frameworks is to use a framework-specific package instead of the Bootstrap JavaScript. Here are some of the most popular options:

    -

    Using Bootstrap as a module

    -
    -Try it yourself! Download the source code and working demo for using Bootstrap as an ES module from the twbs/examples repository. You can also open the example in StackBlitz. -
    - +

    Using Bootstrap as a module

    +

    Try it yourself! Download the source code and working demo for using Bootstrap as an ES module from the twbs/examples repository. You can also open the example in StackBlitz.

    We provide a version of Bootstrap built as ESM (bootstrap.esm.js and bootstrap.esm.min.js) which allows you to use Bootstrap as a module in the browser, if your targeted browsers support it.

    - -
    <script type="module">
    -  import { Toast } from 'bootstrap.esm.min.js'
    -
    -  Array.from(document.querySelectorAll('.toast'))
    -    .forEach(toastNode => new Toast(toastNode))
    -</script>
    -

    Compared to JS bundlers, using ESM in the browser requires you to use the full path and filename instead of the module name. Read more about JS modules in the browser. That’s why we use 'bootstrap.esm.min.js' instead of 'bootstrap' above. However, this is further complicated by our Popper dependency, which imports Popper into our JavaScript like so:

    - -
    import * as Popper from "@popperjs/core"
    -

    If you try this as-is, you’ll see an error in the console like the following:

    -
    Uncaught TypeError: Failed to resolve module specifier "@popperjs/core". Relative references must start with either "/", "./", or "../".
    -

    To fix this, you can use an importmap to resolve the arbitrary module names to complete paths. If your targeted browsers do not support importmap, you’ll need to use the es-module-shims project. Here’s how it works for Bootstrap and Popper:

    - -
    <!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.5/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-SgOJa3DmI69IUzQ2PVdRZhwQ+dy64/BUtbMJw1MZ8t5HZApcHrRKUc4W0kG879m7" crossorigin="anonymous">
    -    <title>Hello, modularity!</title>
    -  </head>
    -  <body>
    -    <h1>Hello, modularity!</h1>
    -    <button id="popoverButton" type="button" class="btn btn-primary btn-lg" data-bs-toggle="popover" title="ESM in Browser" data-bs-content="Bang!">Custom popover</button>
    -
    -    <script async src="https://cdn.jsdelivr.net/npm/es-module-shims@1/dist/es-module-shims.min.js" crossorigin="anonymous"></script>
    -    <script type="importmap">
    -    {
    -      "imports": {
    -        "@popperjs/core": "https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/esm/popper.min.js",
    -        "bootstrap": "https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.esm.min.js"
    -      }
    -    }
    -    </script>
    -    <script type="module">
    -      import * as bootstrap from 'bootstrap'
    -
    -      new bootstrap.Popover(document.getElementById('popoverButton'))
    -    </script>
    -  </body>
    -</html>
    -

    Dependencies

    +
    <script type="module">
    +  import { Toast } from 'bootstrap.esm.min.js'
    +
    +  Array.from(document.querySelectorAll('.toast'))
    +    .forEach(toastNode => new Toast(toastNode))
    +</script>
    +
    +

    Compared to JS bundlers, using ESM in the browser requires you to use the full path and filename instead of the module name. Read more about JS modules in the browser. That’s why we use 'bootstrap.esm.min.js' instead of 'bootstrap' above. However, this is further complicated by our Popper dependency, which imports Popper into our JavaScript like so:

    +
    import * as Popper from "@popperjs/core"
    +
    +

    If you try this as-is, you’ll see an error in the console like the following:

    +
    Uncaught TypeError: Failed to resolve module specifier "@popperjs/core". Relative references must start with either "/", "./", or "../".
    +
    +

    To fix this, you can use an importmap to resolve the arbitrary module names to complete paths. If your targeted browsers do not support importmap, you’ll need to use the es-module-shims project. Here’s how it works for Bootstrap and Popper:

    +
    <!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.5/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-SgOJa3DmI69IUzQ2PVdRZhwQ+dy64/BUtbMJw1MZ8t5HZApcHrRKUc4W0kG879m7" crossorigin="anonymous">
    +    <title>Hello, modularity!</title>
    +  </head>
    +  <body>
    +    <h1>Hello, modularity!</h1>
    +    <button id="popoverButton" type="button" class="btn btn-primary btn-lg" data-bs-toggle="popover" title="ESM in Browser" data-bs-content="Bang!">Custom popover</button>
    +
    +    <script async src="https://cdn.jsdelivr.net/npm/es-module-shims@1/dist/es-module-shims.min.js" crossorigin="anonymous"></script>
    +    <script type="importmap">
    +    {
    +      "imports": {
    +        "@popperjs/core": "https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/esm/popper.min.js",
    +        "bootstrap": "https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.esm.min.js"
    +      }
    +    }
    +    </script>
    +    <script type="module">
    +      import * as bootstrap from 'bootstrap'
    +
    +      new bootstrap.Popover(document.getElementById('popoverButton'))
    +    </script>
    +  </body>
    +</html>
    +
    +

    Dependencies

    Some plugins and CSS components depend on other plugins. If you include plugins individually, make sure to check for these dependencies in the docs.

    Our dropdowns, popovers, and tooltips also depend on Popper.

    -

    Data attributes

    +

    Data attributes

    Nearly all Bootstrap plugins can be enabled and configured through HTML alone with data attributes (our preferred way of using JavaScript functionality). Be sure to only use one set of data attributes on a single element (e.g., you cannot trigger a tooltip and modal from the same button.)

    -

    As options can be passed via data attributes or JavaScript, you can append an option name to data-bs-, as in data-bs-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-bs-custom-class="beautifier" instead of data-bs-customClass="beautifier".

    -

    As of Bootstrap 5.2.0, all components support an experimental reserved data attribute data-bs-config that can house simple component configuration as a JSON string. When an element has data-bs-config='{"delay":0, "title":123}' and data-bs-title="456" attributes, the final title value will be 456 and the separate data attributes will override values given on data-bs-config. In addition, existing data attributes are able to house JSON values like data-bs-delay='{"show":0,"hide":150}'.

    +

    As options can be passed via data attributes or JavaScript, you can append an option name to data-bs-, as in data-bs-animation="{value}". Make sure to change the case type of the option name from “camelCase” to “kebab-case” when passing the options via data attributes. For example, use data-bs-custom-class="beautifier" instead of data-bs-customClass="beautifier".

    +

    As of Bootstrap 5.2.0, all components support an experimental reserved data attribute data-bs-config that can house simple component configuration as a JSON string. When an element has data-bs-config='{"delay":0, "title":123}' and data-bs-title="456" attributes, the final title value will be 456 and the separate data attributes will override values given on data-bs-config. In addition, existing data attributes are able to house JSON values like data-bs-delay='{"show":0,"hide":150}'.

    The final configuration object is the merged result of data-bs-config, data-bs-, and js object where the latest given key-value overrides the others.

    - -

    Selectors

    +

    Selectors

    We use the native querySelector and querySelectorAll methods to query DOM elements for performance reasons, so you must use valid selectors. If you use special selectors like collapse:Example, be sure to escape them.

    -

    Events

    -

    Bootstrap provides custom events for most plugins’ unique actions. Generally, these come in an infinitive and past participle form - where the infinitive (ex. show) is triggered at the start of an event, and its past participle form (ex. shown) is triggered on the completion of an action.

    +

    Events

    +

    Bootstrap provides custom events for most plugins’ unique actions. Generally, these come in an infinitive and past participle form - where the infinitive (ex. show) is triggered at the start of an event, and its past participle form (ex. shown) is triggered on the completion of an action.

    All infinitive events provide preventDefault() functionality. This provides the ability to stop the execution of an action before it starts. Returning false from an event handler will also automatically call preventDefault().

    -
    const myModal = document.querySelector('#myModal')
    -
    -myModal.addEventListener('show.bs.modal', event => {
    -  return event.preventDefault() // stops modal from being shown
    -})
    -

    Programmatic API

    +
    const myModal = document.querySelector('#myModal')
    +
    +myModal.addEventListener('show.bs.modal', event => {
    +  return event.preventDefault() // stops modal from being shown
    +})
    +
    +

    Programmatic API

    All constructors accept an optional options object or nothing (which initiates a plugin with its default behavior):

    -
    const myModalEl = document.querySelector('#myModal')
    -const modal = new bootstrap.Modal(myModalEl) // initialized with defaults
    -
    -const configObject = { keyboard: false }
    -const modal1 = new bootstrap.Modal(myModalEl, configObject) // initialized with no keyboard
    -

    If you’d like to get a particular plugin instance, each plugin exposes a getInstance method. For example, to retrieve an instance directly from an element:

    -
    bootstrap.Popover.getInstance(myPopoverEl)
    -

    This method will return null if an instance is not initiated over the requested element.

    -

    Alternatively, getOrCreateInstance can be used to get the instance associated with a DOM element, or create a new one in case it wasn’t initialized.

    -
    bootstrap.Popover.getOrCreateInstance(myPopoverEl, configObject)
    -

    In case an instance wasn’t initialized, it may accept and use an optional configuration object as second argument.

    -

    CSS selectors in constructors

    +
    const myModalEl = document.querySelector('#myModal')
    +const modal = new bootstrap.Modal(myModalEl) // initialized with defaults
    +
    +const configObject = { keyboard: false }
    +const modal1 = new bootstrap.Modal(myModalEl, configObject) // initialized with no keyboard
    +
    +

    If you’d like to get a particular plugin instance, each plugin exposes a getInstance method. For example, to retrieve an instance directly from an element:

    +
    bootstrap.Popover.getInstance(myPopoverEl)
    +
    +

    This method will return null if an instance is not initiated over the requested element.

    +

    Alternatively, getOrCreateInstance can be used to get the instance associated with a DOM element, or create a new one in case it wasn’t initialized.

    +
    bootstrap.Popover.getOrCreateInstance(myPopoverEl, configObject)
    +
    +

    In case an instance wasn’t initialized, it may accept and use an optional configuration object as second argument.

    +

    CSS selectors in constructors

    In addition to the getInstance and getOrCreateInstance methods, all plugin constructors can accept a DOM element or a valid CSS selector as the first argument. Plugin elements are found with the querySelector method since our plugins only support a single element.

    -
    const modal = new bootstrap.Modal('#myModal')
    -const dropdown = new bootstrap.Dropdown('[data-bs-toggle="dropdown"]')
    -const offcanvas = bootstrap.Offcanvas.getInstance('#myOffcanvas')
    -const alert = bootstrap.Alert.getOrCreateInstance('#myAlert')
    -

    Asynchronous functions and transitions

    +
    const modal = new bootstrap.Modal('#myModal')
    +const dropdown = new bootstrap.Dropdown('[data-bs-toggle="dropdown"]')
    +const offcanvas = bootstrap.Offcanvas.getInstance('#myOffcanvas')
    +const alert = bootstrap.Alert.getOrCreateInstance('#myAlert')
    +
    +

    Asynchronous functions and transitions

    All programmatic API methods are asynchronous and return to the caller once the transition is started, but before it ends. In order to execute an action once the transition is complete, you can listen to the corresponding event.

    -
    const myCollapseEl = document.querySelector('#myCollapse')
    -
    -myCollapseEl.addEventListener('shown.bs.collapse', event => {
    -  // Action to execute once the collapsible area is expanded
    -})
    -

    In addition, a method call on a transitioning component will be ignored.

    -
    const myCarouselEl = document.querySelector('#myCarousel')
    -const carousel = bootstrap.Carousel.getInstance(myCarouselEl) // Retrieve a Carousel instance
    -
    -myCarouselEl.addEventListener('slid.bs.carousel', event => {
    -  carousel.to('2') // Will slide to the slide 2 as soon as the transition to slide 1 is finished
    -})
    -
    -carousel.to('1') // Will start sliding to the slide 1 and returns to the caller
    -carousel.to('2') // !! Will be ignored, as the transition to the slide 1 is not finished !!
    -

    dispose method

    -

    While it may seem correct to use the dispose method immediately after hide(), it will lead to incorrect results. Here’s an example of the problem use:

    -
    const myModal = document.querySelector('#myModal')
    -myModal.hide() // it is asynchronous
    -
    -myModal.addEventListener('shown.bs.hidden', event => {
    -  myModal.dispose()
    -})
    -

    Default settings

    -

    You can change the default settings for a plugin by modifying the plugin’s Constructor.Default object:

    -
    // changes default for the modal plugin's `keyboard` option to false
    -bootstrap.Modal.Default.keyboard = false
    -

    Methods and properties

    +
    const myCollapseEl = document.querySelector('#myCollapse')
    +
    +myCollapseEl.addEventListener('shown.bs.collapse', event => {
    +  // Action to execute once the collapsible area is expanded
    +})
    +
    +

    In addition, a method call on a transitioning component will be ignored.

    +
    const myCarouselEl = document.querySelector('#myCarousel')
    +const carousel = bootstrap.Carousel.getInstance(myCarouselEl) // Retrieve a Carousel instance
    +
    +myCarouselEl.addEventListener('slid.bs.carousel', event => {
    +  carousel.to('2') // Will slide to the slide 2 as soon as the transition to slide 1 is finished
    +})
    +
    +carousel.to('1') // Will start sliding to the slide 1 and returns to the caller
    +carousel.to('2') // !! Will be ignored, as the transition to the slide 1 is not finished !!
    +
    +

    dispose method

    +

    While it may seem correct to use the dispose method immediately after hide(), it will lead to incorrect results. Here’s an example of the problem use:

    +
    const myModal = document.querySelector('#myModal')
    +myModal.hide() // it is asynchronous
    +
    +myModal.addEventListener('shown.bs.hidden', event => {
    +  myModal.dispose()
    +})
    +
    +

    Default settings

    +

    You can change the default settings for a plugin by modifying the plugin’s Constructor.Default object:

    +
    // changes default for the modal plugin’s `keyboard` option to false
    +bootstrap.Modal.Default.keyboard = false
    +
    +

    Methods and properties

    Every Bootstrap plugin exposes the following methods and static properties.

    -
    - - - - - - - - - - - - - - - - - - - - -
    MethodDescription
    disposeDestroys an element’s modal. (Removes stored data on the DOM element)
    getInstanceStatic method which allows you to get the modal instance associated with a DOM element.
    getOrCreateInstanceStatic method which allows you to get the modal instance associated with a DOM element, or create a new one in case it wasn’t initialized.
    +
    -
    - - - - - - - - - - - - - - - - -
    Static propertyDescription
    NAMEReturns the plugin name. (Example: bootstrap.Tooltip.NAME)
    VERSIONThe version of each of Bootstrap’s plugins can be accessed via the VERSION property of the plugin’s constructor (Example: bootstrap.Tooltip.VERSION)
    -

    Sanitizer

    + + + + + + + + + + + + + + + + + + +
    MethodDescription
    disposeDestroys an element’s modal. (Removes stored data on the DOM element)
    getInstanceStatic method which allows you to get the modal instance associated with a DOM element.
    getOrCreateInstanceStatic method which allows you to get the modal instance associated with a DOM element, or create a new one in case it wasn’t initialized.
    +
    + + + + + + + + + + + + + + + + +
    Static propertyDescription
    NAMEReturns the plugin name. (Example: bootstrap.Tooltip.NAME)
    VERSIONThe version of each of Bootstrap’s plugins can be accessed via the VERSION property of the plugin’s constructor (Example: bootstrap.Tooltip.VERSION)
    +

    Sanitizer

    Tooltips and Popovers use our built-in sanitizer to sanitize options which accept HTML.

    The default allowList value is the following:

    -
    -
    - js/src/util/sanitizer.js -
    - -
    -
    const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i
    -
    -export const DefaultAllowlist = {
    -  // Global attributes allowed on any supplied element below.
    -  '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
    -  a: ['target', 'href', 'title', 'rel'],
    -  area: [],
    -  b: [],
    -  br: [],
    -  col: [],
    -  code: [],
    -  dd: [],
    -  div: [],
    -  dl: [],
    -  dt: [],
    -  em: [],
    -  hr: [],
    -  h1: [],
    -  h2: [],
    -  h3: [],
    -  h4: [],
    -  h5: [],
    -  h6: [],
    -  i: [],
    -  img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
    -  li: [],
    -  ol: [],
    -  p: [],
    -  pre: [],
    -  s: [],
    -  small: [],
    -  span: [],
    -  sub: [],
    -  sup: [],
    -  strong: [],
    -  u: [],
    -  ul: []
    -}
    -
    +
    const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i
    +
    +export const DefaultAllowlist = {
    +  // Global attributes allowed on any supplied element below.
    +  '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
    +  a: ['target', 'href', 'title', 'rel'],
    +  area: [],
    +  b: [],
    +  br: [],
    +  col: [],
    +  code: [],
    +  dd: [],
    +  div: [],
    +  dl: [],
    +  dt: [],
    +  em: [],
    +  hr: [],
    +  h1: [],
    +  h2: [],
    +  h3: [],
    +  h4: [],
    +  h5: [],
    +  h6: [],
    +  i: [],
    +  img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
    +  li: [],
    +  ol: [],
    +  p: [],
    +  pre: [],
    +  s: [],
    +  small: [],
    +  span: [],
    +  sub: [],
    +  sup: [],
    +  strong: [],
    +  u: [],
    +  ul: []
    +}
    +

    If you want to add new values to this default allowList you can do the following:

    -
    const myDefaultAllowList = bootstrap.Tooltip.Default.allowList
    -
    -// To allow table elements
    -myDefaultAllowList.table = []
    -
    -// To allow td elements and data-bs-option attributes on td elements
    -myDefaultAllowList.td = ['data-bs-option']
    -
    -// You can push your custom regex to validate your attributes.
    -// Be careful about your regular expressions being too lax
    -const myCustomRegex = /^data-my-app-[\w-]+/
    -myDefaultAllowList['*'].push(myCustomRegex)
    -

    If you want to bypass our sanitizer because you prefer to use a dedicated library, for example DOMPurify, you should do the following:

    -
    const yourTooltipEl = document.querySelector('#yourTooltip')
    -const tooltip = new bootstrap.Tooltip(yourTooltipEl, {
    -  sanitizeFn(content) {
    -    return DOMPurify.sanitize(content)
    -  }
    -})
    -

    Optionally using jQuery

    -

    You don’t need jQuery in Bootstrap 5, but it’s still possible to use our components with jQuery. If Bootstrap detects jQuery in the window object, it’ll add all of our components in jQuery’s plugin system. This allows you to do the following:

    -
    // to enable tooltips with the default configuration
    -$('[data-bs-toggle="tooltip"]').tooltip()
    -
    -// to initialize tooltips with given configuration
    -$('[data-bs-toggle="tooltip"]').tooltip({
    -  boundary: 'clippingParents',
    -  customClass: 'myClass'
    -})
    -
    -// to trigger the `show` method
    -$('#myTooltip').tooltip('show')
    -

    The same goes for our other components.

    -

    No conflict

    +
    const myDefaultAllowList = bootstrap.Tooltip.Default.allowList
    +
    +// To allow table elements
    +myDefaultAllowList.table = []
    +
    +// To allow td elements and data-bs-option attributes on td elements
    +myDefaultAllowList.td = ['data-bs-option']
    +
    +// You can push your custom regex to validate your attributes.
    +// Be careful about your regular expressions being too lax
    +const myCustomRegex = /^data-my-app-[\w-]+/
    +myDefaultAllowList['*'].push(myCustomRegex)
    +
    +

    If you want to bypass our sanitizer because you prefer to use a dedicated library, for example DOMPurify, you should do the following:

    +
    const yourTooltipEl = document.querySelector('#yourTooltip')
    +const tooltip = new bootstrap.Tooltip(yourTooltipEl, {
    +  sanitizeFn(content) {
    +    return DOMPurify.sanitize(content)
    +  }
    +})
    +
    +

    Optionally using jQuery

    +

    You don’t need jQuery in Bootstrap 5, but it’s still possible to use our components with jQuery. If Bootstrap detects jQuery in the window object, it'll add all of our components in jQuery’s plugin system. This allows you to do the following:

    +
    // to enable tooltips with the default configuration
    +$('[data-bs-toggle="tooltip"]').tooltip()
    +
    +// to initialize tooltips with given configuration
    +$('[data-bs-toggle="tooltip"]').tooltip({
    +  boundary: 'clippingParents',
    +  customClass: 'myClass'
    +})
    +
    +// to trigger the `show` method
    +$('#myTooltip').tooltip('show')
    +
    +

    The same goes for our other components.

    +

    No conflict

    Sometimes it is necessary to use Bootstrap plugins with other UI frameworks. In these circumstances, namespace collisions can occasionally occur. If this happens, you may call .noConflict on the plugin you wish to revert the value of.

    -
    const bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value
    -$.fn.bootstrapBtn = bootstrapButton // give $().bootstrapBtn the Bootstrap functionality
    -

    Bootstrap does not officially support third-party JavaScript libraries like Prototype or jQuery UI. Despite .noConflict and namespaced events, there may be compatibility problems that you need to fix on your own.

    -

    jQuery events

    -

    Bootstrap will detect jQuery if jQuery is present in the window object and there is no data-bs-no-jquery attribute set on <body>. If jQuery is found, Bootstrap will emit events thanks to jQuery’s event system. So if you want to listen to Bootstrap’s events, you’ll have to use the jQuery methods (.on, .one) instead of addEventListener.

    -
    $('#myTab a').on('shown.bs.tab', () => {
    -  // do something...
    -})
    -

    Disabled JavaScript

    -

    Bootstrap’s plugins have no special fallback when JavaScript is disabled. If you care about the user experience in this case, use <noscript> to explain the situation (and how to re-enable JavaScript) to your users, and/or add your own custom fallbacks.

    - -
    -
    -
    - - - - - - - - - - - - - - - +
    const bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value
    +$.fn.bootstrapBtn = bootstrapButton // give $().bootstrapBtn the Bootstrap functionality
    +
    +

    Bootstrap does not officially support third-party JavaScript libraries like Prototype or jQuery UI. Despite .noConflict and namespaced events, there may be compatibility problems that you need to fix on your own.

    +

    jQuery events

    +

    Bootstrap will detect jQuery if jQuery is present in the window object and there is no data-bs-no-jquery attribute set on <body>. If jQuery is found, Bootstrap will emit events thanks to jQuery’s event system. So if you want to listen to Bootstrap’s events, you’ll have to use the jQuery methods (.on, .one) instead of addEventListener.

    +
    $('#myTab a').on('shown.bs.tab', () => {
    +  // do something...
    +})
    +
    +

    Disabled JavaScript

    +

    Bootstrap’s plugins have no special fallback when JavaScript is disabled. If you care about the user experience in this case, use <noscript> to explain the situation (and how to re-enable JavaScript) to your users, and/or add your own custom fallbacks.

    \ No newline at end of file diff --git a/docs/5.3/getting-started/parcel/index.html b/docs/5.3/getting-started/parcel/index.html index 446e5327a0..9d17e54e7d 100644 --- a/docs/5.3/getting-started/parcel/index.html +++ b/docs/5.3/getting-started/parcel/index.html @@ -1,751 +1,150 @@ - - - - - - - - - - - - - - - - -Bootstrap and Parcel · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Bootstrap and Parcel

    -
    -

    The official guide for how to include and bundle Bootstrap’s CSS and JavaScript in your project using Parcel.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - - -
    -Want to skip to the end? Download the source code and working demo for this guide from the twbs/examples repository. You can also open the example in StackBlitz but not run it because Parcel isn’t currently supported there. -
    - -

    What is Parcel?

    + Bootstrap and Parcel · Bootstrap v5.3

    Bootstrap and Parcel

    The official guide for how to include and bundle Bootstrap’s CSS and JavaScript in your project using Parcel.

    +
    +

    Want to skip to the end? Download the source code and working demo for this guide from the twbs/examples repository. You can also open the example in StackBlitz but not run it because Parcel isn’t currently supported there.

    +

    What is Parcel?

    Parcel is a web application bundler designed to simplify the development process with a zero-configuration setup out of the box. It offers features found in more advanced bundlers while focusing on ease of use, making it ideal for developers seeking a quick start.

    -

    Setup

    -

    We’re building a Parcel project with Bootstrap from scratch, so there are some prerequisites and upfront steps before we can really get started. This guide requires you to have Node.js installed and some familiarity with the terminal.

    +

    Setup

    +

    We’re building a Parcel project with Bootstrap from scratch, so there are some prerequisites and upfront steps before we can really get started. This guide requires you to have Node.js installed and some familiarity with the terminal.

    1. -

      Create a project folder and set up npm. We’ll create the my-project folder and initialize npm with the -y argument to avoid it asking us all the interactive questions.

      -
      mkdir my-project && cd my-project
      -npm init -y
      -
    2. +

      Create a project folder and set up npm. We'll create the my-project folder and initialize npm with the -y argument to avoid it asking us all the interactive questions.

      +
      mkdir my-project && cd my-project
      +npm init -y
      +
      +
    3. -

      Install Parcel. Unlike our Webpack guide, there’s only a single build tool dependency here. Parcel will automatically install language transformers (like Sass) as it detects them. We use --save-dev to signal that this dependency is only for development use and not for production.

      -
      npm i --save-dev parcel
      -
    4. +

      Install Parcel. Unlike our Webpack guide, there’s only a single build tool dependency here. Parcel will automatically install language transformers (like Sass) as it detects them. We use --save-dev to signal that this dependency is only for development use and not for production.

      +
      npm i --save-dev parcel
      +
      +
    5. -

      Install Bootstrap. Now we can install Bootstrap. We’ll also install Popper since our dropdowns, popovers, and tooltips depend on it for their positioning. If you don’t plan on using those components, you can omit Popper here.

      -
      npm i --save bootstrap @popperjs/core
      -
    6. +

      Install Bootstrap. Now we can install Bootstrap. We'll also install Popper since our dropdowns, popovers, and tooltips depend on it for their positioning. If you don’t plan on using those components, you can omit Popper here.

      +
      npm i --save bootstrap @popperjs/core
      +
      +

    Now that we have all the necessary dependencies installed, we can get to work creating the project files and importing Bootstrap.

    -

    Project structure

    -

    We’ve already created the my-project folder and initialized npm. Now we’ll also create our src folder, stylesheet, and JavaScript file to round out the project structure. Run the following from my-project, or manually create the folder and file structure shown below.

    -
    mkdir {src,src/js,src/scss}
    -touch src/index.html src/js/main.js src/scss/styles.scss
    -

    When you’re done, your complete project should look like this:

    -
    my-project/
    -├── src/
    -│   ├── js/
    -│   │   └── main.js
    -│   ├── scss/
    -│   │   └── styles.scss
    -│   └── index.html
    -├── package-lock.json
    -└── package.json
    -

    At this point, everything is in the right place, but Parcel needs an HTML page and npm script to start our server.

    -

    Configure Parcel

    +

    Project structure

    +

    We’ve already created the my-project folder and initialized npm. Now we'll also create our src folder, stylesheet, and JavaScript file to round out the project structure. Run the following from my-project, or manually create the folder and file structure shown below.

    +
    mkdir {src,src/js,src/scss}
    +touch src/index.html src/js/main.js src/scss/styles.scss
    +
    +

    When you’re done, your complete project should look like this:

    +
    my-project/
    +├── src/
    +│   ├── js/
    +│   │   └── main.js
    +│   ├── scss/
    +│   │   └── styles.scss
    +│   └── index.html
    +├── package-lock.json
    +└── package.json
    +
    +

    At this point, everything is in the right place, but Parcel needs an HTML page and npm script to start our server.

    +

    Configure Parcel

    With dependencies installed and our project folder ready for us to start coding, we can now configure Parcel and run our project locally. Parcel itself requires no configuration file by design, but we do need an npm script and an HTML file to start our server.

    1. Fill in the src/index.html file. Parcel needs a page to render, so we use our index.html page to set up some basic HTML, including our CSS and JavaScript files.

      -
      <!doctype html>
      -<html lang="en">
      -  <head>
      -    <meta charset="utf-8">
      -    <meta name="viewport" content="width=device-width, initial-scale=1">
      -    <title>Bootstrap w/ Parcel</title>
      -    <link rel="stylesheet" href="scss/styles.scss">
      -    <script type="module" src="js/main.js"></script>
      -  </head>
      -  <body>
      -    <div class="container py-4 px-3 mx-auto">
      -      <h1>Hello, Bootstrap and Parcel!</h1>
      -      <button class="btn btn-primary">Primary button</button>
      -    </div>
      -  </body>
      -</html>
      -

      We’re including a little bit of Bootstrap styling here with the div class="container" and <button> so that we see when Bootstrap’s CSS is loaded by Parcel.

      -

      Parcel will automatically detect we’re using Sass and install the Sass Parcel plugin to support it. However, if you wish, you can also manually run npm i --save-dev @parcel/transformer-sass.

      +
      <!doctype html>
      +<html lang="en">
      +  <head>
      +    <meta charset="utf-8">
      +    <meta name="viewport" content="width=device-width, initial-scale=1">
      +    <title>Bootstrap w/ Parcel</title>
      +    <link rel="stylesheet" href="scss/styles.scss">
      +    <script type="module" src="js/main.js"></script>
      +  </head>
      +  <body>
      +    <div class="container py-4 px-3 mx-auto">
      +      <h1>Hello, Bootstrap and Parcel!</h1>
      +      <button class="btn btn-primary">Primary button</button>
      +    </div>
      +  </body>
      +</html>
      +
      +

      We’re including a little bit of Bootstrap styling here with the div class="container" and <button> so that we see when Bootstrap’s CSS is loaded by Parcel.

      +

      Parcel will automatically detect we’re using Sass and install the Sass Parcel plugin to support it. However, if you wish, you can also manually run npm i --save-dev @parcel/transformer-sass.

    2. -

      Add the Parcel npm scripts. Open the package.json and add the following start script to the scripts object. We’ll use this script to start our Parcel development server and render the HTML file we created after it’s compiled into the dist directory.

      -
      {
      -   // ...
      -   "scripts": {
      -     "start": "parcel serve src/index.html --public-url / --dist-dir dist",
      -     "test": "echo \"Error: no test specified\" && exit 1"
      -   },
      -   // ...
      -}
      -
    3. +

      Add the Parcel npm scripts. Open the package.json and add the following start script to the scripts object. We'll use this script to start our Parcel development server and render the HTML file we created after it’s compiled into the dist directory.

      +
      {
      +   // ...
      +   "scripts": {
      +     "start": "parcel serve src/index.html --public-url / --dist-dir dist",
      +     "test": "echo \"Error: no test specified\" && exit 1"
      +   },
      +   // ...
      +}
      +
      +
    4. And finally, we can start Parcel. From the my-project folder in your terminal, run that newly added npm script:

      -
      npm start
      -

      Parcel dev server running -

      +
      npm start
      +
      +Parcel dev server running
    -

    In the next and final section to this guide, we’ll import all of Bootstrap’s CSS and JavaScript.

    -

    Import Bootstrap

    +

    In the next and final section to this guide, we'll import all of Bootstrap’s CSS and JavaScript.

    +

    Import Bootstrap

    Importing Bootstrap into Parcel requires two imports, one into our styles.scss and one into our main.js.

    1. -

      Import Bootstrap’s CSS. Add the following to src/scss/styles.scss to import all of Bootstrap’s source Sass.

      -
      // Import all of Bootstrap's CSS
      -@import "bootstrap/scss/bootstrap";
      -

      You can also import our stylesheets individually if you want. Read our Sass import docs for details.

      +

      Import Bootstrap’s CSS. Add the following to src/scss/styles.scss to import all of Bootstrap’s source Sass.

      +
      // Import all of Bootstrap’s CSS
      +@import "bootstrap/scss/bootstrap";
      +
      +

      You can also import our stylesheets individually if you want. Read our Sass import docs for details.

      +

      Optional: You may see Sass deprecation warnings with the latest versions of Dart Sass. These can silenced by adding the following configuration in a .sassrc.js file in the root folder with the following:

      +
      module.exports = {
      +  silenceDeprecations: ['import', 'mixed-decls', 'color-functions', 'global-builtin']
      +}
      +
    2. -

      Import Bootstrap’s JS. Add the following to src/js/main.js to import all of Bootstrap’s JS. Popper will be imported automatically through Bootstrap.

      - -
      // Import all of Bootstrap's JS
      -import * as bootstrap from 'bootstrap'
      -

      You can also import JavaScript plugins individually as needed to keep bundle sizes down:

      - -
      import Alert from 'bootstrap/js/dist/alert'
      -
      -// or, specify which plugins you need:
      -import { Tooltip, Toast, Popover } from 'bootstrap'
      -

      Read our JavaScript docs for more information on how to use Bootstrap’s plugins.

      +

      Import Bootstrap’s JS. Add the following to src/js/main.js to import all of Bootstrap’s JS. Popper will be imported automatically through Bootstrap.

      +
      // Import all of Bootstrap’s JS
      +import * as bootstrap from 'bootstrap'
      +
      +

      You can also import JavaScript plugins individually as needed to keep bundle sizes down:

      +
      import Alert from 'bootstrap/js/dist/alert'
      +
      +// or, specify which plugins you need:
      +import { Tooltip, Toast, Popover } from 'bootstrap'
      +
      +

      Read our JavaScript docs for more information on how to use Bootstrap’s plugins.

    3. -

      And you’re done! 🎉 With Bootstrap’s source Sass and JS fully loaded, your local development server should now look like this:

      -

      Parcel dev server running with Bootstrap -

      -

      Now you can start adding any Bootstrap components you want to use. Be sure to check out the complete Parcel example project for how to include additional custom Sass and optimize your build by importing only the parts of Bootstrap’s CSS and JS that you need.

      +

      And you’re done! 🎉 With Bootstrap’s source Sass and JS fully loaded, your local development server should now look like this:

      +Parcel dev server running with Bootstrap +

      Now you can start adding any Bootstrap components you want to use. Be sure to check out the complete Parcel example project for how to include additional custom Sass and optimize your build by importing only the parts of Bootstrap’s CSS and JS that you need.

    -
    -

    See something wrong or out of date here? Please open an issue on GitHub. Need help troubleshooting? Search or start a discussion on GitHub.

    - -
    -
    -
    - - - - - - - - - - - - - - - +
    +

    See something wrong or out of date here? Please open an issue on GitHub. Need help troubleshooting? Search or start a discussion on GitHub.

    \ No newline at end of file diff --git a/docs/5.3/getting-started/rfs/index.html b/docs/5.3/getting-started/rfs/index.html index b53fa29a4a..1f1e6b3c79 100644 --- a/docs/5.3/getting-started/rfs/index.html +++ b/docs/5.3/getting-started/rfs/index.html @@ -1,688 +1,81 @@ - - - - - - - - - - - - - - - - -RFS · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    - -

    Bootstrap’s resizing engine responsively scales common CSS properties to better utilize available space across viewports and devices.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    What is RFS?

    -

    Bootstrap’s side project RFS is a unit resizing engine which was initially developed to resize font sizes (hence its abbreviation for Responsive Font Sizes). Nowadays RFS is capable of rescaling most CSS properties with unit values like margin, padding, border-radius, or even box-shadow.

    + RFS · Bootstrap v5.3

    Bootstrap’s resizing engine responsively scales common CSS properties to better utilize available space across viewports and devices.

    +

    What is RFS?

    +

    Bootstrap’s side project RFS is a unit resizing engine which was initially developed to resize font sizes (hence its abbreviation for Responsive Font Sizes). Nowadays RFS is capable of rescaling most CSS properties with unit values like margin, padding, border-radius, or even box-shadow.

    The mechanism automatically calculates the appropriate values based on the dimensions of the browser viewport. It will be compiled into calc() functions with a mix of rem and viewport units to enable the responsive scaling behavior.

    -

    Using RFS

    -

    The mixins are included in Bootstrap and are available once you include Bootstrap’s scss. RFS can also be installed standalone if needed.

    -

    Using the mixins

    +

    Using RFS

    +

    The mixins are included in Bootstrap and are available once you include Bootstrap’s scss. RFS can also be installed standalone if needed.

    +

    Using the mixins

    The rfs() mixin has shorthands for font-size, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, and padding-left. See the example below for source Sass and compiled CSS.

    -
    .title {
    -  @include font-size(4rem);
    -}
    -
    .title {
    -  font-size: calc(1.525rem + 3.3vw);
    -}
    -
    -@media (min-width: 1200px) {
    -  .title {
    -    font-size: 4rem;
    -  }
    -}
    -

    Any other property can be passed to the rfs() mixin like this:

    -
    .selector {
    -  @include rfs(4rem, border-radius);
    -}
    -

    !important can also just be added to whatever value you want:

    -
    .selector {
    -  @include padding(2.5rem !important);
    -}
    -

    Using the functions

    -

    When you don’t want to use the includes, there are also two functions:

    +
    .title {
    +  @include font-size(4rem);
    +}
    +
    +
    .title {
    +  font-size: calc(1.525rem + 3.3vw);
    +}
    +
    +@media (min-width: 1200px) {
    +  .title {
    +    font-size: 4rem;
    +  }
    +}
    +
    +

    Any other property can be passed to the rfs() mixin like this:

    +
    .selector {
    +  @include rfs(4rem, border-radius);
    +}
    +
    +

    !important can also just be added to whatever value you want:

    +
    .selector {
    +  @include padding(2.5rem !important);
    +}
    +
    +

    Using the functions

    +

    When you don’t want to use the includes, there are also two functions:

    • rfs-value() converts a value into a rem value if a px value is passed, in other cases it returns the same result.
    • rfs-fluid-value() returns the fluid version of a value if the property needs rescaling.
    -

    In this example, we use one of Bootstrap’s built-in responsive breakpoint mixins to only apply styling below the lg breakpoint.

    -
    .selector {
    -  @include media-breakpoint-down(lg) {
    -    padding: rfs-fluid-value(2rem);
    -    font-size: rfs-fluid-value(1.125rem);
    -  }
    -}
    -
    @media (max-width: 991.98px) {
    -  .selector {
    -    padding: calc(1.325rem + 0.9vw);
    -    font-size: 1.125rem; /* 1.125rem is small enough, so RFS won't rescale this */
    -  }
    -}
    -

    Extended documentation

    -

    RFS is a separate project under the Bootstrap organization. More about RFS and its configuration can be found on its GitHub repository.

    - -
    -
    -
    - - - - - - - - - - - - - - - +

    In this example, we use one of Bootstrap’s built-in responsive breakpoint mixins to only apply styling below the lg breakpoint.

    +
    .selector {
    +  @include media-breakpoint-down(lg) {
    +    padding: rfs-fluid-value(2rem);
    +    font-size: rfs-fluid-value(1.125rem);
    +  }
    +}
    +
    +
    @media (max-width: 991.98px) {
    +  .selector {
    +    padding: calc(1.325rem + 0.9vw);
    +    font-size: 1.125rem; /* 1.125rem is small enough, so RFS won’t rescale this */
    +  }
    +}
    +
    +

    Extended documentation

    +

    RFS is a separate project under the Bootstrap organization. More about RFS and its configuration can be found on its GitHub repository.

    \ No newline at end of file diff --git a/docs/5.3/getting-started/rtl/index.html b/docs/5.3/getting-started/rtl/index.html index 7ddf297720..754e0a8482 100644 --- a/docs/5.3/getting-started/rtl/index.html +++ b/docs/5.3/getting-started/rtl/index.html @@ -1,791 +1,164 @@ - - - - - - - - - - - - - - - - -RTL · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    - -

    Learn how to enable support for right-to-left text in Bootstrap across our layout, components, and utilities.

    - - -
    - - - - - -
    - - -

    Get familiar

    -

    We recommend getting familiar with Bootstrap first by reading through our Getting Started Introduction page. Once you’ve run through it, continue reading here for how to enable RTL.

    + RTL · Bootstrap v5.3

    Learn how to enable support for right-to-left text in Bootstrap across our layout, components, and utilities.

    +

    Get familiar

    +

    We recommend getting familiar with Bootstrap first by reading through our Getting Started Introduction page. Once you’ve run through it, continue reading here for how to enable RTL.

    You may also want to read up on the RTLCSS project, as it powers our approach to RTL.

    -
    -Bootstrap’s RTL feature is still experimental and will evolve based on user feedback. Spotted something or have an improvement to suggest? Open an issue, we’d love to get your insights. -
    - -

    Required HTML

    +

    Bootstrap’s RTL feature is still experimental and will evolve based on user feedback. Spotted something or have an improvement to suggest? Open an issue, we’d love to get your insights.

    +

    Required HTML

    There are two strict requirements for enabling RTL in Bootstrap-powered pages.

    1. Set dir="rtl" on the <html> element.
    2. Add an appropriate lang attribute, like lang="ar", on the <html> element.
    -

    From there, you’ll need to include an RTL version of our CSS. For example, here’s the stylesheet for our compiled and minified CSS with RTL enabled:

    -
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/css/bootstrap.rtl.min.css" integrity="sha384-q8+l9TmX3RaSz3HKGBmqP2u5MkgeN7HrfOJBLcTgZsQsbrx8WqqxdA5PuwUV9WIx" crossorigin="anonymous">
    -

    Starter template

    +

    From there, you’ll need to include an RTL version of our CSS. For example, here’s the stylesheet for our compiled and minified CSS with RTL enabled:

    +
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/css/bootstrap.rtl.min.css" integrity="sha384-q8+l9TmX3RaSz3HKGBmqP2u5MkgeN7HrfOJBLcTgZsQsbrx8WqqxdA5PuwUV9WIx" crossorigin="anonymous">
    +
    +

    Starter template

    You can see the above requirements reflected in this modified RTL starter template.

    -
    <!doctype html>
    -<html lang="ar" dir="rtl">
    -  <head>
    -    <!-- Required meta tags -->
    -    <meta charset="utf-8">
    -    <meta name="viewport" content="width=device-width, initial-scale=1">
    -
    -    <!-- Bootstrap CSS -->
    -    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/css/bootstrap.rtl.min.css" integrity="sha384-q8+l9TmX3RaSz3HKGBmqP2u5MkgeN7HrfOJBLcTgZsQsbrx8WqqxdA5PuwUV9WIx" crossorigin="anonymous">
    -
    -    <title>مرحبًا بالعالم!</title>
    -  </head>
    -  <body>
    -    <h1>مرحبًا بالعالم!</h1>
    -
    -    <!-- Optional JavaScript; choose one of the two! -->
    -
    -    <!-- Option 1: Bootstrap Bundle with Popper -->
    -    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.bundle.min.js" integrity="sha384-k6d4wzSIapyDyv1kpU366/PK5hCdSbCRGRCMv+eplOQJWyd1fbcAu9OCUj5zNLiq" crossorigin="anonymous"></script>
    -
    -    <!-- Option 2: Separate Popper and Bootstrap JS -->
    -    <!--
    -    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script>
    -    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.min.js" integrity="sha384-VQqxDN0EQCkWoxt/0vsQvZswzTHUVOImccYmSyhJTp7kGtPed0Qcx8rK9h9YEgx+" crossorigin="anonymous"></script>
    -    -->
    -  </body>
    -</html>
    -

    RTL examples

    +
    <!doctype html>
    +<html lang="ar" dir="rtl">
    +  <head>
    +    <!-- Required meta tags -->
    +    <meta charset="utf-8">
    +    <meta name="viewport" content="width=device-width, initial-scale=1">
    +
    +    <!-- Bootstrap CSS -->
    +    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/css/bootstrap.rtl.min.css" integrity="sha384-q8+l9TmX3RaSz3HKGBmqP2u5MkgeN7HrfOJBLcTgZsQsbrx8WqqxdA5PuwUV9WIx" crossorigin="anonymous">
    +
    +    <title>مرحبًا بالعالم!</title>
    +  </head>
    +  <body>
    +    <h1>مرحبًا بالعالم!</h1>
    +
    +    <!-- Optional JavaScript; choose one of the two! -->
    +
    +    <!-- Option 1: Bootstrap Bundle with Popper -->
    +    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.bundle.min.js" integrity="sha384-k6d4wzSIapyDyv1kpU366/PK5hCdSbCRGRCMv+eplOQJWyd1fbcAu9OCUj5zNLiq" crossorigin="anonymous"></script>
    +
    +    <!-- Option 2: Separate Popper and Bootstrap JS -->
    +    <!--
    +    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script>
    +    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.min.js" integrity="sha384-VQqxDN0EQCkWoxt/0vsQvZswzTHUVOImccYmSyhJTp7kGtPed0Qcx8rK9h9YEgx+" crossorigin="anonymous"></script>
    +    -->
    +  </body>
    +</html>
    +
    +

    RTL examples

    Get started with one of our several RTL examples.

    -

    Approach

    +

    Approach

    Our approach to building RTL support into Bootstrap comes with two important decisions that impact how we write and use our CSS:

    1. First, we decided to build it with the RTLCSS project. This gives us some powerful features for managing changes and overrides when moving from LTR to RTL. It also allows us to build two versions of Bootstrap from one codebase.

    2. -

      Second, we’ve renamed a handful of directional classes to adopt a logical properties approach. Most of you have already interacted with logical properties thanks to our flex utilities—they replace direction properties like left and right in favor start and end. That makes the class names and values appropriate for LTR and RTL without any overhead.

      +

      Second, we’ve renamed a handful of directional classes to adopt a logical properties approach. Most of you have already interacted with logical properties thanks to our flex utilities—they replace direction properties like left and right in favor start and end. That makes the class names and values appropriate for LTR and RTL without any overhead.

    For example, instead of .ml-3 for margin-left, use .ms-3.

    -

    Working with RTL, through our source Sass or compiled CSS, shouldn’t be much different from our default LTR though.

    -

    Customize from source

    -

    When it comes to customization, the preferred way is to take advantage of variables, maps, and mixins. This approach works the same for RTL, even if it’s post-processed from the compiled files, thanks to how RTLCSS works.

    -

    Custom RTL values

    +

    Working with RTL, through our source Sass or compiled CSS, shouldn’t be much different from our default LTR though.

    +

    Customize from source

    +

    When it comes to customization, the preferred way is to take advantage of variables, maps, and mixins. This approach works the same for RTL, even if it’s post-processed from the compiled files, thanks to how RTLCSS works.

    +

    Custom RTL values

    Using RTLCSS value directives, you can make a variable output a different value for RTL. For example, to decrease the weight for $font-weight-bold throughout the codebase, you may use the /*rtl: {value}*/ syntax:

    -
    $font-weight-bold: 700 #{/* rtl:600 */} !default;
    -

    Which would output to the following for our default CSS and RTL CSS:

    -
    /* bootstrap.css */
    -dt {
    -  font-weight: 700 /* rtl:600 */;
    -}
    -
    -/* bootstrap.rtl.css */
    -dt {
    -  font-weight: 600;
    -}
    -

    Alternative font stack

    -

    In the case you’re using a custom font, be aware that not all fonts support the non-Latin alphabet. To switch from Pan-European to Arabic family, you may need to use /*rtl:insert: {value}*/ in your font stack to modify the names of font families.

    +
    $font-weight-bold: 700 #{/* rtl:600 */} !default;
    +
    +

    Which would output to the following for our default CSS and RTL CSS:

    +
    /* bootstrap.css */
    +dt {
    +  font-weight: 700 /* rtl:600 */;
    +}
    +
    +/* bootstrap.rtl.css */
    +dt {
    +  font-weight: 600;
    +}
    +
    +

    Alternative font stack

    +

    In the case you’re using a custom font, be aware that not all fonts support the non-Latin alphabet. To switch from Pan-European to Arabic family, you may need to use /*rtl:insert: {value}*/ in your font stack to modify the names of font families.

    For example, to switch from Helvetica Neue font for LTR to Helvetica Neue Arabic for RTL, your Sass code could look like this:

    -
    $font-family-sans-serif:
    -  Helvetica Neue #{"/* rtl:insert:Arabic */"},
    -  // Cross-platform generic font family (default user interface font)
    -  system-ui,
    -  // Safari for macOS and iOS (San Francisco)
    -  -apple-system,
    -  // Chrome < 56 for macOS (San Francisco)
    -  BlinkMacSystemFont,
    -  // Windows
    -  "Segoe UI",
    -  // Android
    -  Roboto,
    -  // Basic web fallback
    -  Arial,
    -  // Linux
    -  "Noto Sans",
    -  // Sans serif fallback
    -  sans-serif,
    -  // Emoji fonts
    -  "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !default;
    -

    LTR and RTL at the same time

    +
    $font-family-sans-serif:
    +  Helvetica Neue #{"/* rtl:insert:Arabic */"},
    +  // Cross-platform generic font family (default user interface font)
    +  system-ui,
    +  // Safari for macOS and iOS (San Francisco)
    +  -apple-system,
    +  // Chrome < 56 for macOS (San Francisco)
    +  BlinkMacSystemFont,
    +  // Windows
    +  "Segoe UI",
    +  // Android
    +  Roboto,
    +  // Basic web fallback
    +  Arial,
    +  // Linux
    +  "Noto Sans",
    +  // Sans serif fallback
    +  sans-serif,
    +  // Emoji fonts
    +  "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !default;
    +
    +

    LTR and RTL at the same time

    Need both LTR and RTL on the same page? Thanks to RTLCSS String Maps, this is pretty straightforward. Wrap your @imports with a class, and set a custom rename rule for RTLCSS:

    -
    /* rtl:begin:options: {
    -  "autoRename": true,
    -  "stringMap":[ {
    -    "name": "ltr-rtl",
    -    "priority": 100,
    -    "search": ["ltr"],
    -    "replace": ["rtl"],
    -    "options": {
    -      "scope": "*",
    -      "ignoreCase": false
    -    }
    -  } ]
    -} */
    -.ltr {
    -  @import "../node_modules/bootstrap/scss/bootstrap";
    -}
    -/*rtl:end:options*/
    -

    After running Sass then RTLCSS, each selector in your CSS files will be prepended by .ltr, and .rtl for RTL files. Now you’re able to use both files on the same page, and simply use .ltr or .rtl on your components wrappers to use one or the other direction.

    -
    -

    Edge cases and known limitations to consider when working with a combined LTR and RTL implementation:

    -
      +
      /* rtl:begin:options: {
      +  "autoRename": true,
      +  "stringMap":[ {
      +    "name": "ltr-rtl",
      +    "priority": 100,
      +    "search": ["ltr"],
      +    "replace": ["rtl"],
      +    "options": {
      +      "scope": "*",
      +      "ignoreCase": false
      +    }
      +  } ]
      +} */
      +.ltr {
      +  @import "../node_modules/bootstrap/scss/bootstrap";
      +}
      +/*rtl:end:options*/
      +
      +

      After running Sass then RTLCSS, each selector in your CSS files will be prepended by .ltr, and .rtl for RTL files. Now you’re able to use both files on the same page, and simply use .ltr or .rtl on your components wrappers to use one or the other direction.

      +

      Edge cases and known limitations to consider when working with a combined LTR and RTL implementation:

      1. When switching .ltr and .rtl, make sure you add dir and lang attributes accordingly.
      2. -
      3. Loading both files can be a real performance bottleneck: consider some optimization, and maybe try to load one of those files asynchronously.
      4. +
      5. Loading both files can be a real performance bottleneck: consider some optimization, and maybe try to load one of those files asynchronously.
      6. Nesting styles this way will prevent our form-validation-state() mixin from working as intended, thus require you tweak it a bit by yourself. See #31223.
      7. -
      -
      - +

    Do you want to automate this process and address several edge cases involving both directions within a single stylesheet? Then, consider using PostCSS RTLCSS as a PostCSS plugin to process your source files. PostCSS RTLCSS uses RTLCSS behind the scenes to manage the direction flipping process, but it separates the flipped declarations into rules with a different prefix for LTR and RTL, something that allows you to have both directions within the same stylesheet file. By doing this, you can switch between LTR and RTL orientations by simply changing the dir of the page (or even by modifying a specific class if you configure the plugin accordingly).

    -
    -

    Important things to take into account when using PostCSS RTLCSS to build a combined LTR and RTL implementation:

    -
      +

      Important things to take into account when using PostCSS RTLCSS to build a combined LTR and RTL implementation:

      1. It is recommended that you add the dir attribute to the html element. This way, the entire page will be affected when you change the direction. Also, make sure you add the lang attribute accordingly.
      2. -
      3. Having a single bundle with both directions will increase the size of the final stylesheet (on average, by 20%-30%): consider some optimization.
      4. -
      5. Take into account that PostCSS RTLCSS is not compatible with /* rtl:remove */ directives because it doesn’t remove any CSS rule. You should replace your /* rtl:remove */, /* rtl:begin:remove */ and /* rtl:end:remove */ directives with /* rtl:freeze */, /* rtl:begin:freeze */ and /* rtl:end:freeze */ directives respectively. These directives will prefix the targeted rules or declarations with the current direction but will not create an RTL counterpart (same result as the remove ones in RTLCSS).
      6. -
      -
      - -

      The breadcrumb case

      -

      The breadcrumb separator is the only case requiring its own brand-new variable— namely $breadcrumb-divider-flipped —defaulting to $breadcrumb-divider.

      -

      Additional resources

      +
    1. Having a single bundle with both directions will increase the size of the final stylesheet (on average, by 20%-30%): consider some optimization.
    2. +
    3. Take into account that PostCSS RTLCSS is not compatible with /* rtl:remove */ directives because it doesn’t remove any CSS rule. You should replace your /* rtl:remove */, /* rtl:begin:remove */ and /* rtl:end:remove */ directives with /* rtl:freeze */, /* rtl:begin:freeze */ and /* rtl:end:freeze */ directives respectively. These directives will prefix the targeted rules or declarations with the current direction but will not create an RTL counterpart (same result as the remove ones in RTLCSS).
    4. +
    +

    The breadcrumb case

    +

    The breadcrumb separator is the only case requiring its own brand-new variable— namely $breadcrumb-divider-flipped —defaulting to $breadcrumb-divider.

    +

    Additional resources

    - -
    -
    -
    - - - - - - - - - - - - - - - +
    \ No newline at end of file diff --git a/docs/5.3/getting-started/vite/index.html b/docs/5.3/getting-started/vite/index.html index 84e6e19eb6..9e38ae3a58 100644 --- a/docs/5.3/getting-started/vite/index.html +++ b/docs/5.3/getting-started/vite/index.html @@ -1,771 +1,176 @@ - - - - - - - - - - - - - - - - -Bootstrap and Vite · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Bootstrap and Vite

    -
    -

    The official guide for how to include and bundle Bootstrap’s CSS and JavaScript in your project using Vite.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - - -
    -Want to skip to the end? Download the source code and working demo for this guide from the twbs/examples repository. You can also open the example in StackBlitz for live editing. -
    - -

    What is Vite?

    + Bootstrap and Vite · Bootstrap v5.3

    Bootstrap and Vite

    The official guide for how to include and bundle Bootstrap’s CSS and JavaScript in your project using Vite.

    +
    +

    Want to skip to the end? Download the source code and working demo for this guide from the twbs/examples repository. You can also open the example in StackBlitz for live editing.

    +

    What is Vite?

    Vite is a modern frontend build tool designed for speed and simplicity. It provides an efficient and streamlined development experience, especially for modern JavaScript frameworks.

    -

    Setup

    -

    We’re building a Vite project with Bootstrap from scratch, so there are some prerequisites and upfront steps before we can really get started. This guide requires you to have Node.js installed and some familiarity with the terminal.

    +

    Setup

    +

    We’re building a Vite project with Bootstrap from scratch, so there are some prerequisites and upfront steps before we can really get started. This guide requires you to have Node.js installed and some familiarity with the terminal.

    1. -

      Create a project folder and set up npm. We’ll create the my-project folder and initialize npm with the -y argument to avoid it asking us all the interactive questions.

      -
      mkdir my-project && cd my-project
      -npm init -y
      -
    2. +

      Create a project folder and set up npm. We'll create the my-project folder and initialize npm with the -y argument to avoid it asking us all the interactive questions.

      +
      mkdir my-project && cd my-project
      +npm init -y
      +
      +
    3. Install Vite. Unlike our Webpack guide, there’s only a single build tool dependency here. We use --save-dev to signal that this dependency is only for development use and not for production.

      -
      npm i --save-dev vite
      -
    4. +
      npm i --save-dev vite
      +
      +
    5. -

      Install Bootstrap. Now we can install Bootstrap. We’ll also install Popper since our dropdowns, popovers, and tooltips depend on it for their positioning. If you don’t plan on using those components, you can omit Popper here.

      -
      npm i --save bootstrap @popperjs/core
      -
    6. +

      Install Bootstrap. Now we can install Bootstrap. We'll also install Popper since our dropdowns, popovers, and tooltips depend on it for their positioning. If you don’t plan on using those components, you can omit Popper here.

      +
      npm i --save bootstrap @popperjs/core
      +
      +
    7. -

      Install additional dependency. In addition to Vite and Bootstrap, we need another dependency (Sass) to properly import and bundle Bootstrap’s CSS.

      -
      npm i --save-dev sass
      -
    8. +

      Install additional dependency. In addition to Vite and Bootstrap, we need another dependency (Sass) to properly import and bundle Bootstrap’s CSS.

      +
      npm i --save-dev sass
      +
      +

    Now that we have all the necessary dependencies installed and set up, we can get to work creating the project files and importing Bootstrap.

    -

    Project structure

    -

    We’ve already created the my-project folder and initialized npm. Now we’ll also create our src folder, stylesheet, and JavaScript file to round out the project structure. Run the following from my-project, or manually create the folder and file structure shown below.

    -
    mkdir {src,src/js,src/scss}
    -touch src/index.html src/js/main.js src/scss/styles.scss vite.config.js
    -

    When you’re done, your complete project should look like this:

    -
    my-project/
    -├── src/
    -│   ├── js/
    -│   │   └── main.js
    -│   └── scss/
    -│   |   └── styles.scss
    -|   └── index.html
    -├── package-lock.json
    -├── package.json
    -└── vite.config.js
    -

    At this point, everything is in the right place, but Vite won’t work because we haven’t filled in our vite.config.js yet.

    -

    Configure Vite

    +

    Project structure

    +

    We’ve already created the my-project folder and initialized npm. Now we'll also create our src folder, stylesheet, and JavaScript file to round out the project structure. Run the following from my-project, or manually create the folder and file structure shown below.

    +
    mkdir {src,src/js,src/scss}
    +touch src/index.html src/js/main.js src/scss/styles.scss vite.config.js
    +
    +

    When you’re done, your complete project should look like this:

    +
    my-project/
    +├── src/
    +│   ├── js/
    +│   │   └── main.js
    +│   └── scss/
    +│   |   └── styles.scss
    +|   └── index.html
    +├── package-lock.json
    +├── package.json
    +└── vite.config.js
    +
    +

    At this point, everything is in the right place, but Vite won’t work because we haven’t filled in our vite.config.js yet.

    +

    Configure Vite

    With dependencies installed and our project folder ready for us to start coding, we can now configure Vite and run our project locally.

    1. -

      Open vite.config.js in your editor. Since it’s blank, we’ll need to add some boilerplate config to it so we can start our server. This part of the config tells Vite where to look for our project’s JavaScript and how the development server should behave (pulling from the src folder with hot reload).

      - -
      import { resolve } from 'path'
      -
      -export default {
      -  root: resolve(__dirname, 'src'),
      -  build: {
      -    outDir: '../dist'
      -  },
      -  server: {
      -    port: 8080
      -  }
      -}
      -
    2. -
    3. -

      Next we fill in src/index.html. This is the HTML page Vite will load in the browser to utilize the bundled CSS and JS we’ll add to it in later steps.

      -
      <!doctype html>
      -<html lang="en">
      -  <head>
      -    <meta charset="utf-8">
      -    <meta name="viewport" content="width=device-width, initial-scale=1">
      -    <title>Bootstrap w/ Vite</title>
      -    <script type="module" src="./js/main.js"></script>
      -  </head>
      -  <body>
      -    <div class="container py-4 px-3 mx-auto">
      -      <h1>Hello, Bootstrap and Vite!</h1>
      -      <button class="btn btn-primary">Primary button</button>
      -    </div>
      -  </body>
      -</html>
      -

      We’re including a little bit of Bootstrap styling here with the div class="container" and <button> so that we see when Bootstrap’s CSS is loaded by Vite.

      +

      Open vite.config.js in your editor. Since it’s blank, we'll need to add some boilerplate config to it so we can start our server. This part of the config tells Vite where to look for our project’s JavaScript and how the development server should behave (pulling from the src folder with hot reload).

      +
      import { resolve } from 'path'
      +
      +export default {
      +  root: resolve(__dirname, 'src'),
      +  build: {
      +    outDir: '../dist'
      +  },
      +  server: {
      +    port: 8080
      +  },
      +  // Optional: Silence Sass deprecation warnings. See note below.
      +  css: {
      +     preprocessorOptions: {
      +        scss: {
      +          silenceDeprecations: [
      +            'import',
      +            'mixed-decls',
      +            'color-functions',
      +            'global-builtin',
      +          ],
      +        },
      +     },
      +  },
      +}
      +
      +

      Note: Sass deprecation warnings are shown when compiling source Sass files with the latest versions of Dart Sass. This does not prevent compilation or usage of Bootstrap. We’re working on a long-term fix, but in the meantime these deprecation notices can be ignored.

    4. -

      Now we need an npm script to run Vite. Open package.json and add the start script shown below (you should already have the test script). We’ll use this script to start our local Vite dev server.

      -
      {
      -  // ...
      -  "scripts": {
      -    "start": "vite",
      -    "test": "echo \"Error: no test specified\" && exit 1"
      -  },
      -  // ...
      -}
      -
    5. +

      Next we fill in src/index.html. This is the HTML page Vite will load in the browser to utilize the bundled CSS and JS we'll add to it in later steps.

      +
      <!doctype html>
      +<html lang="en">
      +  <head>
      +    <meta charset="utf-8">
      +    <meta name="viewport" content="width=device-width, initial-scale=1">
      +    <title>Bootstrap w/ Vite</title>
      +    <script type="module" src="./js/main.js"></script>
      +  </head>
      +  <body>
      +    <div class="container py-4 px-3 mx-auto">
      +      <h1>Hello, Bootstrap and Vite!</h1>
      +      <button class="btn btn-primary">Primary button</button>
      +    </div>
      +  </body>
      +</html>
      +
      +

      We’re including a little bit of Bootstrap styling here with the div class="container" and <button> so that we see when Bootstrap’s CSS is loaded by Vite.

      + +
    6. +

      Now we need an npm script to run Vite. Open package.json and add the start script shown below (you should already have the test script). We'll use this script to start our local Vite dev server.

      +
      {
      +  // ...
      +  "scripts": {
      +    "start": "vite",
      +    "test": "echo \"Error: no test specified\" && exit 1"
      +  },
      +  // ...
      +}
      +
      +
    7. And finally, we can start Vite. From the my-project folder in your terminal, run that newly added npm script:

      -
      npm start
      -

      Vite dev server running -

      +
      npm start
      +
      +Vite dev server running

    In the next and final section to this guide, we’ll import all of Bootstrap’s CSS and JavaScript.

    -

    Import Bootstrap

    +

    Import Bootstrap

    1. -

      Import Bootstrap’s CSS. Add the following to src/scss/styles.scss to import all of Bootstrap’s source Sass.

      -
      // Import all of Bootstrap's CSS
      -@import "bootstrap/scss/bootstrap";
      -

      You can also import our stylesheets individually if you want. Read our Sass import docs for details.

      +

      Import Bootstrap’s CSS. Add the following to src/scss/styles.scss to import all of Bootstrap’s source Sass.

      +
      // Import all of Bootstrap’s CSS
      +@import "bootstrap/scss/bootstrap";
      +
      +

      You can also import our stylesheets individually if you want. Read our Sass import docs for details.

    2. -

      Next we load the CSS and import Bootstrap’s JavaScript. Add the following to src/js/main.js to load the CSS and import all of Bootstrap’s JS. Popper will be imported automatically through Bootstrap.

      - -
      // Import our custom CSS
      -import '../scss/styles.scss'
      -
      -// Import all of Bootstrap's JS
      -import * as bootstrap from 'bootstrap'
      -

      You can also import JavaScript plugins individually as needed to keep bundle sizes down:

      - -
      import Alert from 'bootstrap/js/dist/alert';
      -
      -// or, specify which plugins you need:
      -import { Tooltip, Toast, Popover } from 'bootstrap';
      -

      Read our JavaScript docs for more information on how to use Bootstrap’s plugins.

      +

      Next we load the CSS and import Bootstrap’s JavaScript. Add the following to src/js/main.js to load the CSS and import all of Bootstrap’s JS. Popper will be imported automatically through Bootstrap.

      +
      // Import our custom CSS
      +import '../scss/styles.scss'
      +
      +// Import all of Bootstrap’s JS
      +import * as bootstrap from 'bootstrap'
      +
      +

      You can also import JavaScript plugins individually as needed to keep bundle sizes down:

      +
      import Alert from 'bootstrap/js/dist/alert';
      +
      +// or, specify which plugins you need:
      +import { Tooltip, Toast, Popover } from 'bootstrap';
      +
      +

      Read our JavaScript docs for more information on how to use Bootstrap’s plugins.

    3. -

      And you’re done! 🎉 With Bootstrap’s source Sass and JS fully loaded, your local development server should now look like this:

      -

      Vite dev server running with Bootstrap -

      -

      Now you can start adding any Bootstrap components you want to use. Be sure to check out the complete Vite example project for how to include additional custom Sass and optimize your build by importing only the parts of Bootstrap’s CSS and JS that you need.

      +

      And you’re done! 🎉 With Bootstrap’s source Sass and JS fully loaded, your local development server should now look like this:

      +Vite dev server running with Bootstrap +

      Now you can start adding any Bootstrap components you want to use. Be sure to check out the complete Vite example project for how to include additional custom Sass and optimize your build by importing only the parts of Bootstrap’s CSS and JS that you need.

    -
    -

    See something wrong or out of date here? Please open an issue on GitHub. Need help troubleshooting? Search or start a discussion on GitHub.

    - -
    -
    -
    - - - - - - - - - - - - - - - +
    +

    See something wrong or out of date here? Please open an issue on GitHub. Need help troubleshooting? Search or start a discussion on GitHub.

    \ No newline at end of file diff --git a/docs/5.3/getting-started/webpack/index.html b/docs/5.3/getting-started/webpack/index.html index afca9aad08..e9d9c86f17 100644 --- a/docs/5.3/getting-started/webpack/index.html +++ b/docs/5.3/getting-started/webpack/index.html @@ -1,915 +1,322 @@ - - - - - - - - - - - - - - - - -Bootstrap and Webpack · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Bootstrap and Webpack

    -
    -

    The official guide for how to include and bundle Bootstrap’s CSS and JavaScript in your project using Webpack.

    - - -
    - - - - - -
    - - - -
    -Want to skip to the end? Download the source code and working demo for this guide from the twbs/examples repository. You can also open the example in StackBlitz for live editing. -
    - -

    What is Webpack?

    + Bootstrap and Webpack · Bootstrap v5.3

    Bootstrap and Webpack

    The official guide for how to include and bundle Bootstrap’s CSS and JavaScript in your project using Webpack.

    +
    +

    Want to skip to the end? Download the source code and working demo for this guide from the twbs/examples repository. You can also open the example in StackBlitz for live editing.

    +

    What is Webpack?

    Webpack is a JavaScript module bundler that processes modules and their dependencies to generate static assets. It simplifies managing complex web applications with multiple files and dependencies.

    -

    Setup

    -

    We’re building a Webpack project with Bootstrap from scratch, so there are some prerequisites and upfront steps before we can really get started. This guide requires you to have Node.js installed and some familiarity with the terminal.

    +

    Setup

    +

    We’re building a Webpack project with Bootstrap from scratch, so there are some prerequisites and upfront steps before we can really get started. This guide requires you to have Node.js installed and some familiarity with the terminal.

    1. -

      Create a project folder and set up npm. We’ll create the my-project folder and initialize npm with the -y argument to avoid it asking us all the interactive questions.

      -
      mkdir my-project && cd my-project
      -npm init -y
      -
    2. +

      Create a project folder and set up npm. We'll create the my-project folder and initialize npm with the -y argument to avoid it asking us all the interactive questions.

      +
      mkdir my-project && cd my-project
      +npm init -y
      +
      +
    3. -

      Install Webpack. Next we need to install our Webpack development dependencies: webpack for the core of Webpack, webpack-cli so we can run Webpack commands from the terminal, and webpack-dev-server so we can run a local development server. Additionally, we’ll install html-webpack-plugin to be able to store our index.html in src directory instead of the default dist one. We use --save-dev to signal that these dependencies are only for development use and not for production.

      -
      npm i --save-dev webpack webpack-cli webpack-dev-server html-webpack-plugin
      -
    4. +

      Install Webpack. Next we need to install our Webpack development dependencies: webpack for the core of Webpack, webpack-cli so we can run Webpack commands from the terminal, and webpack-dev-server so we can run a local development server. Additionally, we'll install html-webpack-plugin to be able to store our index.html in src directory instead of the default dist one. We use --save-dev to signal that these dependencies are only for development use and not for production.

      +
      npm i --save-dev webpack webpack-cli webpack-dev-server html-webpack-plugin
      +
      +
    5. -

      Install Bootstrap. Now we can install Bootstrap. We’ll also install Popper since our dropdowns, popovers, and tooltips depend on it for their positioning. If you don’t plan on using those components, you can omit Popper here.

      -
      npm i --save bootstrap @popperjs/core
      -
    6. +

      Install Bootstrap. Now we can install Bootstrap. We'll also install Popper since our dropdowns, popovers, and tooltips depend on it for their positioning. If you don’t plan on using those components, you can omit Popper here.

      +
      npm i --save bootstrap @popperjs/core
      +
      +
    7. -

      Install additional dependencies. In addition to Webpack and Bootstrap, we need a few more dependencies to properly import and bundle Bootstrap’s CSS and JS with Webpack. These include Sass, some loaders, and Autoprefixer.

      -
      npm i --save-dev autoprefixer css-loader postcss-loader sass sass-loader style-loader
      -
    8. +

      Install additional dependencies. In addition to Webpack and Bootstrap, we need a few more dependencies to properly import and bundle Bootstrap’s CSS and JS with Webpack. These include Sass, some loaders, and Autoprefixer.

      +
      npm i --save-dev autoprefixer css-loader postcss-loader sass sass-loader style-loader
      +
      +

    Now that we have all the necessary dependencies installed, we can get to work creating the project files and importing Bootstrap.

    -

    Project structure

    -

    We’ve already created the my-project folder and initialized npm. Now we’ll also create our src and dist folders to round out the project structure. Run the following from my-project, or manually create the folder and file structure shown below.

    -
    mkdir {src,src/js,src/scss}
    -touch src/index.html src/js/main.js src/scss/styles.scss webpack.config.js
    -

    When you’re done, your complete project should look like this:

    -
    my-project/
    -├── src/
    -│   ├── js/
    -│   │   └── main.js
    -│   ├── scss/
    -│   │   └── styles.scss
    -│   └── index.html
    -├── package-lock.json
    -├── package.json
    -└── webpack.config.js
    -

    At this point, everything is in the right place, but Webpack won’t work because we haven’t filled in our webpack.config.js yet.

    -

    Configure Webpack

    +

    Project structure

    +

    We’ve already created the my-project folder and initialized npm. Now we'll also create our src and dist folders to round out the project structure. Run the following from my-project, or manually create the folder and file structure shown below.

    +
    mkdir {src,src/js,src/scss}
    +touch src/index.html src/js/main.js src/scss/styles.scss webpack.config.js
    +
    +

    When you’re done, your complete project should look like this:

    +
    my-project/
    +├── src/
    +│   ├── js/
    +│   │   └── main.js
    +│   ├── scss/
    +│   │   └── styles.scss
    +│   └── index.html
    +├── package-lock.json
    +├── package.json
    +└── webpack.config.js
    +
    +

    At this point, everything is in the right place, but Webpack won’t work because we haven’t filled in our webpack.config.js yet.

    +

    Configure Webpack

    With dependencies installed and our project folder ready for us to start coding, we can now configure Webpack and run our project locally.

    1. -

      Open webpack.config.js in your editor. Since it’s blank, we’ll need to add some boilerplate config to it so we can start our server. This part of the config tells Webpack where to look for our project’s JavaScript, where to output the compiled code to (dist), and how the development server should behave (pulling from the dist folder with hot reload).

      -
      'use strict'
      -
      -const path = require('path')
      -const HtmlWebpackPlugin = require('html-webpack-plugin')
      -
      -module.exports = {
      -  mode: 'development',
      -  entry: './src/js/main.js',
      -  output: {
      -    filename: 'main.js',
      -    path: path.resolve(__dirname, 'dist')
      -  },
      -  devServer: {
      -    static: path.resolve(__dirname, 'dist'),
      -    port: 8080,
      -    hot: true
      -  },
      -  plugins: [
      -    new HtmlWebpackPlugin({ template: './src/index.html' })
      -  ]
      -}
      -
    2. -
    3. -

      Next we fill in our src/index.html. This is the HTML page Webpack will load in the browser to utilize the bundled CSS and JS we’ll add to it in later steps. Before we can do that, we have to give it something to render and include the output JS from the previous step.

      -
      <!doctype html>
      -<html lang="en">
      -  <head>
      -    <meta charset="utf-8">
      -    <meta name="viewport" content="width=device-width, initial-scale=1">
      -    <title>Bootstrap w/ Webpack</title>
      -  </head>
      -  <body>
      -    <div class="container py-4 px-3 mx-auto">
      -      <h1>Hello, Bootstrap and Webpack!</h1>
      -      <button class="btn btn-primary">Primary button</button>
      -    </div>
      -  </body>
      -</html>
      -

      We’re including a little bit of Bootstrap styling here with the div class="container" and <button> so that we see when Bootstrap’s CSS is loaded by Webpack.

      +

      Open webpack.config.js in your editor. Since it’s blank, we'll need to add some boilerplate config to it so we can start our server. This part of the config tells Webpack where to look for our project’s JavaScript, where to output the compiled code to (dist), and how the development server should behave (pulling from the dist folder with hot reload).

      +
      'use strict'
      +
      +const path = require('path')
      +const HtmlWebpackPlugin = require('html-webpack-plugin')
      +
      +module.exports = {
      +  mode: 'development',
      +  entry: './src/js/main.js',
      +  output: {
      +    filename: 'main.js',
      +    path: path.resolve(__dirname, 'dist')
      +  },
      +  devServer: {
      +    static: path.resolve(__dirname, 'dist'),
      +    port: 8080,
      +    hot: true
      +  },
      +  plugins: [
      +    new HtmlWebpackPlugin({ template: './src/index.html' })
      +  ]
      +}
      +
    4. -

      Now we need an npm script to run Webpack. Open package.json and add the start script shown below (you should already have the test script). We’ll use this script to start our local Webpack dev server. You can also add a build script shown below to build your project.

      -
      {
      -  // ...
      -  "scripts": {
      -    "start": "webpack serve",
      -    "build": "webpack build --mode=production",
      -    "test": "echo \"Error: no test specified\" && exit 1"
      -  },
      -  // ...
      -}
      -
    5. +

      Next we fill in our src/index.html. This is the HTML page Webpack will load in the browser to utilize the bundled CSS and JS we'll add to it in later steps. Before we can do that, we have to give it something to render and include the output JS from the previous step.

      +
      <!doctype html>
      +<html lang="en">
      +  <head>
      +    <meta charset="utf-8">
      +    <meta name="viewport" content="width=device-width, initial-scale=1">
      +    <title>Bootstrap w/ Webpack</title>
      +  </head>
      +  <body>
      +    <div class="container py-4 px-3 mx-auto">
      +      <h1>Hello, Bootstrap and Webpack!</h1>
      +      <button class="btn btn-primary">Primary button</button>
      +    </div>
      +  </body>
      +</html>
      +
      +

      We’re including a little bit of Bootstrap styling here with the div class="container" and <button> so that we see when Bootstrap’s CSS is loaded by Webpack.

      + +
    6. +

      Now we need an npm script to run Webpack. Open package.json and add the start script shown below (you should already have the test script). We'll use this script to start our local Webpack dev server. You can also add a build script shown below to build your project.

      +
      {
      +  // ...
      +  "scripts": {
      +    "start": "webpack serve",
      +    "build": "webpack build --mode=production",
      +    "test": "echo \"Error: no test specified\" && exit 1"
      +  },
      +  // ...
      +}
      +
      +
    7. And finally, we can start Webpack. From the my-project folder in your terminal, run that newly added npm script:

      -
      npm start
      -

      Webpack dev server running -

      +
      npm start
      +
      +Webpack dev server running
    -

    In the next and final section to this guide, we’ll set up the Webpack loaders and import all of Bootstrap’s CSS and JavaScript.

    -

    Import Bootstrap

    -

    Importing Bootstrap into Webpack requires the loaders we installed in the first section. We’ve installed them with npm, but now Webpack needs to be configured to use them.

    +

    In the next and final section to this guide, we'll set up the Webpack loaders and import all of Bootstrap’s CSS and JavaScript.

    +

    Import Bootstrap

    +

    Importing Bootstrap into Webpack requires the loaders we installed in the first section. We’ve installed them with npm, but now Webpack needs to be configured to use them.

    1. Set up the loaders in webpack.config.js. Your configuration file is now complete and should match the snippet below. The only new part here is the module section.

      -
      'use strict'
      -
      -const path = require('path')
      -const autoprefixer = require('autoprefixer')
      -const HtmlWebpackPlugin = require('html-webpack-plugin')
      -
      -module.exports = {
      -  mode: 'development',
      -  entry: './src/js/main.js',
      -  output: {
      -    filename: 'main.js',
      -    path: path.resolve(__dirname, 'dist')
      -  },
      -  devServer: {
      -    static: path.resolve(__dirname, 'dist'),
      -    port: 8080,
      -    hot: true
      -  },
      -  plugins: [
      -    new HtmlWebpackPlugin({ template: './src/index.html' })
      -  ],
      -  module: {
      -    rules: [
      -      {
      -        test: /\.(scss)$/,
      -        use: [
      -          {
      -            // Adds CSS to the DOM by injecting a `<style>` tag
      -            loader: 'style-loader'
      -          },
      -          {
      -            // Interprets `@import` and `url()` like `import/require()` and will resolve them
      -            loader: 'css-loader'
      -          },
      -          {
      -            // Loader for webpack to process CSS with PostCSS
      -            loader: 'postcss-loader',
      -            options: {
      -              postcssOptions: {
      -                plugins: [
      -                  autoprefixer
      -                ]
      -              }
      -            }
      -          },
      -          {
      -            // Loads a SASS/SCSS file and compiles it to CSS
      -            loader: 'sass-loader'
      -          }
      -        ]
      -      }
      -    ]
      -  }
      -}
      -

      Here’s a recap of why we need all these loaders. style-loader injects the CSS into a <style> element in the <head> of the HTML page, css-loader helps with using @import and url(), postcss-loader is required for Autoprefixer, and sass-loader allows us to use Sass.

      +
      'use strict'
      +
      +const path = require('path')
      +const autoprefixer = require('autoprefixer')
      +const HtmlWebpackPlugin = require('html-webpack-plugin')
      +
      +module.exports = {
      +  mode: 'development',
      +  entry: './src/js/main.js',
      +  output: {
      +    filename: 'main.js',
      +    path: path.resolve(__dirname, 'dist')
      +  },
      +  devServer: {
      +    static: path.resolve(__dirname, 'dist'),
      +    port: 8080,
      +    hot: true
      +  },
      +  plugins: [
      +    new HtmlWebpackPlugin({ template: './src/index.html' })
      +  ],
      +  module: {
      +    rules: [
      +      {
      +        test: /\.(scss)$/,
      +        use: [
      +          {
      +            // Adds CSS to the DOM by injecting a `<style>` tag
      +            loader: 'style-loader'
      +          },
      +          {
      +            // Interprets `@import` and `url()` like `import/require()` and will resolve them
      +            loader: 'css-loader'
      +          },
      +          {
      +            // Loader for webpack to process CSS with PostCSS
      +            loader: 'postcss-loader',
      +            options: {
      +              postcssOptions: {
      +                plugins: [
      +                  autoprefixer
      +                ]
      +              }
      +            }
      +          },
      +          {
      +            // Loads a SASS/SCSS file and compiles it to CSS
      +            loader: 'sass-loader',
      +            options: {
      +              sassOptions: {
      +                // Optional: Silence Sass deprecation warnings. See note below.
      +                silenceDeprecations: [
      +                  'mixed-decls',
      +                  'color-functions',
      +                  'global-builtin',
      +                  'import'
      +                ]
      +              }
      +            }
      +          }
      +        ]
      +      }
      +    ]
      +  }
      +}
      +
      +

      Here’s a recap of why we need all these loaders. style-loader injects the CSS into a <style> element in the <head> of the HTML page, css-loader helps with using @import and url(), postcss-loader is required for Autoprefixer, and sass-loader allows us to use Sass.

      +

      Note: Sass deprecation warnings are shown when compiling source Sass files with the latest versions of Dart Sass. This does not prevent compilation or usage of Bootstrap. We’re working on a long-term fix, but in the meantime these deprecation notices can be ignored.

    2. -

      Now, let’s import Bootstrap’s CSS. Add the following to src/scss/styles.scss to import all of Bootstrap’s source Sass.

      -
      // Import all of Bootstrap's CSS
      -@import "bootstrap/scss/bootstrap";
      -

      You can also import our stylesheets individually if you want. Read our Sass import docs for details.

      +

      Now, let’s import Bootstrap’s CSS. Add the following to src/scss/styles.scss to import all of Bootstrap’s source Sass.

      +
      // Import all of Bootstrap’s CSS
      +@import "bootstrap/scss/bootstrap";
      +
      +

      You can also import our stylesheets individually if you want. Read our Sass import docs for details.

    3. -

      Next we load the CSS and import Bootstrap’s JavaScript. Add the following to src/js/main.js to load the CSS and import all of Bootstrap’s JS. Popper will be imported automatically through Bootstrap.

      - -
      // Import our custom CSS
      -import '../scss/styles.scss'
      -
      -// Import all of Bootstrap's JS
      -import * as bootstrap from 'bootstrap'
      -

      You can also import JavaScript plugins individually as needed to keep bundle sizes down:

      - -
      import Alert from 'bootstrap/js/dist/alert'
      -
      -// or, specify which plugins you need:
      -import { Tooltip, Toast, Popover } from 'bootstrap'
      -

      Read our JavaScript docs for more information on how to use Bootstrap’s plugins.

      +

      Next we load the CSS and import Bootstrap’s JavaScript. Add the following to src/js/main.js to load the CSS and import all of Bootstrap’s JS. Popper will be imported automatically through Bootstrap.

      +
      // Import our custom CSS
      +import '../scss/styles.scss'
      +
      +// Import all of Bootstrap’s JS
      +import * as bootstrap from 'bootstrap'
      +
      +

      You can also import JavaScript plugins individually as needed to keep bundle sizes down:

      +
      import Alert from 'bootstrap/js/dist/alert'
      +
      +// or, specify which plugins you need:
      +import { Tooltip, Toast, Popover } from 'bootstrap'
      +
      +

      Read our JavaScript docs for more information on how to use Bootstrap’s plugins.

    4. -

      And you’re done! 🎉 With Bootstrap’s source Sass and JS fully loaded, your local development server should now look like this:

      -

      Webpack dev server running with Bootstrap -

      -

      Now you can start adding any Bootstrap components you want to use. Be sure to check out the complete Webpack example project for how to include additional custom Sass and optimize your build by importing only the parts of Bootstrap’s CSS and JS that you need.

      +

      And you’re done! 🎉 With Bootstrap’s source Sass and JS fully loaded, your local development server should now look like this:

      +Webpack dev server running with Bootstrap +

      Now you can start adding any Bootstrap components you want to use. Be sure to check out the complete Webpack example project for how to include additional custom Sass and optimize your build by importing only the parts of Bootstrap’s CSS and JS that you need.

    -

    Production optimizations

    +

    Production optimizations

    Depending on your setup, you may want to implement some additional security and speed optimizations useful for running the project in production. Note that these optimizations are not applied on the Webpack example project and are up to you to implement.

    -

    Extracting CSS

    -

    The style-loader we configured above conveniently emits CSS into the bundle so that manually loading a CSS file in dist/index.html isn’t necessary. This approach may not work with a strict Content Security Policy, however, and it may become a bottleneck in your application due to the large bundle size.

    +

    Extracting CSS

    +

    The style-loader we configured above conveniently emits CSS into the bundle so that manually loading a CSS file in dist/index.html isn’t necessary. This approach may not work with a strict Content Security Policy, however, and it may become a bottleneck in your application due to the large bundle size.

    To separate the CSS so that we can load it directly from dist/index.html, use the mini-css-extract-loader Webpack plugin.

    First, install the plugin:

    -
    npm install --save-dev mini-css-extract-plugin
    -

    Then instantiate and use the plugin in the Webpack configuration:

    -
    --- a/webpack.config.js
    -+++ b/webpack.config.js
    -@@ -3,6 +3,7 @@
    - const path = require('path')
    - const autoprefixer = require('autoprefixer')
    - const HtmlWebpackPlugin = require('html-webpack-plugin')
    -+const miniCssExtractPlugin = require('mini-css-extract-plugin')
    -
    - module.exports = {
    -   mode: 'development',
    -@@ -17,7 +18,8 @@ module.exports = {
    -     hot: true
    -   },
    -   plugins: [
    --    new HtmlWebpackPlugin({ template: './src/index.html' })
    -+    new HtmlWebpackPlugin({ template: './src/index.html' }),
    -+    new miniCssExtractPlugin()
    -   ],
    -   module: {
    -     rules: [
    -@@ -25,8 +27,8 @@ module.exports = {
    -         test: /\.(scss)$/,
    -         use: [
    -           {
    --            // Adds CSS to the DOM by injecting a `<style>` tag
    --            loader: 'style-loader'
    -+            // Extracts CSS for each JS file that includes CSS
    -+            loader: miniCssExtractPlugin.loader
    -           },
    -           {
    -

    After running npm run build again, there will be a new file dist/main.css, which will contain all of the CSS imported by src/js/main.js. If you view dist/index.html in your browser now, the style will be missing, as it is now in dist/main.css. You can include the generated CSS in dist/index.html like this:

    -
    --- a/dist/index.html
    -+++ b/dist/index.html
    -@@ -3,6 +3,7 @@
    -   <head>
    -     <meta charset="utf-8">
    -     <meta name="viewport" content="width=device-width, initial-scale=1">
    -+    <link rel="stylesheet" href="./main.css">
    -     <title>Bootstrap w/ Webpack</title>
    -   </head>
    -   <body>
    -

    Extracting SVG files

    -

    Bootstrap’s CSS includes multiple references to SVG files via inline data: URIs. If you define a Content Security Policy for your project that blocks data: URIs for images, then these SVG files will not load. You can get around this problem by extracting the inline SVG files using Webpack’s asset modules feature.

    +
    npm install --save-dev mini-css-extract-plugin
    +
    +

    Then instantiate and use the plugin in the Webpack configuration:

    +
    --- a/webpack.config.js
    ++++ b/webpack.config.js
    +@@ -3,6 +3,7 @@
    + const path = require('path')
    + const autoprefixer = require('autoprefixer')
    + const HtmlWebpackPlugin = require('html-webpack-plugin')
    ++const miniCssExtractPlugin = require('mini-css-extract-plugin')
    +
    + module.exports = {
    +   mode: 'development',
    +@@ -17,7 +18,8 @@ module.exports = {
    +     hot: true
    +   },
    +   plugins: [
    +-    new HtmlWebpackPlugin({ template: './src/index.html' })
    ++    new HtmlWebpackPlugin({ template: './src/index.html' }),
    ++    new miniCssExtractPlugin()
    +   ],
    +   module: {
    +     rules: [
    +@@ -25,8 +27,8 @@ module.exports = {
    +         test: /\.(scss)$/,
    +         use: [
    +           {
    +-            // Adds CSS to the DOM by injecting a `<style>` tag
    +-            loader: 'style-loader'
    ++            // Extracts CSS for each JS file that includes CSS
    ++            loader: miniCssExtractPlugin.loader
    +           },
    +           {
    +
    +

    After running npm run build again, there will be a new file dist/main.css, which will contain all of the CSS imported by src/js/main.js. If you view dist/index.html in your browser now, the style will be missing, as it is now in dist/main.css. You can include the generated CSS in dist/index.html like this:

    +
    --- a/dist/index.html
    ++++ b/dist/index.html
    +@@ -3,6 +3,7 @@
    +   <head>
    +     <meta charset="utf-8">
    +     <meta name="viewport" content="width=device-width, initial-scale=1">
    ++    <link rel="stylesheet" href="./main.css">
    +     <title>Bootstrap w/ Webpack</title>
    +   </head>
    +   <body>
    +
    +

    Extracting SVG files

    +

    Bootstrap’s CSS includes multiple references to SVG files via inline data: URIs. If you define a Content Security Policy for your project that blocks data: URIs for images, then these SVG files will not load. You can get around this problem by extracting the inline SVG files using Webpack’s asset modules feature.

    Configure Webpack to extract inline SVG files like this:

    -
    --- a/webpack.config.js
    -+++ b/webpack.config.js
    -@@ -23,6 +23,14 @@ module.exports = {
    -   },
    -   module: {
    -     rules: [
    -+      {
    -+        mimetype: 'image/svg+xml',
    -+        scheme: 'data',
    -+        type: 'asset/resource',
    -+        generator: {
    -+          filename: 'icons/[hash].svg'
    -+        }
    -+      },
    -       {
    -         test: /\.(scss)$/,
    -         use: [
    -

    After running npm run build again, you’ll find the SVG files extracted into dist/icons and properly referenced from CSS.

    -
    -

    See something wrong or out of date here? Please open an issue on GitHub. Need help troubleshooting? Search or start a discussion on GitHub.

    - -
    -
    -
    - - - - - - - - - - - - - - - +
    --- a/webpack.config.js
    ++++ b/webpack.config.js
    +@@ -23,6 +23,14 @@ module.exports = {
    +   },
    +   module: {
    +     rules: [
    ++      {
    ++        mimetype: 'image/svg+xml',
    ++        scheme: 'data',
    ++        type: 'asset/resource',
    ++        generator: {
    ++          filename: 'icons/[hash].svg'
    ++        }
    ++      },
    +       {
    +         test: /\.(scss)$/,
    +         use: [
    +
    +

    After running npm run build again, you’ll find the SVG files extracted into dist/icons and properly referenced from CSS.

    +
    +

    See something wrong or out of date here? Please open an issue on GitHub. Need help troubleshooting? Search or start a discussion on GitHub.

    \ No newline at end of file diff --git a/docs/5.3/helpers/clearfix/index.html b/docs/5.3/helpers/clearfix/index.html index de1a7e9fb0..98404bc58d 100644 --- a/docs/5.3/helpers/clearfix/index.html +++ b/docs/5.3/helpers/clearfix/index.html @@ -1,666 +1,51 @@ - - - - - - - - - - - - - - - - -Clearfix · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Clearfix

    -
    -

    Quickly and easily clear floated content within a container by adding a clearfix utility.

    - - -
    - - - -
    - - -

    Easily clear floats by adding .clearfix to the parent element. Can also be used as a mixin.

    + Clearfix · Bootstrap v5.3

    Quickly and easily clear floated content within a container by adding a clearfix utility.

    +

    Easily clear floats by adding .clearfix to the parent element. Can also be used as a mixin.

    Use in HTML:

    -
    <div class="clearfix">...</div>
    -

    The mixin source code:

    -
    -
    @mixin clearfix() {
    -  &::after {
    -    display: block;
    -    clear: both;
    -    content: "";
    -  }
    -}
    -
    +
    <div class="clearfix">...</div>
    +
    +

    The mixin source code:

    +
    @mixin clearfix() {
    +  &::after {
    +    display: block;
    +    clear: both;
    +    content: "";
    +  }
    +}
    +

    Use the mixin in SCSS:

    -
    .element {
    -  @include clearfix;
    -}
    -

    The following example shows how the clearfix can be used. Without the clearfix the wrapping div would not span around the buttons which would cause a broken layout.

    -
    -
    - -
    +
    .element {
    +  @include clearfix;
    +}
    +
    +

    The following example shows how the clearfix can be used. Without the clearfix the wrapping div would not span around the buttons which would cause a broken layout.

    +
    -
    - -
    - html -
    - - -
    -
    <div class="bg-info clearfix">
    -  <button type="button" class="btn btn-secondary float-start">Example Button floated left</button>
    -  <button type="button" class="btn btn-secondary float-end">Example Button floated right</button>
    -</div>
    -
    - - -
    -
    -
    - - - - - - - - - - - - - - - +
    html
    <div class="bg-info clearfix">
    +  <button type="button" class="btn btn-secondary float-start">Example Button floated left</button>
    +  <button type="button" class="btn btn-secondary float-end">Example Button floated right</button>
    +</div>
    \ No newline at end of file diff --git a/docs/5.3/helpers/color-background/index.html b/docs/5.3/helpers/color-background/index.html index 39497607b3..74d31740ef 100644 --- a/docs/5.3/helpers/color-background/index.html +++ b/docs/5.3/helpers/color-background/index.html @@ -1,740 +1,72 @@ - - - - - - - - - - - - - - - - -Color and background · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    -
    Added in v5.2 - View on GitHub - -
    -

    Color and background

    -
    -

    Set a background color with contrasting foreground color.

    - - -
    - - -
    - - On this page -
    -
    - -
    -
    - - -
    - - -

    Overview

    -

    Color and background helpers combine the power of our .text-* utilities and .bg-* utilities in one class. Using our Sass color-contrast() function, we automatically determine a contrasting color for a particular background-color.

    -
    -Heads up! There’s currently no support for a CSS-native color-contrast function, so we use our own via Sass. This means that customizing our theme colors via CSS variables may cause color contrast issues with these utilities. -
    - -
    -
    - - -
    Primary with contrasting color
    + Color and background · Bootstrap v5.3
    +Added in v5.2 +View on GitHub +

    Color and background

    Set a background color with contrasting foreground color.

    +
    On this page

    Overview

    +

    Color and background helpers combine the power of our .text-* utilities and .bg-* utilities in one class. Using our Sass color-contrast() function, we automatically determine a contrasting color for a particular background-color.

    +

    Heads up! There’s currently no support for a CSS-native color-contrast function, so we use our own via Sass. This means that customizing our theme colors via CSS variables may cause color contrast issues with these utilities.

    +
    Primary with contrasting color
    Secondary with contrasting color
    Success with contrasting color
    Danger with contrasting color
    Warning with contrasting color
    Info with contrasting color
    Light with contrasting color
    -
    Dark with contrasting color
    - -
    - html -
    - - -
    -
    <div class="text-bg-primary p-3">Primary with contrasting color</div>
    -<div class="text-bg-secondary p-3">Secondary with contrasting color</div>
    -<div class="text-bg-success p-3">Success with contrasting color</div>
    -<div class="text-bg-danger p-3">Danger with contrasting color</div>
    -<div class="text-bg-warning p-3">Warning with contrasting color</div>
    -<div class="text-bg-info p-3">Info with contrasting color</div>
    -<div class="text-bg-light p-3">Light with contrasting color</div>
    -<div class="text-bg-dark p-3">Dark with contrasting color</div>
    -
    - -
    -Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class. -
    - -

    With components

    -

    Use them in place of combined .text-* and .bg-* classes, like on badges:

    -
    -
    - -Primary -Info - -
    - html -
    - - -
    -
    <span class="badge text-bg-primary">Primary</span>
    -<span class="badge text-bg-info">Info</span>
    -
    - -

    Or on cards:

    -
    -
    - -
    +
    Dark with contrasting color
    html
    <div class="text-bg-primary p-3">Primary with contrasting color</div>
    +<div class="text-bg-secondary p-3">Secondary with contrasting color</div>
    +<div class="text-bg-success p-3">Success with contrasting color</div>
    +<div class="text-bg-danger p-3">Danger with contrasting color</div>
    +<div class="text-bg-warning p-3">Warning with contrasting color</div>
    +<div class="text-bg-info p-3">Info with contrasting color</div>
    +<div class="text-bg-light p-3">Light with contrasting color</div>
    +<div class="text-bg-dark p-3">Dark with contrasting color</div>
    +

    Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class.

    +

    With components

    +

    Use them in place of combined .text-* and .bg-* classes, like on badges:

    +
    Primary +Info
    html
    <span class="badge text-bg-primary">Primary</span>
    +<span class="badge text-bg-info">Info</span>
    +

    Or on cards:

    +
    Header
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Header
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    -
    - -
    - html -
    - - -
    -
    <div class="card text-bg-primary mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body">
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -<div class="card text-bg-info mb-3" style="max-width: 18rem;">
    -  <div class="card-header">Header</div>
    -  <div class="card-body">
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -  </div>
    -</div>
    -
    - - -
    -
    -
    - - - - - - - - - - - - - - - +
    html
    <div class="card text-bg-primary mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body">
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    +<div class="card text-bg-info mb-3" style="max-width: 18rem;">
    +  <div class="card-header">Header</div>
    +  <div class="card-body">
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +  </div>
    +</div>
    \ No newline at end of file diff --git a/docs/5.3/helpers/colored-links/index.html b/docs/5.3/helpers/colored-links/index.html index dd0a13c04d..f05ed2f6a4 100644 --- a/docs/5.3/helpers/colored-links/index.html +++ b/docs/5.3/helpers/colored-links/index.html @@ -1,571 +1,30 @@ - - - - - - - - - - - - - - - - -Colored links · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Colored links

    -
    -

    Colored links with hover states

    - - -
    - - -
    - - On this page -
    -
    - -
    -
    - - -
    - - - -

    You can use the .link-* classes to colorize links. Unlike the .text-* classes, these classes have a :hover and :focus state. Some of the link styles use a relatively light foreground color, and should only be used on a dark background in order to have sufficient contrast.

    -
    -Heads up! .link-body-emphasis is currently the only colored link that adapts to color modes. It’s treated as a special case until v6 arrives and we can more thoroughly rebuild our theme colors for color modes. Until then, it’s a unique, high-contrast link color with custom :hover and :focus styles. However, it still responds to the new link utilities. -
    - -
    -
    - - -

    Primary link

    + Colored links · Bootstrap v5.3

    Colored links

    Colored links with hover states

    +
    On this page
    +

    You can use the .link-* classes to colorize links. Unlike the .text-* classes, these classes have a :hover and :focus state. Some of the link styles use a relatively light foreground color, and should only be used on a dark background in order to have sufficient contrast.

    +

    Heads up! .link-body-emphasis is currently the only colored link that adapts to color modes. It’s treated as a special case until v6 arrives and we can more thoroughly rebuild our theme colors for color modes. Until then, it’s a unique, high-contrast link color with custom :hover and :focus styles. However, it still responds to the new link utilities.

    +
    - html -
    - - -
    -
    <p><a href="#" class="link-primary">Primary link</a></p>
    -<p><a href="#" class="link-secondary">Secondary link</a></p>
    -<p><a href="#" class="link-success">Success link</a></p>
    -<p><a href="#" class="link-danger">Danger link</a></p>
    -<p><a href="#" class="link-warning">Warning link</a></p>
    -<p><a href="#" class="link-info">Info link</a></p>
    -<p><a href="#" class="link-light">Light link</a></p>
    -<p><a href="#" class="link-dark">Dark link</a></p>
    -<p><a href="#" class="link-body-emphasis">Emphasis link</a></p>
    -
    - -
    -Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class. -
    - - +

    Emphasis link

    html
    <p><a href="#" class="link-primary">Primary link</a></p>
    +<p><a href="#" class="link-secondary">Secondary link</a></p>
    +<p><a href="#" class="link-success">Success link</a></p>
    +<p><a href="#" class="link-danger">Danger link</a></p>
    +<p><a href="#" class="link-warning">Warning link</a></p>
    +<p><a href="#" class="link-info">Info link</a></p>
    +<p><a href="#" class="link-light">Light link</a></p>
    +<p><a href="#" class="link-dark">Dark link</a></p>
    +<p><a href="#" class="link-body-emphasis">Emphasis link</a></p>
    +

    Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class.

    + Added in v5.3.0 -

    Colored links can also be modified by our link utilities.

    -
    -
    - - -

    Primary link

    +
    - html -
    - - -
    -
    <p><a href="#" class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Primary link</a></p>
    -<p><a href="#" class="link-secondary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Secondary link</a></p>
    -<p><a href="#" class="link-success link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Success link</a></p>
    -<p><a href="#" class="link-danger link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Danger link</a></p>
    -<p><a href="#" class="link-warning link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Warning link</a></p>
    -<p><a href="#" class="link-info link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Info link</a></p>
    -<p><a href="#" class="link-light link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Light link</a></p>
    -<p><a href="#" class="link-dark link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Dark link</a></p>
    -<p><a href="#" class="link-body-emphasis link-offset-2 link-underline-opacity-25 link-underline-opacity-75-hover">Emphasis link</a></p>
    -
    - - -
    -
    -
    - - - - - - - - - - - - - - - +

    Emphasis link

    html
    <p><a href="#" class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Primary link</a></p>
    +<p><a href="#" class="link-secondary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Secondary link</a></p>
    +<p><a href="#" class="link-success link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Success link</a></p>
    +<p><a href="#" class="link-danger link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Danger link</a></p>
    +<p><a href="#" class="link-warning link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Warning link</a></p>
    +<p><a href="#" class="link-info link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Info link</a></p>
    +<p><a href="#" class="link-light link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Light link</a></p>
    +<p><a href="#" class="link-dark link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Dark link</a></p>
    +<p><a href="#" class="link-body-emphasis link-offset-2 link-underline-opacity-25 link-underline-opacity-75-hover">Emphasis link</a></p>
    \ No newline at end of file diff --git a/docs/5.3/helpers/focus-ring/index.html b/docs/5.3/helpers/focus-ring/index.html index 1ede881352..b1691e020d 100644 --- a/docs/5.3/helpers/focus-ring/index.html +++ b/docs/5.3/helpers/focus-ring/index.html @@ -1,792 +1,83 @@ - - - - - - - - - - - - - - - - -Focus ring · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    -
    Added in v5.3 - View on GitHub - -
    -

    Focus ring

    -
    -

    Utility classes that allows you to add and modify custom focus ring styles to elements and components.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    The .focus-ring helper removes the default outline on :focus, replacing it with a box-shadow that can be more broadly customized. The new shadow is made up of a series of CSS variables, inherited from the :root level, that can be modified for any element or component.

    -

    Example

    + Focus ring · Bootstrap v5.3
    +Added in v5.3 +View on GitHub +

    Focus ring

    Utility classes that allows you to add and modify custom focus ring styles to elements and components.

    +

    The .focus-ring helper removes the default outline on :focus, replacing it with a box-shadow that can be more broadly customized. The new shadow is made up of a series of CSS variables, inherited from the :root level, that can be modified for any element or component.

    +

    Example

    Click directly on the link below to see the focus ring in action, or into the example below and then press Tab.

    -
    -
    - - +
    - html -
    - - -
    -
    <a href="#" class="d-inline-flex focus-ring py-1 px-2 text-decoration-none border rounded-2">
    -  Custom focus ring
    -</a>
    -
    - -

    Customize

    +
    html
    <a href="#" class="d-inline-flex focus-ring py-1 px-2 text-decoration-none border rounded-2">
    +  Custom focus ring
    +</a>
    +

    Customize

    Modify the styling of a focus ring with our CSS variables, Sass variables, utilities, or custom styles.

    -

    CSS variables

    +

    CSS variables

    Modify the --bs-focus-ring-* CSS variables as needed to change the default appearance.

    -
    -
    - - +
    - html -
    - - -
    -
    <a href="#" class="d-inline-flex focus-ring py-1 px-2 text-decoration-none border rounded-2" style="--bs-focus-ring-color: rgba(var(--bs-success-rgb), .25)">
    -  Green focus ring
    -</a>
    -
    - +
    html
    <a href="#" class="d-inline-flex focus-ring py-1 px-2 text-decoration-none border rounded-2" style="--bs-focus-ring-color: rgba(var(--bs-success-rgb), .25)">
    +  Green focus ring
    +</a>

    .focus-ring sets styles via global CSS variables that can be overridden on any parent element, as shown above. These variables are generated from their Sass variable counterparts.

    -
    -
    - scss/_root.scss -
    - -
    -
    --#{$prefix}focus-ring-width: #{$focus-ring-width};
    ---#{$prefix}focus-ring-opacity: #{$focus-ring-opacity};
    ---#{$prefix}focus-ring-color: #{$focus-ring-color};
    +
    --#{$prefix}focus-ring-width: #{$focus-ring-width};
    +--#{$prefix}focus-ring-opacity: #{$focus-ring-opacity};
    +--#{$prefix}focus-ring-color: #{$focus-ring-color};
    +

    By default, there is no --bs-focus-ring-x, --bs-focus-ring-y, or --bs-focus-ring-blur, but we provide CSS variables with fallbacks to initial 0 values. Modify them to change the default appearance.

    -
    -
    - - +
    - html -
    - - -
    -
    <a href="#" class="d-inline-flex focus-ring py-1 px-2 text-decoration-none border rounded-2" style="--bs-focus-ring-x: 10px; --bs-focus-ring-y: 10px; --bs-focus-ring-blur: 4px">
    -  Blurry offset focus ring
    -</a>
    -
    - -

    Sass variables

    +
    html
    <a href="#" class="d-inline-flex focus-ring py-1 px-2 text-decoration-none border rounded-2" style="--bs-focus-ring-x: 10px; --bs-focus-ring-y: 10px; --bs-focus-ring-blur: 4px">
    +  Blurry offset focus ring
    +</a>
    +

    Sass variables

    Customize the focus ring Sass variables to modify all usage of the focus ring styles across your Bootstrap-powered project.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $focus-ring-width:      .25rem;
    -$focus-ring-opacity:    .25;
    -$focus-ring-color:      rgba($primary, $focus-ring-opacity);
    -$focus-ring-blur:       0;
    -$focus-ring-box-shadow: 0 0 $focus-ring-blur $focus-ring-width $focus-ring-color;
    -
    -

    Sass utilities API

    -

    In addition to .focus-ring, we have several .focus-ring-* utilities to modify the helper class defaults. Modify the color with any of our theme colors. Note that the light and dark variants may not be visible on all background colors given current color mode support.

    -
    -
    - - -

    Primary focus

    +
    $focus-ring-width:      .25rem;
    +$focus-ring-opacity:    .25;
    +$focus-ring-color:      rgba($primary, $focus-ring-opacity);
    +$focus-ring-blur:       0;
    +$focus-ring-box-shadow: 0 0 $focus-ring-blur $focus-ring-width $focus-ring-color;
    +
    +

    Sass utilities API

    +

    In addition to .focus-ring, we have several .focus-ring-* utilities to modify the helper class defaults. Modify the color with any of our theme colors. Note that the light and dark variants may not be visible on all background colors given current color mode support.

    +
    - html -
    - - -
    -
    <p><a href="#" class="d-inline-flex focus-ring focus-ring-primary py-1 px-2 text-decoration-none border rounded-2">Primary focus</a></p>
    -<p><a href="#" class="d-inline-flex focus-ring focus-ring-secondary py-1 px-2 text-decoration-none border rounded-2">Secondary focus</a></p>
    -<p><a href="#" class="d-inline-flex focus-ring focus-ring-success py-1 px-2 text-decoration-none border rounded-2">Success focus</a></p>
    -<p><a href="#" class="d-inline-flex focus-ring focus-ring-danger py-1 px-2 text-decoration-none border rounded-2">Danger focus</a></p>
    -<p><a href="#" class="d-inline-flex focus-ring focus-ring-warning py-1 px-2 text-decoration-none border rounded-2">Warning focus</a></p>
    -<p><a href="#" class="d-inline-flex focus-ring focus-ring-info py-1 px-2 text-decoration-none border rounded-2">Info focus</a></p>
    -<p><a href="#" class="d-inline-flex focus-ring focus-ring-light py-1 px-2 text-decoration-none border rounded-2">Light focus</a></p>
    -<p><a href="#" class="d-inline-flex focus-ring focus-ring-dark py-1 px-2 text-decoration-none border rounded-2">Dark focus</a></p>
    -
    - -

    Focus ring utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "focus-ring": (
    -  css-var: true,
    -  css-variable-name: focus-ring-color,
    -  class: focus-ring,
    -  values: map-loop($theme-colors-rgb, rgba-css-var, "$key", "focus-ring")
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +

    Dark focus

    html
    <p><a href="#" class="d-inline-flex focus-ring focus-ring-primary py-1 px-2 text-decoration-none border rounded-2">Primary focus</a></p>
    +<p><a href="#" class="d-inline-flex focus-ring focus-ring-secondary py-1 px-2 text-decoration-none border rounded-2">Secondary focus</a></p>
    +<p><a href="#" class="d-inline-flex focus-ring focus-ring-success py-1 px-2 text-decoration-none border rounded-2">Success focus</a></p>
    +<p><a href="#" class="d-inline-flex focus-ring focus-ring-danger py-1 px-2 text-decoration-none border rounded-2">Danger focus</a></p>
    +<p><a href="#" class="d-inline-flex focus-ring focus-ring-warning py-1 px-2 text-decoration-none border rounded-2">Warning focus</a></p>
    +<p><a href="#" class="d-inline-flex focus-ring focus-ring-info py-1 px-2 text-decoration-none border rounded-2">Info focus</a></p>
    +<p><a href="#" class="d-inline-flex focus-ring focus-ring-light py-1 px-2 text-decoration-none border rounded-2">Light focus</a></p>
    +<p><a href="#" class="d-inline-flex focus-ring focus-ring-dark py-1 px-2 text-decoration-none border rounded-2">Dark focus</a></p>
    +

    Focus ring utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "focus-ring": (
    +  css-var: true,
    +  css-variable-name: focus-ring-color,
    +  class: focus-ring,
    +  values: map-loop($theme-colors-rgb, rgba-css-var, "$key", "focus-ring")
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/helpers/icon-link/index.html b/docs/5.3/helpers/icon-link/index.html index e12ea3508d..8af5f10f90 100644 --- a/docs/5.3/helpers/icon-link/index.html +++ b/docs/5.3/helpers/icon-link/index.html @@ -1,845 +1,113 @@ - - - - - - - - - - - - - - - - -Icon link · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    -
    Added in v5.3 - View on GitHub - -
    -

    Icon link

    -
    -

    Quickly create stylized hyperlinks with Bootstrap Icons or other icons.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    The icon link helper component modifies our default link styles to enhance their appearance and quickly align any pairing of icon and text. Alignment is set via inline flexbox styling and a default gap value. We stylize the underline with a custom offset and color. Icons are automatically sized to 1em to best match their associated text’s font-size.

    + Icon link · Bootstrap v5.3
    +Added in v5.3 +View on GitHub +

    Icon link

    Quickly create stylized hyperlinks with Bootstrap Icons or other icons.

    +

    The icon link helper component modifies our default link styles to enhance their appearance and quickly align any pairing of icon and text. Alignment is set via inline flexbox styling and a default gap value. We stylize the underline with a custom offset and color. Icons are automatically sized to 1em to best match their associated text’s font-size.

    Icon links assume Bootstrap Icons are being used, but you can use any icon or image you like.

    -
    -When icons are purely decorative, they should be hidden from assistive technologies using aria-hidden="true", as we’ve done in our examples. For icons that convey meaning, provide an appropriate text alternative by adding role="img" and an appropriate aria-label="..." to the SVGs. -
    - -

    Example

    +

    When icons are purely decorative, they should be hidden from assistive technologies using aria-hidden="true", as we’ve done in our examples. For icons that convey meaning, provide an appropriate text alternative by adding role="img" and an appropriate aria-label="..." to the SVGs.

    +

    Example

    Take a regular <a> element, add .icon-link, and insert an icon on either the left or right of your link text. The icon is automatically sized, placed, and colored.

    -
    -
    - - -
    - html -
    - - -
    -
    <a class="icon-link" href="#">
    -  <svg xmlns="http://www.w3.org/2000/svg" class="bi" viewBox="0 0 16 16" aria-hidden="true">  
    -    <path d="M8.186 1.113a.5.5 0 0 0-.372 0L1.846 3.5l2.404.961L10.404 2l-2.218-.887zm3.564 1.426L5.596 5 8 5.961 14.154 3.5l-2.404-.961zm3.25 1.7-6.5 2.6v7.922l6.5-2.6V4.24zM7.5 14.762V6.838L1 4.239v7.923l6.5 2.6zM7.443.184a1.5 1.5 0 0 1 1.114 0l7.129 2.852A.5.5 0 0 1 16 3.5v8.662a1 1 0 0 1-.629.928l-7.185 2.874a.5.5 0 0 1-.372 0L.63 13.09a1 1 0 0 1-.63-.928V3.5a.5.5 0 0 1 .314-.464L7.443.184z"/>
    -  </svg>
    -  Icon link
    -</a>
    -
    - -
    -
    - - +
    html
    <a class="icon-link" href="#">
    +  <svg xmlns="http://www.w3.org/2000/svg" class="bi" viewBox="0 0 16 16" aria-hidden="true">
    +    <path d="M8.186 1.113a.5.5 0 0 0-.372 0L1.846 3.5l2.404.961L10.404 2l-2.218-.887zm3.564 1.426L5.596 5 8 5.961 14.154 3.5l-2.404-.961zm3.25 1.7-6.5 2.6v7.922l6.5-2.6V4.24zM7.5 14.762V6.838L1 4.239v7.923l6.5 2.6zM7.443.184a1.5 1.5 0 0 1 1.114 0l7.129 2.852A.5.5 0 0 1 16 3.5v8.662a1 1 0 0 1-.629.928l-7.185 2.874a.5.5 0 0 1-.372 0L.63 13.09a1 1 0 0 1-.63-.928V3.5a.5.5 0 0 1 .314-.464L7.443.184z"/>
    +  </svg>
       Icon link
    -  
    -
    -
    -  
    - html -
    - - -
    -
    <a class="icon-link" href="#">
    -  Icon link
    -  <svg xmlns="http://www.w3.org/2000/svg" class="bi" viewBox="0 0 16 16" aria-hidden="true">  
    -    <path d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8z"/>
    -  </svg>
    -</a>
    -
    - -

    Style on hover

    -

    Add .icon-link-hover to move the icon to the right on hover.

    -
    +
    - html -
    - - -
    -
    <a class="icon-link icon-link-hover" href="#">
    -  Icon link
    -  <svg xmlns="http://www.w3.org/2000/svg" class="bi" viewBox="0 0 16 16" aria-hidden="true">
    -    <path d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8z"/>
    -  </svg>
    -</a>
    -
    - -

    Customize

    +
    html
    <a class="icon-link" href="#">
    +  Icon link
    +  <svg xmlns="http://www.w3.org/2000/svg" class="bi" viewBox="0 0 16 16" aria-hidden="true">
    +    <path d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8z"/>
    +  </svg>
    +</a>
    +

    Style on hover

    +

    Add .icon-link-hover to move the icon to the right on hover.

    +
    html
    <a class="icon-link icon-link-hover" href="#">
    +  Icon link
    +  <svg xmlns="http://www.w3.org/2000/svg" class="bi" viewBox="0 0 16 16" aria-hidden="true">
    +    <path d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8z"/>
    +  </svg>
    +</a>
    +

    Customize

    Modify the styling of an icon link with our link CSS variables, Sass variables, utilities, or custom styles.

    -

    CSS variables

    +

    CSS variables

    Modify the --bs-link-* and --bs-icon-link-* CSS variables as needed to change the default appearance.

    Customize the hover transform by overriding the --bs-icon-link-transform CSS variable:

    -
    -
    - - +
    - html -
    - - -
    -
    <a class="icon-link icon-link-hover" style="--bs-icon-link-transform: translate3d(0, -.125rem, 0);" href="#">
    -  <svg xmlns="http://www.w3.org/2000/svg" class="bi" viewBox="0 0 16 16" aria-hidden="true">
    -    <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/>
    -    <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/>
    -  </svg>
    -  Icon link
    -</a>
    -
    - +
    html
    <a class="icon-link icon-link-hover" style="--bs-icon-link-transform: translate3d(0, -.125rem, 0);" href="#">
    +  <svg xmlns="http://www.w3.org/2000/svg" class="bi" viewBox="0 0 16 16" aria-hidden="true">
    +    <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/>
    +    <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/>
    +  </svg>
    +  Icon link
    +</a>

    Customize the color by overriding the --bs-link-* CSS variable:

    -
    -
    - - +
    - html -
    - - -
    -
    <a class="icon-link icon-link-hover" style="--bs-link-hover-color-rgb: 25, 135, 84;" href="#">
    -  Icon link
    -  <svg xmlns="http://www.w3.org/2000/svg" class="bi" viewBox="0 0 16 16" aria-hidden="true">
    -    <path d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8z"/>
    -  </svg>
    -</a>
    -
    - -

    Sass variables

    +
    html
    <a class="icon-link icon-link-hover" style="--bs-link-hover-color-rgb: 25, 135, 84;" href="#">
    +  Icon link
    +  <svg xmlns="http://www.w3.org/2000/svg" class="bi" viewBox="0 0 16 16" aria-hidden="true">
    +    <path d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8z"/>
    +  </svg>
    +</a>
    +

    Sass variables

    Customize the icon link Sass variables to modify all icon link styles across your Bootstrap-powered project.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $icon-link-gap:               .375rem;
    -$icon-link-underline-offset:  .25em;
    -$icon-link-icon-size:         1em;
    -$icon-link-icon-transition:   .2s ease-in-out transform;
    -$icon-link-icon-transform:    translate3d(.25em, 0, 0);
    -
    -

    Sass utilities API

    +
    $icon-link-gap:               .375rem;
    +$icon-link-underline-offset:  .25em;
    +$icon-link-icon-size:         1em;
    +$icon-link-icon-transition:   .2s ease-in-out transform;
    +$icon-link-icon-transform:    translate3d(.25em, 0, 0);
    +
    +

    Sass utilities API

    Modify icon links with any of our link utilities for modifying underline color and offset.

    -
    -
    - - +
    - html -
    - - -
    -
    <a class="icon-link icon-link-hover link-success link-underline-success link-underline-opacity-25" href="#">
    -  Icon link
    -  <svg xmlns="http://www.w3.org/2000/svg" class="bi" viewBox="0 0 16 16" aria-hidden="true">
    -    <path d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8z"/>
    -  </svg>
    -</a>
    -
    - - -
    -
    -
    - - - - - - - - - - - - - - - +
    html
    <a class="icon-link icon-link-hover link-success link-underline-success link-underline-opacity-25" href="#">
    +  Icon link
    +  <svg xmlns="http://www.w3.org/2000/svg" class="bi" viewBox="0 0 16 16" aria-hidden="true">
    +    <path d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8z"/>
    +  </svg>
    +</a>
    \ No newline at end of file diff --git a/docs/5.3/helpers/index.html b/docs/5.3/helpers/index.html index 95c8620313..e466cd1819 100644 --- a/docs/5.3/helpers/index.html +++ b/docs/5.3/helpers/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/helpers/clearfix/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/helpers/position/index.html b/docs/5.3/helpers/position/index.html index a797dc4667..e5b1690009 100644 --- a/docs/5.3/helpers/position/index.html +++ b/docs/5.3/helpers/position/index.html @@ -1,664 +1,59 @@ - - - - - - - - - - - - - - - - -Position · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Position

    -
    -

    Use these helpers for quickly configuring the position of an element.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Fixed top

    + Position · Bootstrap v5.3

    Use these helpers for quickly configuring the position of an element.

    +

    Fixed top

    Position an element at the top of the viewport, from edge to edge. Be sure you understand the ramifications of fixed position in your project; you may need to add additional CSS.

    -
    <div class="fixed-top">...</div>
    -

    Fixed bottom

    +
    <div class="fixed-top">...</div>
    +
    +

    Fixed bottom

    Position an element at the bottom of the viewport, from edge to edge. Be sure you understand the ramifications of fixed position in your project; you may need to add additional CSS.

    -
    <div class="fixed-bottom">...</div>
    -

    Sticky top

    +
    <div class="fixed-bottom">...</div>
    +
    +

    Sticky top

    Position an element at the top of the viewport, from edge to edge, but only after you scroll past it.

    -
    <div class="sticky-top">...</div>
    -

    Responsive sticky top

    +
    <div class="sticky-top">...</div>
    +
    +

    Responsive sticky top

    Responsive variations also exist for .sticky-top utility.

    -
    <div class="sticky-sm-top">Stick to the top on viewports sized SM (small) or wider</div>
    -<div class="sticky-md-top">Stick to the top on viewports sized MD (medium) or wider</div>
    -<div class="sticky-lg-top">Stick to the top on viewports sized LG (large) or wider</div>
    -<div class="sticky-xl-top">Stick to the top on viewports sized XL (extra-large) or wider</div>
    -<div class="sticky-xxl-top">Stick to the top on viewports sized XXL (extra-extra-large) or wider</div>
    -

    Sticky bottom

    +
    <div class="sticky-sm-top">Stick to the top on viewports sized SM (small) or wider</div>
    +<div class="sticky-md-top">Stick to the top on viewports sized MD (medium) or wider</div>
    +<div class="sticky-lg-top">Stick to the top on viewports sized LG (large) or wider</div>
    +<div class="sticky-xl-top">Stick to the top on viewports sized XL (extra-large) or wider</div>
    +<div class="sticky-xxl-top">Stick to the top on viewports sized XXL (extra-extra-large) or wider</div>
    +
    +

    Sticky bottom

    Position an element at the bottom of the viewport, from edge to edge, but only after you scroll past it.

    -
    <div class="sticky-bottom">...</div>
    -

    Responsive sticky bottom

    +
    <div class="sticky-bottom">...</div>
    +
    +

    Responsive sticky bottom

    Responsive variations also exist for .sticky-bottom utility.

    -
    <div class="sticky-sm-bottom">Stick to the bottom on viewports sized SM (small) or wider</div>
    -<div class="sticky-md-bottom">Stick to the bottom on viewports sized MD (medium) or wider</div>
    -<div class="sticky-lg-bottom">Stick to the bottom on viewports sized LG (large) or wider</div>
    -<div class="sticky-xl-bottom">Stick to the bottom on viewports sized XL (extra-large) or wider</div>
    -<div class="sticky-xxl-bottom">Stick to the bottom on viewports sized XXL (extra-extra-large) or wider</div>
    -
    -
    -
    -
    - - - - - - - - - - - - - - - +
    <div class="sticky-sm-bottom">Stick to the bottom on viewports sized SM (small) or wider</div>
    +<div class="sticky-md-bottom">Stick to the bottom on viewports sized MD (medium) or wider</div>
    +<div class="sticky-lg-bottom">Stick to the bottom on viewports sized LG (large) or wider</div>
    +<div class="sticky-xl-bottom">Stick to the bottom on viewports sized XL (extra-large) or wider</div>
    +<div class="sticky-xxl-bottom">Stick to the bottom on viewports sized XXL (extra-extra-large) or wider</div>
    +
    \ No newline at end of file diff --git a/docs/5.3/helpers/ratio/index.html b/docs/5.3/helpers/ratio/index.html index f954571a88..8830f411f4 100644 --- a/docs/5.3/helpers/ratio/index.html +++ b/docs/5.3/helpers/ratio/index.html @@ -1,600 +1,40 @@ - - - - - - - - - - - - - - - - -Ratios · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Ratios

    -
    -

    Use generated pseudo elements to make an element maintain the aspect ratio of your choosing. Perfect for responsively handling video or slideshow embeds based on the width of the parent.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    About

    + Ratios · Bootstrap v5.3

    Use generated pseudo elements to make an element maintain the aspect ratio of your choosing. Perfect for responsively handling video or slideshow embeds based on the width of the parent.

    +
    On this page

    About

    Use the ratio helper to manage the aspect ratios of external content like <iframe>s, <embed>s, <video>s, and <object>s. These helpers also can be used on any standard HTML child element (e.g., a <div> or <img>). Styles are applied from the parent .ratio class directly to the child.

    Aspect ratios are declared in a Sass map and included in each class via CSS variable, which also allows custom aspect ratios.

    -
    -Pro-Tip! You don’t need frameborder="0" on your <iframe>s as we override that for you in Reboot. -
    - -

    Example

    +

    Pro-Tip! You don’t need frameborder="0" on your <iframe>s as we override that for you in Reboot.

    +

    Example

    Wrap any embed, like an <iframe>, in a parent element with .ratio and an aspect ratio class. The immediate child element is automatically sized thanks to our universal selector .ratio > *.

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="ratio ratio-16x9">
    -  <iframe src="https://www.youtube.com/embed/zpOULjyy-n8?rel=0" title="YouTube video" allowfullscreen></iframe>
    -</div>
    -
    - -

    Aspect ratios

    +
    html
    <div class="ratio ratio-16x9">
    +  <iframe src="https://www.youtube.com/embed/zpOULjyy-n8?rel=0" title="YouTube video" allowfullscreen></iframe>
    +</div>
    +

    Aspect ratios

    Aspect ratios can be customized with modifier classes. By default the following ratio classes are provided:

    -
    -
    - -
    +
    1x1
    @@ -605,176 +45,48 @@
    21x9
    -
    - -
    - html -
    - - -
    -
    <div class="ratio ratio-1x1">
    -  <div>1x1</div>
    -</div>
    -<div class="ratio ratio-4x3">
    -  <div>4x3</div>
    -</div>
    -<div class="ratio ratio-16x9">
    -  <div>16x9</div>
    -</div>
    -<div class="ratio ratio-21x9">
    -  <div>21x9</div>
    -</div>
    -
    - -

    Custom ratios

    +
    html
    <div class="ratio ratio-1x1">
    +  <div>1x1</div>
    +</div>
    +<div class="ratio ratio-4x3">
    +  <div>4x3</div>
    +</div>
    +<div class="ratio ratio-16x9">
    +  <div>16x9</div>
    +</div>
    +<div class="ratio ratio-21x9">
    +  <div>21x9</div>
    +</div>
    +

    Custom ratios

    Each .ratio-* class includes a CSS custom property (or CSS variable) in the selector. You can override this CSS variable to create custom aspect ratios on the fly with some quick math on your part.

    For example, to create a 2x1 aspect ratio, set --bs-aspect-ratio: 50% on the .ratio.

    -
    -
    - -
    +
    2x1
    -
    - -
    - html -
    - - -
    -
    <div class="ratio" style="--bs-aspect-ratio: 50%;">
    -  <div>2x1</div>
    -</div>
    -
    - +
    html
    <div class="ratio" style="--bs-aspect-ratio: 50%;">
    +  <div>2x1</div>
    +</div>

    This CSS variable makes it easy to modify the aspect ratio across breakpoints. The following is 4x3 to start, but changes to a custom 2x1 at the medium breakpoint.

    -
    .ratio-4x3 {
    -  @include media-breakpoint-up(md) {
    -    --bs-aspect-ratio: 50%; // 2x1
    -  }
    -}
    -
    -
    - -
    +
    .ratio-4x3 {
    +  @include media-breakpoint-up(md) {
    +    --bs-aspect-ratio: 50%; // 2x1
    +  }
    +}
    +
    +
    4x3, then 2x1
    -
    - -
    - html -
    - - -
    -
    <div class="ratio ratio-4x3">
    -  <div>4x3, then 2x1</div>
    -</div>
    -
    - -

    Sass maps

    -

    Within _variables.scss, you can change the aspect ratios you want to use. Here’s our default $ratio-aspect-ratios map. Modify the map as you like and recompile your Sass to put them to use.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $aspect-ratios: (
    -  "1x1": 100%,
    -  "4x3": calc(3 / 4 * 100%),
    -  "16x9": calc(9 / 16 * 100%),
    -  "21x9": calc(9 / 21 * 100%)
    -);
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    html
    <div class="ratio ratio-4x3">
    +  <div>4x3, then 2x1</div>
    +</div>
    +

    Sass maps

    +

    Within _variables.scss, you can change the aspect ratios you want to use. Here’s our default $ratio-aspect-ratios map. Modify the map as you like and recompile your Sass to put them to use.

    +
    $aspect-ratios: (
    +  "1x1": 100%,
    +  "4x3": calc(3 / 4 * 100%),
    +  "16x9": calc(9 / 16 * 100%),
    +  "21x9": calc(9 / 21 * 100%)
    +);
    +
    \ No newline at end of file diff --git a/docs/5.3/helpers/screen-readers/index.html b/docs/5.3/helpers/screen-readers/index.html index 75f3a5758c..dfca845c18 100644 --- a/docs/5.3/helpers/screen-readers/index.html +++ b/docs/5.3/helpers/screen-readers/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/helpers/visually-hidden/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/helpers/stacks/index.html b/docs/5.3/helpers/stacks/index.html index a8046b9e91..37070f4db7 100644 --- a/docs/5.3/helpers/stacks/index.html +++ b/docs/5.3/helpers/stacks/index.html @@ -1,831 +1,108 @@ - - - - - - - - - - - - - - - - -Stacks · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    -
    Added in v5.1 - View on GitHub - -
    -

    Stacks

    -
    -

    Shorthand helpers that build on top of our flexbox utilities to make component layout faster and easier than ever.

    - - -
    - - -
    - - On this page -
    -
    - -
    -
    - - -
    - - -

    Stacks offer a shortcut for applying a number of flexbox properties to quickly and easily create layouts in Bootstrap. All credit for the concept and implementation goes to the open source Pylon project.

    -
    -Heads up! Support for gap utilities with flexbox isn’t available in Safari prior to 14.5, so consider verifying your intended browser support. Grid layout should have no issues. Read more. -
    - -

    Vertical

    + Stacks · Bootstrap v5.3
    +Added in v5.1 +View on GitHub +

    Stacks

    Shorthand helpers that build on top of our flexbox utilities to make component layout faster and easier than ever.

    +
    On this page

    Stacks offer a shortcut for applying a number of flexbox properties to quickly and easily create layouts in Bootstrap. All credit for the concept and implementation goes to the open source Pylon project.

    +

    Heads up! Support for gap utilities with flexbox isn’t available in Safari prior to 14.5, so consider verifying your intended browser support. Grid layout should have no issues. Read more.

    +

    Vertical

    Use .vstack to create vertical layouts. Stacked items are full-width by default. Use .gap-* utilities to add space between items.

    -
    -
    - -
    +
    First item
    Second item
    Third item
    -
    - -
    - html -
    - - -
    -
    <div class="vstack gap-3">
    -  <div class="p-2">First item</div>
    -  <div class="p-2">Second item</div>
    -  <div class="p-2">Third item</div>
    -</div>
    -
    - -

    Horizontal

    +
    html
    <div class="vstack gap-3">
    +  <div class="p-2">First item</div>
    +  <div class="p-2">Second item</div>
    +  <div class="p-2">Third item</div>
    +</div>
    +

    Horizontal

    Use .hstack for horizontal layouts. Stacked items are vertically centered by default and only take up their necessary width. Use .gap-* utilities to add space between items.

    -
    -
    - -
    +
    First item
    Second item
    Third item
    -
    - -
    - html -
    - - -
    -
    <div class="hstack gap-3">
    -  <div class="p-2">First item</div>
    -  <div class="p-2">Second item</div>
    -  <div class="p-2">Third item</div>
    -</div>
    -
    - +
    html
    <div class="hstack gap-3">
    +  <div class="p-2">First item</div>
    +  <div class="p-2">Second item</div>
    +  <div class="p-2">Third item</div>
    +</div>

    Using horizontal margin utilities like .ms-auto as spacers:

    -
    -
    - -
    +
    First item
    Second item
    Third item
    -
    - -
    - html -
    - - -
    -
    <div class="hstack gap-3">
    -  <div class="p-2">First item</div>
    -  <div class="p-2 ms-auto">Second item</div>
    -  <div class="p-2">Third item</div>
    -</div>
    -
    - -

    And with vertical rules:

    -
    -
    - -
    +
    html
    <div class="hstack gap-3">
    +  <div class="p-2">First item</div>
    +  <div class="p-2 ms-auto">Second item</div>
    +  <div class="p-2">Third item</div>
    +</div>
    +

    And with vertical rules:

    +
    First item
    Second item
    Third item
    -
    - -
    - html -
    - - -
    -
    <div class="hstack gap-3">
    -  <div class="p-2">First item</div>
    -  <div class="p-2 ms-auto">Second item</div>
    -  <div class="vr"></div>
    -  <div class="p-2">Third item</div>
    -</div>
    -
    - -

    Examples

    +
    html
    <div class="hstack gap-3">
    +  <div class="p-2">First item</div>
    +  <div class="p-2 ms-auto">Second item</div>
    +  <div class="vr"></div>
    +  <div class="p-2">Third item</div>
    +</div>
    +

    Examples

    Use .vstack to stack buttons and other elements:

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="vstack gap-2 col-md-5 mx-auto">
    -  <button type="button" class="btn btn-secondary">Save changes</button>
    -  <button type="button" class="btn btn-outline-secondary">Cancel</button>
    -</div>
    -
    - +
    html
    <div class="vstack gap-2 col-md-5 mx-auto">
    +  <button type="button" class="btn btn-secondary">Save changes</button>
    +  <button type="button" class="btn btn-outline-secondary">Cancel</button>
    +</div>

    Create an inline form with .hstack:

    -
    -
    - -
    +
    -
    +
    html
    <div class="hstack gap-3">
    +  <input class="form-control me-auto" type="text" placeholder="Add your item here..." aria-label="Add your item here...">
    +  <button type="button" class="btn btn-secondary">Submit</button>
    +  <div class="vr"></div>
    +  <button type="button" class="btn btn-outline-danger">Reset</button>
    +</div>
    +

    CSS

    +
    .hstack {
    +  display: flex;
    +  flex-direction: row;
    +  align-items: center;
    +  align-self: stretch;
    +}
     
    -  
    - html -
    - - -
    -
    <div class="hstack gap-3">
    -  <input class="form-control me-auto" type="text" placeholder="Add your item here..." aria-label="Add your item here...">
    -  <button type="button" class="btn btn-secondary">Submit</button>
    -  <div class="vr"></div>
    -  <button type="button" class="btn btn-outline-danger">Reset</button>
    -</div>
    -
    - -

    CSS

    -
    -
    .hstack {
    -  display: flex;
    -  flex-direction: row;
    -  align-items: center;
    -  align-self: stretch;
    -}
    -
    -.vstack {
    -  display: flex;
    -  flex: 1 1 auto;
    -  flex-direction: column;
    -  align-self: stretch;
    -}
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - +.vstack { + display: flex; + flex: 1 1 auto; + flex-direction: column; + align-self: stretch; +} +
    \ No newline at end of file diff --git a/docs/5.3/helpers/stretched-link/index.html b/docs/5.3/helpers/stretched-link/index.html index 060e2ada6b..6218bae9c5 100644 --- a/docs/5.3/helpers/stretched-link/index.html +++ b/docs/5.3/helpers/stretched-link/index.html @@ -1,663 +1,90 @@ - - - - - - - - - - - - - - - - -Stretched link · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Stretched link

    -
    -

    Make any HTML element or Bootstrap component clickable by “stretching” a nested link via CSS.

    - - -
    - - - -
    - - -

    Add .stretched-link to a link to make its containing block clickable via a ::after pseudo element. In most cases, this means that an element with position: relative; that contains a link with the .stretched-link class is clickable. Please note given how CSS position works, .stretched-link cannot be mixed with most table elements.

    + Stretched link · Bootstrap v5.3

    Stretched link

    Make any HTML element or Bootstrap component clickable by “stretching” a nested link via CSS.

    +

    Add .stretched-link to a link to make its containing block clickable via a ::after pseudo element. In most cases, this means that an element with position: relative; that contains a link with the .stretched-link class is clickable. Please note given how CSS position works, .stretched-link cannot be mixed with most table elements.

    Cards have position: relative by default in Bootstrap, so in this case you can safely add the .stretched-link class to a link in the card without any other HTML changes.

    Multiple links and tap targets are not recommended with stretched links. However, some position and z-index styles can help should this be required.

    -
    -
    - -
    - Card image cap +
    + Card image cap
    Card with stretched link
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Go somewhere
    -
    - -
    - html -
    - - -
    -
    <div class="card" style="width: 18rem;">
    -  <img src="..." class="card-img-top" alt="...">
    -  <div class="card-body">
    -    <h5 class="card-title">Card with stretched link</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -    <a href="#" class="btn btn-primary stretched-link">Go somewhere</a>
    -  </div>
    -</div>
    -
    - +
    html
    <div class="card" style="width: 18rem;">
    +  <img src="..." class="card-img-top" alt="...">
    +  <div class="card-body">
    +    <h5 class="card-title">Card with stretched link</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +    <a href="#" class="btn btn-primary stretched-link">Go somewhere</a>
    +  </div>
    +</div>

    Most custom components do not have position: relative by default, so we need to add the .position-relative here to prevent the link from stretching outside the parent element.

    -
    -
    - -
    - Generic placeholder image +
    + Generic placeholder image22222
    Custom component with stretched link
    -

    This is some placeholder content for the custom component. It is intended to mimic what some real-world content would look like, and we're using it here to give the component a bit of body and size.

    +

    This is some placeholder content for the custom component. It is intended to mimic what some real-world content would look like, and we’re using it here to give the component a bit of body and size.

    Go somewhere
    -
    - -
    - html -
    - - -
    -
    <div class="d-flex position-relative">
    -  <img src="..." class="flex-shrink-0 me-3" alt="...">
    -  <div>
    -    <h5 class="mt-0">Custom component with stretched link</h5>
    -    <p>This is some placeholder content for the custom component. It is intended to mimic what some real-world content would look like, and we're using it here to give the component a bit of body and size.</p>
    -    <a href="#" class="stretched-link">Go somewhere</a>
    -  </div>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="d-flex position-relative">
    +  <img src="..." class="flex-shrink-0 me-3" alt="...">
    +  <div>
    +    <h5 class="mt-0">Custom component with stretched link</h5>
    +    <p>This is some placeholder content for the custom component. It is intended to mimic what some real-world content would look like, and we’re using it here to give the component a bit of body and size.</p>
    +    <a href="#" class="stretched-link">Go somewhere</a>
    +  </div>
    +</div>
    +
    - Generic placeholder image + Generic placeholder image
    Columns with stretched link
    -

    Another instance of placeholder content for this other custom component. It is intended to mimic what some real-world content would look like, and we're using it here to give the component a bit of body and size.

    +

    Another instance of placeholder content for this other custom component. It is intended to mimic what some real-world content would look like, and we’re using it here to give the component a bit of body and size.

    Go somewhere
    -
    - -
    - html -
    - - -
    -
    <div class="row g-0 bg-body-secondary position-relative">
    -  <div class="col-md-6 mb-md-0 p-md-4">
    -    <img src="..." class="w-100" alt="...">
    -  </div>
    -  <div class="col-md-6 p-4 ps-md-0">
    -    <h5 class="mt-0">Columns with stretched link</h5>
    -    <p>Another instance of placeholder content for this other custom component. It is intended to mimic what some real-world content would look like, and we're using it here to give the component a bit of body and size.</p>
    -    <a href="#" class="stretched-link">Go somewhere</a>
    -  </div>
    -</div>
    -
    - -

    Identifying the containing block

    -

    If the stretched link doesn’t seem to work, the containing block will probably be the cause. The following CSS properties will make an element the containing block:

    +
    html
    <div class="row g-0 bg-body-secondary position-relative">
    +  <div class="col-md-6 mb-md-0 p-md-4">
    +    <img src="..." class="w-100" alt="...">
    +  </div>
    +  <div class="col-md-6 p-4 ps-md-0">
    +    <h5 class="mt-0">Columns with stretched link</h5>
    +    <p>Another instance of placeholder content for this other custom component. It is intended to mimic what some real-world content would look like, and we’re using it here to give the component a bit of body and size.</p>
    +    <a href="#" class="stretched-link">Go somewhere</a>
    +  </div>
    +</div>
    +

    Identifying the containing block

    +

    If the stretched link doesn’t seem to work, the containing block will probably be the cause. The following CSS properties will make an element the containing block:

    • A position value other than static
    • A transform or perspective value other than none
    • A will-change value of transform or perspective
    • A filter value other than none or a will-change value of filter (only works on Firefox)
    -
    -
    - -
    - Card image cap +
    + Card image cap
    Card with stretched links
    -

    Some quick example text to build on the card title and make up the bulk of the card's content.

    +

    Some quick example text to build on the card title and make up the bulk of the card’s content.

    Stretched link will not work here, because position: relative is added to the link

    @@ -665,107 +92,20 @@ This stretched link will only be spread over the p-tag, because a transform is applied to it.

    -
    - -
    - html -
    - - -
    -
    <div class="card" style="width: 18rem;">
    -  <img src="..." class="card-img-top" alt="...">
    -  <div class="card-body">
    -    <h5 class="card-title">Card with stretched links</h5>
    -    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
    -    <p class="card-text">
    -      <a href="#" class="stretched-link text-danger" style="position: relative;">Stretched link will not work here, because <code>position: relative</code> is added to the link</a>
    -    </p>
    -    <p class="card-text bg-body-tertiary" style="transform: rotate(0);">
    -      This <a href="#" class="text-warning stretched-link">stretched link</a> will only be spread over the <code>p</code>-tag, because a transform is applied to it.
    -    </p>
    -  </div>
    -</div>
    -
    - - -
    -
    -
    - - - - - - - - - - - - - - - +
    html
    <div class="card" style="width: 18rem;">
    +  <img src="..." class="card-img-top" alt="...">
    +  <div class="card-body">
    +    <h5 class="card-title">Card with stretched links</h5>
    +    <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card’s content.</p>
    +    <p class="card-text">
    +      <a href="#" class="stretched-link text-danger" style="position: relative;">Stretched link will not work here, because <code>position: relative</code> is added to the link</a>
    +    </p>
    +    <p class="card-text bg-body-tertiary" style="transform: rotate(0);">
    +      This <a href="#" class="text-warning stretched-link">stretched link</a> will only be spread over the <code>p</code>-tag, because a transform is applied to it.
    +    </p>
    +  </div>
    +</div>
    \ No newline at end of file diff --git a/docs/5.3/helpers/text-truncation/index.html b/docs/5.3/helpers/text-truncation/index.html index a1f70f2200..504ee324f2 100644 --- a/docs/5.3/helpers/text-truncation/index.html +++ b/docs/5.3/helpers/text-truncation/index.html @@ -1,548 +1,26 @@ - - - - - - - - - - - - - - - - -Text truncation · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Text truncation

    -
    -

    Truncate long strings of text with an ellipsis.

    - - -
    - - - -
    - - -

    For longer content, you can add a .text-truncate class to truncate the text with an ellipsis. Requires display: inline-block or display: block.

    -
    -
    - - + Text truncation · Bootstrap v5.3

    Text truncation

    Truncate long strings of text with an ellipsis.

    +

    For longer content, you can add a .text-truncate class to truncate the text with an ellipsis. Requires display: inline-block or display: block.

    +
    This text is quite long, and will be truncated once displayed. @@ -552,105 +30,18 @@ This text is quite long, and will be truncated once displayed. - +
    html
    <!-- Block level -->
    +<div class="row">
    +  <div class="col-2 text-truncate">
    +    This text is quite long, and will be truncated once displayed.
    +  </div>
    +</div>
     
    -  
    - html -
    - - -
    -
    <!-- Block level -->
    -<div class="row">
    -  <div class="col-2 text-truncate">
    -    This text is quite long, and will be truncated once displayed.
    -  </div>
    -</div>
    -
    -<!-- Inline level -->
    -<span class="d-inline-block text-truncate" style="max-width: 150px;">
    -  This text is quite long, and will be truncated once displayed.
    -</span>
    -
    - - -
    -
    -
    - - - - - - - - - - - - - - - +<!-- Inline level --> +<span class="d-inline-block text-truncate" style="max-width: 150px;"> + This text is quite long, and will be truncated once displayed. +</span>
    \ No newline at end of file diff --git a/docs/5.3/helpers/vertical-rule/index.html b/docs/5.3/helpers/vertical-rule/index.html index 936d0f4d40..9577108a4a 100644 --- a/docs/5.3/helpers/vertical-rule/index.html +++ b/docs/5.3/helpers/vertical-rule/index.html @@ -1,733 +1,60 @@ - - - - - - - - - - - - - - - - -Vertical rule · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    -
    Added in v5.1 - View on GitHub - -
    -

    Vertical rule

    -
    -

    Use the custom vertical rule helper to create vertical dividers like the <hr> element.

    - - -
    - - -
    - - On this page -
    -
    - -
    -
    - - -
    - - -

    How it works

    -

    Vertical rules are inspired by the <hr> element, allowing you to create vertical dividers in common layouts. They’re styled just like <hr> elements:

    + Vertical rule · Bootstrap v5.3
    +Added in v5.1 +View on GitHub +

    Vertical rule

    Use the custom vertical rule helper to create vertical dividers like the <hr> element.

    +
    On this page

    How it works

    +

    Vertical rules are inspired by the <hr> element, allowing you to create vertical dividers in common layouts. They’re styled just like <hr> elements:

      -
    • They’re 1px wide
    • +
    • They’re 1px wide
    • They have min-height of 1em
    • Their color is set via currentColor and opacity

    Customize them with additional styles as needed.

    -

    Example

    -
    -
    - -
    - -
    - html -
    - - -
    -
    <div class="vr"></div>
    -
    - +

    Example

    +
    html
    <div class="vr"></div>

    Vertical rules scale their height in flex layouts:

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="d-flex" style="height: 200px;">
    -  <div class="vr"></div>
    -</div>
    -
    - -

    With stacks

    -

    They can also be used in stacks:

    -
    -
    - -
    +
    html
    <div class="d-flex" style="height: 200px;">
    +  <div class="vr"></div>
    +</div>
    +

    With stacks

    +

    They can also be used in stacks:

    +
    First item
    Second item
    Third item
    -
    - -
    - html -
    - - -
    -
    <div class="hstack gap-3">
    -  <div class="p-2">First item</div>
    -  <div class="p-2 ms-auto">Second item</div>
    -  <div class="vr"></div>
    -  <div class="p-2">Third item</div>
    -</div>
    -
    - -

    CSS

    -

    Sass variables

    +
    html
    <div class="hstack gap-3">
    +  <div class="p-2">First item</div>
    +  <div class="p-2 ms-auto">Second item</div>
    +  <div class="vr"></div>
    +  <div class="p-2">Third item</div>
    +</div>
    +

    CSS

    +

    Sass variables

    Customize the vertical rule Sass variable to change its width.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $vr-border-width:             var(--#{$prefix}border-width);
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    $vr-border-width:             var(--#{$prefix}border-width);
    +
    \ No newline at end of file diff --git a/docs/5.3/helpers/visually-hidden/index.html b/docs/5.3/helpers/visually-hidden/index.html index 4013a68431..ed1ecbc570 100644 --- a/docs/5.3/helpers/visually-hidden/index.html +++ b/docs/5.3/helpers/visually-hidden/index.html @@ -1,650 +1,42 @@ - - - - - - - - - - - - - - - - -Visually hidden · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Visually hidden

    -
    -

    Use these helpers to visually hide elements but keep them accessible to assistive technologies.

    - - -
    - - - -
    - - -

    Visually hide an element while still allowing it to be exposed to assistive technologies (such as screen readers) with .visually-hidden. Use .visually-hidden-focusable to visually hide an element by default, but to display it when it’s focused (e.g. by a keyboard-only user). .visually-hidden-focusable can also be applied to a container–thanks to :focus-within, the container will be displayed when any child element of the container receives focus.

    -
    -
    - -

    Title for screen readers

    + Visually hidden · Bootstrap v5.3

    Visually hidden

    Use these helpers to visually hide elements but keep them accessible to assistive technologies.

    +

    Visually hide an element while still allowing it to be exposed to assistive technologies (such as screen readers) with .visually-hidden. Use .visually-hidden-focusable to visually hide an element by default, but to display it when it’s focused (e.g. by a keyboard-only user). .visually-hidden-focusable can also be applied to a container–thanks to :focus-within, the container will be displayed when any child element of the container receives focus.

    +

    Title for screen readers

    Skip to main content -
    A container with a focusable element.
    - -
    - html -
    - - -
    -
    <h2 class="visually-hidden">Title for screen readers</h2>
    -<a class="visually-hidden-focusable" href="#content">Skip to main content</a>
    -<div class="visually-hidden-focusable">A container with a <a href="#">focusable element</a>.</div>
    -
    - +
    A container with a focusable element.
    html
    <h2 class="visually-hidden">Title for screen readers</h2>
    +<a class="visually-hidden-focusable" href="#content">Skip to main content</a>
    +<div class="visually-hidden-focusable">A container with a <a href="#">focusable element</a>.</div>

    Both visually-hidden and visually-hidden-focusable can also be used as mixins.

    -
    // Usage as a mixin
    -
    -.visually-hidden-title {
    -  @include visually-hidden;
    -}
    -
    -.skip-navigation {
    -  @include visually-hidden-focusable;
    -}
    -
    -
    -
    -
    +
    // Usage as a mixin
     
    +.visually-hidden-title {
    +  @include visually-hidden;
    +}
     
    -    
    -
    -    
    -
    -
    -
    -
    -
    -    
    -  
    -
    -  
    -
    +.skip-navigation {
    +  @include visually-hidden-focusable;
    +}
    +
    \ No newline at end of file diff --git a/docs/5.3/index.html b/docs/5.3/index.html index 349df656a8..b2e5f03e22 100644 --- a/docs/5.3/index.html +++ b/docs/5.3/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/getting-started/introduction/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/layout/breakpoints/index.html b/docs/5.3/layout/breakpoints/index.html index a49c1f21aa..381c75770e 100644 --- a/docs/5.3/layout/breakpoints/index.html +++ b/docs/5.3/layout/breakpoints/index.html @@ -1,569 +1,27 @@ - - - - - - - - - - - - - - - - -Breakpoints · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Breakpoints

    -
    -

    Breakpoints are customizable widths that determine how your responsive layout behaves across device or viewport sizes in Bootstrap.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Core concepts

    + Breakpoints · Bootstrap v5.3

    Breakpoints

    Breakpoints are customizable widths that determine how your responsive layout behaves across device or viewport sizes in Bootstrap.

    +

    Core concepts

    • Breakpoints are the building blocks of responsive design. Use them to control when your layout can be adapted at a particular viewport or device size.

      @@ -572,243 +30,166 @@

      Use media queries to architect your CSS by breakpoint. Media queries are a feature of CSS that allow you to conditionally apply styles based on a set of browser and operating system parameters. We most commonly use min-width in our media queries.

    • -

      Mobile first, responsive design is the goal. Bootstrap’s CSS aims to apply the bare minimum of styles to make a layout work at the smallest breakpoint, and then layers on styles to adjust that design for larger devices. This optimizes your CSS, improves rendering time, and provides a great experience for your visitors.

      +

      Mobile first, responsive design is the goal. Bootstrap’s CSS aims to apply the bare minimum of styles to make a layout work at the smallest breakpoint, and then layers on styles to adjust that design for larger devices. This optimizes your CSS, improves rendering time, and provides a great experience for your visitors.

    -

    Available breakpoints

    -

    Bootstrap includes six default breakpoints, sometimes referred to as grid tiers, for building responsively. These breakpoints can be customized if you’re using our source Sass files.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    BreakpointClass infixDimensions
    Extra smallNone<576px
    Smallsm≥576px
    Mediummd≥768px
    Largelg≥992px
    Extra largexl≥1200px
    Extra extra largexxl≥1400px
    +

    Available breakpoints

    +

    Bootstrap includes six default breakpoints, sometimes referred to as grid tiers, for building responsively. These breakpoints can be customized if you’re using our source Sass files.

    +
    -

    Each breakpoint was chosen to comfortably hold containers whose widths are multiples of 12. Breakpoints are also representative of a subset of common device sizes and viewport dimensions—they don’t specifically target every use case or device. Instead, the ranges provide a strong and consistent foundation to build on for nearly any device.

    -

    These breakpoints are customizable via Sass—you’ll find them in a Sass map in our _variables.scss stylesheet.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $grid-breakpoints: (
    -  xs: 0,
    -  sm: 576px,
    -  md: 768px,
    -  lg: 992px,
    -  xl: 1200px,
    -  xxl: 1400px
    -);
    -
    -

    For more information and examples on how to modify our Sass maps and variables, please refer to the CSS section of the Grid documentation.

    -

    Media queries

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    BreakpointClass infixDimensions
    Extra smallNone<576px
    Smallsm≥576px
    Mediummd≥768px
    Largelg≥992px
    Extra largexl≥1200px
    Extra extra largexxl≥1400px
    +

    Each breakpoint was chosen to comfortably hold containers whose widths are multiples of 12. Breakpoints are also representative of a subset of common device sizes and viewport dimensions—they don’t specifically target every use case or device. Instead, the ranges provide a strong and consistent foundation to build on for nearly any device.

    +

    These breakpoints are customizable via Sass—you’ll find them in a Sass map in our _variables.scss stylesheet.

    +
    $grid-breakpoints: (
    +  xs: 0,
    +  sm: 576px,
    +  md: 768px,
    +  lg: 992px,
    +  xl: 1200px,
    +  xxl: 1400px
    +);
    +
    +

    For more information and examples on how to modify our Sass maps and variables, please refer to the CSS section of the Grid documentation.

    +

    Media queries

    Since Bootstrap is developed to be mobile first, we use a handful of media queries to create sensible breakpoints for our layouts and interfaces. These breakpoints are mostly based on minimum viewport widths and allow us to scale up elements as the viewport changes.

    -

    Min-width

    +

    Min-width

    Bootstrap primarily uses the following media query ranges—or breakpoints—in our source Sass files for our layout, grid system, and components.

    -
    // Source mixins
    -
    -// No media query necessary for xs breakpoint as it's effectively `@media (min-width: 0) { ... }`
    -@include media-breakpoint-up(sm) { ... }
    -@include media-breakpoint-up(md) { ... }
    -@include media-breakpoint-up(lg) { ... }
    -@include media-breakpoint-up(xl) { ... }
    -@include media-breakpoint-up(xxl) { ... }
    -
    -// Usage
    -
    -// Example: Hide starting at `min-width: 0`, and then show at the `sm` breakpoint
    -.custom-class {
    -  display: none;
    -}
    -@include media-breakpoint-up(sm) {
    -  .custom-class {
    -    display: block;
    -  }
    -}
    -

    These Sass mixins translate in our compiled CSS using the values declared in our Sass variables. For example:

    -
    // X-Small devices (portrait phones, less than 576px)
    -// No media query for `xs` since this is the default in Bootstrap
    -
    -// Small devices (landscape phones, 576px and up)
    -@media (min-width: 576px) { ... }
    -
    -// Medium devices (tablets, 768px and up)
    -@media (min-width: 768px) { ... }
    -
    -// Large devices (desktops, 992px and up)
    -@media (min-width: 992px) { ... }
    -
    -// X-Large devices (large desktops, 1200px and up)
    -@media (min-width: 1200px) { ... }
    -
    -// XX-Large devices (larger desktops, 1400px and up)
    -@media (min-width: 1400px) { ... }
    -

    Max-width

    +
    // Source mixins
    +
    +// No media query necessary for xs breakpoint as it’s effectively `@media (min-width: 0) { ... }`
    +@include media-breakpoint-up(sm) { ... }
    +@include media-breakpoint-up(md) { ... }
    +@include media-breakpoint-up(lg) { ... }
    +@include media-breakpoint-up(xl) { ... }
    +@include media-breakpoint-up(xxl) { ... }
    +
    +// Usage
    +
    +// Example: Hide starting at `min-width: 0`, and then show at the `sm` breakpoint
    +.custom-class {
    +  display: none;
    +}
    +@include media-breakpoint-up(sm) {
    +  .custom-class {
    +    display: block;
    +  }
    +}
    +
    +

    These Sass mixins translate in our compiled CSS using the values declared in our Sass variables. For example:

    +
    // X-Small devices (portrait phones, less than 576px)
    +// No media query for `xs` since this is the default in Bootstrap
    +
    +// Small devices (landscape phones, 576px and up)
    +@media (min-width: 576px) { ... }
    +
    +// Medium devices (tablets, 768px and up)
    +@media (min-width: 768px) { ... }
    +
    +// Large devices (desktops, 992px and up)
    +@media (min-width: 992px) { ... }
    +
    +// X-Large devices (large desktops, 1200px and up)
    +@media (min-width: 1200px) { ... }
    +
    +// XX-Large devices (larger desktops, 1400px and up)
    +@media (min-width: 1400px) { ... }
    +
    +

    Max-width

    We occasionally use media queries that go in the other direction (the given screen size or smaller):

    -
    // No media query necessary for xs breakpoint as it's effectively `@media (max-width: 0) { ... }`
    -@include media-breakpoint-down(sm) { ... }
    -@include media-breakpoint-down(md) { ... }
    -@include media-breakpoint-down(lg) { ... }
    -@include media-breakpoint-down(xl) { ... }
    -@include media-breakpoint-down(xxl) { ... }
    -
    -// Example: Style from medium breakpoint and down
    -@include media-breakpoint-down(md) {
    -  .custom-class {
    -    display: block;
    -  }
    -}
    -

    These mixins take those declared breakpoints, subtract .02px from them, and use them as our max-width values. For example:

    -
    // `xs` returns only a ruleset and no media query
    -// ... { ... }
    -
    -// `sm` applies to x-small devices (portrait phones, less than 576px)
    -@media (max-width: 575.98px) { ... }
    -
    -// `md` applies to small devices (landscape phones, less than 768px)
    -@media (max-width: 767.98px) { ... }
    -
    -// `lg` applies to medium devices (tablets, less than 992px)
    -@media (max-width: 991.98px) { ... }
    -
    -// `xl` applies to large devices (desktops, less than 1200px)
    -@media (max-width: 1199.98px) { ... }
    -
    -// `xxl` applies to x-large devices (large desktops, less than 1400px)
    -@media (max-width: 1399.98px) { ... }
    -
    -Why subtract .02px? Browsers don’t currently support range context queries, so we work around the limitations of min- and max- prefixes and viewports with fractional widths (which can occur under certain conditions on high-dpi devices, for instance) by using values with higher precision. -
    +
    // No media query necessary for xs breakpoint as it’s effectively `@media (max-width: 0) { ... }`
    +@include media-breakpoint-down(sm) { ... }
    +@include media-breakpoint-down(md) { ... }
    +@include media-breakpoint-down(lg) { ... }
    +@include media-breakpoint-down(xl) { ... }
    +@include media-breakpoint-down(xxl) { ... }
     
    -

    Single breakpoint

    +// Example: Style from medium breakpoint and down +@include media-breakpoint-down(md) { + .custom-class { + display: block; + } +} +
    +

    These mixins take those declared breakpoints, subtract .02px from them, and use them as our max-width values. For example:

    +
    // `xs` returns only a ruleset and no media query
    +// ... { ... }
    +
    +// `sm` applies to x-small devices (portrait phones, less than 576px)
    +@media (max-width: 575.98px) { ... }
    +
    +// `md` applies to small devices (landscape phones, less than 768px)
    +@media (max-width: 767.98px) { ... }
    +
    +// `lg` applies to medium devices (tablets, less than 992px)
    +@media (max-width: 991.98px) { ... }
    +
    +// `xl` applies to large devices (desktops, less than 1200px)
    +@media (max-width: 1199.98px) { ... }
    +
    +// `xxl` applies to x-large devices (large desktops, less than 1400px)
    +@media (max-width: 1399.98px) { ... }
    +
    +

    Why subtract .02px? Browsers don’t currently support range context queries, so we work around the limitations of min- and max- prefixes and viewports with fractional widths (which can occur under certain conditions on high-dpi devices, for instance) by using values with higher precision.

    +

    Single breakpoint

    There are also media queries and mixins for targeting a single segment of screen sizes using the minimum and maximum breakpoint widths.

    -
    @include media-breakpoint-only(xs) { ... }
    -@include media-breakpoint-only(sm) { ... }
    -@include media-breakpoint-only(md) { ... }
    -@include media-breakpoint-only(lg) { ... }
    -@include media-breakpoint-only(xl) { ... }
    -@include media-breakpoint-only(xxl) { ... }
    -

    For example the @include media-breakpoint-only(md) { ... } will result in :

    -
    @media (min-width: 768px) and (max-width: 991.98px) { ... }
    -

    Between breakpoints

    +
    @include media-breakpoint-only(xs) { ... }
    +@include media-breakpoint-only(sm) { ... }
    +@include media-breakpoint-only(md) { ... }
    +@include media-breakpoint-only(lg) { ... }
    +@include media-breakpoint-only(xl) { ... }
    +@include media-breakpoint-only(xxl) { ... }
    +
    +

    For example the @include media-breakpoint-only(md) { ... } will result in :

    +
    @media (min-width: 768px) and (max-width: 991.98px) { ... }
    +
    +

    Between breakpoints

    Similarly, media queries may span multiple breakpoint widths:

    -
    @include media-breakpoint-between(md, xl) { ... }
    -

    Which results in:

    -
    // Example
    -// Apply styles starting from medium devices and up to extra large devices
    -@media (min-width: 768px) and (max-width: 1199.98px) { ... }
    -
    -
    -
    -
    - - - - - - - - - - - - - - - +
    @include media-breakpoint-between(md, xl) { ... }
    +
    +

    Which results in:

    +
    // Example
    +// Apply styles starting from medium devices and up to extra large devices
    +@media (min-width: 768px) and (max-width: 1199.98px) { ... }
    +
    \ No newline at end of file diff --git a/docs/5.3/layout/columns/index.html b/docs/5.3/layout/columns/index.html index 74558f1d89..78b86d6662 100644 --- a/docs/5.3/layout/columns/index.html +++ b/docs/5.3/layout/columns/index.html @@ -1,603 +1,44 @@ - - - - - - - - - - - - - - - - -Columns · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Columns

    -
    -

    Learn how to modify columns with a handful of options for alignment, ordering, and offsetting thanks to our flexbox grid system. Plus, see how to use column classes to manage widths of non-grid elements.

    - - -
    - - - - - -
    - - -
    -Heads up! Be sure to read the Grid page first before diving into how to modify and customize your grid columns. -
    - -

    How they work

    + Columns · Bootstrap v5.3

    Learn how to modify columns with a handful of options for alignment, ordering, and offsetting thanks to our flexbox grid system. Plus, see how to use column classes to manage widths of non-grid elements.

    +

    Heads up! Be sure to read the Grid page first before diving into how to modify and customize your grid columns.

    +

    How they work

    • -

      Columns build on the grid’s flexbox architecture. Flexbox means we have options for changing individual columns and modifying groups of columns at the row level. You choose how columns grow, shrink, or otherwise change.

      +

      Columns build on the grid’s flexbox architecture. Flexbox means we have options for changing individual columns and modifying groups of columns at the row level. You choose how columns grow, shrink, or otherwise change.

    • -

      When building grid layouts, all content goes in columns. The hierarchy of Bootstrap’s grid goes from container to row to column to your content. On rare occasions, you may combine content and column, but be aware there can be unintended consequences.

      +

      When building grid layouts, all content goes in columns. The hierarchy of Bootstrap’s grid goes from container to row to column to your content. On rare occasions, you may combine content and column, but be aware there can be unintended consequences.

    • -

      Bootstrap includes predefined classes for creating fast, responsive layouts. With six breakpoints and a dozen columns at each grid tier, we have dozens of classes already built for you to create your desired layouts. This can be disabled via Sass if you wish.

      +

      Bootstrap includes predefined classes for creating fast, responsive layouts. With six breakpoints and a dozen columns at each grid tier, we have dozens of classes already built for you to create your desired layouts. This can be disabled via Sass if you wish.

    -

    Alignment

    +

    Alignment

    Use flexbox alignment utilities to vertically and horizontally align columns.

    -

    Vertical alignment

    +

    Vertical alignment

    Change the vertical alignment with any of the responsive align-items-* classes.

    -
    -
    - -
    +
    One of three columns @@ -609,37 +50,20 @@ One of three columns
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row align-items-start">
    -    <div class="col">
    -      One of three columns
    -    </div>
    -    <div class="col">
    -      One of three columns
    -    </div>
    -    <div class="col">
    -      One of three columns
    -    </div>
    -  </div>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="container text-center">
    +  <div class="row align-items-start">
    +    <div class="col">
    +      One of three columns
    +    </div>
    +    <div class="col">
    +      One of three columns
    +    </div>
    +    <div class="col">
    +      One of three columns
    +    </div>
    +  </div>
    +</div>
    +
    One of three columns @@ -651,37 +75,20 @@ One of three columns
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row align-items-center">
    -    <div class="col">
    -      One of three columns
    -    </div>
    -    <div class="col">
    -      One of three columns
    -    </div>
    -    <div class="col">
    -      One of three columns
    -    </div>
    -  </div>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="container text-center">
    +  <div class="row align-items-center">
    +    <div class="col">
    +      One of three columns
    +    </div>
    +    <div class="col">
    +      One of three columns
    +    </div>
    +    <div class="col">
    +      One of three columns
    +    </div>
    +  </div>
    +</div>
    +
    One of three columns @@ -693,38 +100,21 @@ One of three columns
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row align-items-end">
    -    <div class="col">
    -      One of three columns
    -    </div>
    -    <div class="col">
    -      One of three columns
    -    </div>
    -    <div class="col">
    -      One of three columns
    -    </div>
    -  </div>
    -</div>
    -
    - +
    html
    <div class="container text-center">
    +  <div class="row align-items-end">
    +    <div class="col">
    +      One of three columns
    +    </div>
    +    <div class="col">
    +      One of three columns
    +    </div>
    +    <div class="col">
    +      One of three columns
    +    </div>
    +  </div>
    +</div>

    Or, change the alignment of each column individually with any of the responsive .align-self-* classes.

    -
    -
    - -
    +
    One of three columns @@ -736,39 +126,22 @@ One of three columns
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row">
    -    <div class="col align-self-start">
    -      One of three columns
    -    </div>
    -    <div class="col align-self-center">
    -      One of three columns
    -    </div>
    -    <div class="col align-self-end">
    -      One of three columns
    -    </div>
    -  </div>
    -</div>
    -
    - -

    Horizontal alignment

    +
    html
    <div class="container text-center">
    +  <div class="row">
    +    <div class="col align-self-start">
    +      One of three columns
    +    </div>
    +    <div class="col align-self-center">
    +      One of three columns
    +    </div>
    +    <div class="col align-self-end">
    +      One of three columns
    +    </div>
    +  </div>
    +</div>
    +

    Horizontal alignment

    Change the horizontal alignment with any of the responsive justify-content-* classes.

    -
    -
    - -
    +
    One of two columns @@ -817,108 +190,74 @@ One of two columns
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row justify-content-start">
    -    <div class="col-4">
    -      One of two columns
    -    </div>
    -    <div class="col-4">
    -      One of two columns
    -    </div>
    -  </div>
    -  <div class="row justify-content-center">
    -    <div class="col-4">
    -      One of two columns
    -    </div>
    -    <div class="col-4">
    -      One of two columns
    -    </div>
    -  </div>
    -  <div class="row justify-content-end">
    -    <div class="col-4">
    -      One of two columns
    -    </div>
    -    <div class="col-4">
    -      One of two columns
    -    </div>
    -  </div>
    -  <div class="row justify-content-around">
    -    <div class="col-4">
    -      One of two columns
    -    </div>
    -    <div class="col-4">
    -      One of two columns
    -    </div>
    -  </div>
    -  <div class="row justify-content-between">
    -    <div class="col-4">
    -      One of two columns
    -    </div>
    -    <div class="col-4">
    -      One of two columns
    -    </div>
    -  </div>
    -  <div class="row justify-content-evenly">
    -    <div class="col-4">
    -      One of two columns
    -    </div>
    -    <div class="col-4">
    -      One of two columns
    -    </div>
    -  </div>
    -</div>
    -
    - -

    Column wrapping

    +
    html
    <div class="container text-center">
    +  <div class="row justify-content-start">
    +    <div class="col-4">
    +      One of two columns
    +    </div>
    +    <div class="col-4">
    +      One of two columns
    +    </div>
    +  </div>
    +  <div class="row justify-content-center">
    +    <div class="col-4">
    +      One of two columns
    +    </div>
    +    <div class="col-4">
    +      One of two columns
    +    </div>
    +  </div>
    +  <div class="row justify-content-end">
    +    <div class="col-4">
    +      One of two columns
    +    </div>
    +    <div class="col-4">
    +      One of two columns
    +    </div>
    +  </div>
    +  <div class="row justify-content-around">
    +    <div class="col-4">
    +      One of two columns
    +    </div>
    +    <div class="col-4">
    +      One of two columns
    +    </div>
    +  </div>
    +  <div class="row justify-content-between">
    +    <div class="col-4">
    +      One of two columns
    +    </div>
    +    <div class="col-4">
    +      One of two columns
    +    </div>
    +  </div>
    +  <div class="row justify-content-evenly">
    +    <div class="col-4">
    +      One of two columns
    +    </div>
    +    <div class="col-4">
    +      One of two columns
    +    </div>
    +  </div>
    +</div>
    +

    Column wrapping

    If more than 12 columns are placed within a single row, each group of extra columns will, as one unit, wrap onto a new line.

    -
    -
    - -
    +
    .col-9
    .col-4
    Since 9 + 4 = 13 > 12, this 4-column-wide div gets wrapped onto a new line as one contiguous unit.
    .col-6
    Subsequent columns continue along the new line.
    -
    - -
    - html -
    - - -
    -
    <div class="container">
    -  <div class="row">
    -    <div class="col-9">.col-9</div>
    -    <div class="col-4">.col-4<br>Since 9 + 4 = 13 &gt; 12, this 4-column-wide div gets wrapped onto a new line as one contiguous unit.</div>
    -    <div class="col-6">.col-6<br>Subsequent columns continue along the new line.</div>
    -  </div>
    -</div>
    -
    - -

    Column breaks

    +
    html
    <div class="container">
    +  <div class="row">
    +    <div class="col-9">.col-9</div>
    +    <div class="col-4">.col-4<br>Since 9 + 4 = 13 &gt; 12, this 4-column-wide div gets wrapped onto a new line as one contiguous unit.</div>
    +    <div class="col-6">.col-6<br>Subsequent columns continue along the new line.</div>
    +  </div>
    +</div>
    +

    Column breaks

    Breaking columns to a new line in flexbox requires a small hack: add an element with width: 100% wherever you want to wrap your columns to a new line. Normally this is accomplished with multiple .rows, but not every implementation method can account for this.

    -
    -
    - -
    +
    .col-6 .col-sm-3
    .col-6 .col-sm-3
    @@ -929,37 +268,20 @@
    .col-6 .col-sm-3
    .col-6 .col-sm-3
    -
    +
    html
    <div class="container text-center">
    +  <div class="row">
    +    <div class="col-6 col-sm-3">.col-6 .col-sm-3</div>
    +    <div class="col-6 col-sm-3">.col-6 .col-sm-3</div>
     
    -  
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row">
    -    <div class="col-6 col-sm-3">.col-6 .col-sm-3</div>
    -    <div class="col-6 col-sm-3">.col-6 .col-sm-3</div>
    -
    -    <!-- Force next columns to break to new line -->
    -    <div class="w-100"></div>
    -
    -    <div class="col-6 col-sm-3">.col-6 .col-sm-3</div>
    -    <div class="col-6 col-sm-3">.col-6 .col-sm-3</div>
    -  </div>
    -</div>
    -
    + <!-- Force next columns to break to new line --> + <div class="w-100"></div> -

    You may also apply this break at specific breakpoints with our responsive display utilities.

    -
    -
    - -
    + <div class="col-6 col-sm-3">.col-6 .col-sm-3</div> + <div class="col-6 col-sm-3">.col-6 .col-sm-3</div> + </div> +</div>
    +

    You may also apply this break at specific breakpoints with our responsive display utilities.

    +
    .col-6 .col-sm-4
    .col-6 .col-sm-4
    @@ -970,39 +292,22 @@
    .col-6 .col-sm-4
    .col-6 .col-sm-4
    -
    +
    html
    <div class="container text-center">
    +  <div class="row">
    +    <div class="col-6 col-sm-4">.col-6 .col-sm-4</div>
    +    <div class="col-6 col-sm-4">.col-6 .col-sm-4</div>
     
    -  
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row">
    -    <div class="col-6 col-sm-4">.col-6 .col-sm-4</div>
    -    <div class="col-6 col-sm-4">.col-6 .col-sm-4</div>
    -
    -    <!-- Force next columns to break to new line at md breakpoint and up -->
    -    <div class="w-100 d-none d-md-block"></div>
    -
    -    <div class="col-6 col-sm-4">.col-6 .col-sm-4</div>
    -    <div class="col-6 col-sm-4">.col-6 .col-sm-4</div>
    -  </div>
    -</div>
    -
    + <!-- Force next columns to break to new line at md breakpoint and up --> + <div class="w-100 d-none d-md-block"></div> -

    Reordering

    -

    Order classes

    + <div class="col-6 col-sm-4">.col-6 .col-sm-4</div> + <div class="col-6 col-sm-4">.col-6 .col-sm-4</div> + </div> +</div>
    +

    Reordering

    +

    Order classes

    Use .order- classes for controlling the visual order of your content. These classes are responsive, so you can set the order by breakpoint (e.g., .order-1.order-md-2). Includes support for 1 through 5 across all six grid tiers.

    -
    -
    - -
    +
    First in DOM, no order applied @@ -1014,38 +319,21 @@ Third in DOM, with an order of 1
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row">
    -    <div class="col">
    -      First in DOM, no order applied
    -    </div>
    -    <div class="col order-5">
    -      Second in DOM, with a larger order
    -    </div>
    -    <div class="col order-1">
    -      Third in DOM, with an order of 1
    -    </div>
    -  </div>
    -</div>
    -
    - +
    html
    <div class="container text-center">
    +  <div class="row">
    +    <div class="col">
    +      First in DOM, no order applied
    +    </div>
    +    <div class="col order-5">
    +      Second in DOM, with a larger order
    +    </div>
    +    <div class="col order-1">
    +      Third in DOM, with an order of 1
    +    </div>
    +  </div>
    +</div>

    There are also responsive .order-first and .order-last classes that change the order of an element by applying order: -1 and order: 6, respectively. These classes can also be intermixed with the numbered .order-* classes as needed.

    -
    -
    - -
    +
    First in DOM, ordered last @@ -1057,59 +345,43 @@ Third in DOM, ordered first
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row">
    -    <div class="col order-last">
    -      First in DOM, ordered last
    -    </div>
    -    <div class="col">
    -      Second in DOM, unordered
    -    </div>
    -    <div class="col order-first">
    -      Third in DOM, ordered first
    -    </div>
    -  </div>
    -</div>
    -
    - -

    If you need more .order-* classes, you can add new ones by modifying our $utilities Sass map. Read our Sass maps and loops docs or our Modify utilities docs for details.

    -
    $utilities: map-merge(
    -  $utilities,
    -  (
    -    "order": map-merge(
    -      map-get($utilities, "order"),
    -      (
    -        values: map-merge(
    -          map-get(map-get($utilities, "order"), "values"),
    -          (
    -            6: 6, // Add a new `.order-{breakpoint}-6` utility
    -            last: 7 // Change the `.order-{breakpoint}-last` utility to use the next number
    -          )
    -        ),
    -      ),
    -    ),
    -  )
    -);
    -

    Offsetting columns

    -

    You can offset grid columns in two ways: our responsive .offset- grid classes and our margin utilities. Grid classes are sized to match columns while margins are more useful for quick layouts where the width of the offset is variable.

    -

    Offset classes

    +
    html
    <div class="container text-center">
    +  <div class="row">
    +    <div class="col order-last">
    +      First in DOM, ordered last
    +    </div>
    +    <div class="col">
    +      Second in DOM, unordered
    +    </div>
    +    <div class="col order-first">
    +      Third in DOM, ordered first
    +    </div>
    +  </div>
    +</div>
    +

    If you need more .order-* classes, you can add new ones by modifying our $utilities Sass map. Read our Sass maps and loops docs or our Modify utilities docs for details.

    +
    $utilities: map-merge(
    +  $utilities,
    +  (
    +    "order": map-merge(
    +      map-get($utilities, "order"),
    +      (
    +        values: map-merge(
    +          map-get(map-get($utilities, "order"), "values"),
    +          (
    +            6: 6, // Add a new `.order-{breakpoint}-6` utility
    +            last: 7 // Change the `.order-{breakpoint}-last` utility to use the next number
    +          )
    +        ),
    +      ),
    +    ),
    +  )
    +);
    +
    +

    Offsetting columns

    +

    You can offset grid columns in two ways: our responsive .offset- grid classes and our margin utilities. Grid classes are sized to match columns while margins are more useful for quick layouts where the width of the offset is variable.

    +

    Offset classes

    Move columns to the right using .offset-md-* classes. These classes increase the left margin of a column by * columns. For example, .offset-md-4 moves .col-md-4 over four columns.

    -
    -
    - -
    +
    .col-md-4
    .col-md-4 .offset-md-4
    @@ -1121,38 +393,21 @@
    .col-md-6 .offset-md-3
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row">
    -    <div class="col-md-4">.col-md-4</div>
    -    <div class="col-md-4 offset-md-4">.col-md-4 .offset-md-4</div>
    -  </div>
    -  <div class="row">
    -    <div class="col-md-3 offset-md-3">.col-md-3 .offset-md-3</div>
    -    <div class="col-md-3 offset-md-3">.col-md-3 .offset-md-3</div>
    -  </div>
    -  <div class="row">
    -    <div class="col-md-6 offset-md-3">.col-md-6 .offset-md-3</div>
    -  </div>
    -</div>
    -
    - +
    html
    <div class="container text-center">
    +  <div class="row">
    +    <div class="col-md-4">.col-md-4</div>
    +    <div class="col-md-4 offset-md-4">.col-md-4 .offset-md-4</div>
    +  </div>
    +  <div class="row">
    +    <div class="col-md-3 offset-md-3">.col-md-3 .offset-md-3</div>
    +    <div class="col-md-3 offset-md-3">.col-md-3 .offset-md-3</div>
    +  </div>
    +  <div class="row">
    +    <div class="col-md-6 offset-md-3">.col-md-6 .offset-md-3</div>
    +  </div>
    +</div>

    In addition to column clearing at responsive breakpoints, you may need to reset offsets. See this in action in the grid example.

    -
    -
    - -
    +
    .col-sm-5 .col-md-6
    .col-sm-5 .offset-sm-2 .col-md-6 .offset-md-0
    @@ -1161,36 +416,19 @@
    .col-sm-6 .col-md-5 .col-lg-6
    .col-sm-6 .col-md-5 .offset-md-2 .col-lg-6 .offset-lg-0
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row">
    -    <div class="col-sm-5 col-md-6">.col-sm-5 .col-md-6</div>
    -    <div class="col-sm-5 offset-sm-2 col-md-6 offset-md-0">.col-sm-5 .offset-sm-2 .col-md-6 .offset-md-0</div>
    -  </div>
    -  <div class="row">
    -    <div class="col-sm-6 col-md-5 col-lg-6">.col-sm-6 .col-md-5 .col-lg-6</div>
    -    <div class="col-sm-6 col-md-5 offset-md-2 col-lg-6 offset-lg-0">.col-sm-6 .col-md-5 .offset-md-2 .col-lg-6 .offset-lg-0</div>
    -  </div>
    -</div>
    -
    - -

    Margin utilities

    +
    html
    <div class="container text-center">
    +  <div class="row">
    +    <div class="col-sm-5 col-md-6">.col-sm-5 .col-md-6</div>
    +    <div class="col-sm-5 offset-sm-2 col-md-6 offset-md-0">.col-sm-5 .offset-sm-2 .col-md-6 .offset-md-0</div>
    +  </div>
    +  <div class="row">
    +    <div class="col-sm-6 col-md-5 col-lg-6">.col-sm-6 .col-md-5 .col-lg-6</div>
    +    <div class="col-sm-6 col-md-5 offset-md-2 col-lg-6 offset-lg-0">.col-sm-6 .col-md-5 .offset-md-2 .col-lg-6 .offset-lg-0</div>
    +  </div>
    +</div>
    +

    Margin utilities

    With the move to flexbox in v4, you can use margin utilities like .me-auto to force sibling columns away from one another.

    -
    -
    - -
    +
    .col-md-4
    .col-md-4 .ms-auto
    @@ -1203,75 +441,41 @@
    .col-auto .me-auto
    .col-auto
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row">
    -    <div class="col-md-4">.col-md-4</div>
    -    <div class="col-md-4 ms-auto">.col-md-4 .ms-auto</div>
    -  </div>
    -  <div class="row">
    -    <div class="col-md-3 ms-md-auto">.col-md-3 .ms-md-auto</div>
    -    <div class="col-md-3 ms-md-auto">.col-md-3 .ms-md-auto</div>
    -  </div>
    -  <div class="row">
    -    <div class="col-auto me-auto">.col-auto .me-auto</div>
    -    <div class="col-auto">.col-auto</div>
    -  </div>
    -</div>
    -
    - -

    Standalone column classes

    +
    html
    <div class="container text-center">
    +  <div class="row">
    +    <div class="col-md-4">.col-md-4</div>
    +    <div class="col-md-4 ms-auto">.col-md-4 .ms-auto</div>
    +  </div>
    +  <div class="row">
    +    <div class="col-md-3 ms-md-auto">.col-md-3 .ms-md-auto</div>
    +    <div class="col-md-3 ms-md-auto">.col-md-3 .ms-md-auto</div>
    +  </div>
    +  <div class="row">
    +    <div class="col-auto me-auto">.col-auto .me-auto</div>
    +    <div class="col-auto">.col-auto</div>
    +  </div>
    +</div>
    +

    Standalone column classes

    The .col-* classes can also be used outside a .row to give an element a specific width. Whenever column classes are used as non-direct children of a row, the paddings are omitted.

    -
    -
    - -
    +
    .col-3: width of 25%
    .col-sm-9: width of 75% above sm breakpoint -
    +
    html
    <div class="col-3 p-3 mb-2">
    +  .col-3: width of 25%
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="col-3 p-3 mb-2">
    -  .col-3: width of 25%
    -</div>
    -
    -<div class="col-sm-9 p-3">
    -  .col-sm-9: width of 75% above sm breakpoint
    -</div>
    -
    - -

    The classes can be used together with utilities to create responsive floated images. Make sure to wrap the content in a .clearfix wrapper to clear the float if the text is shorter.

    -
    -
    - -
    - PlaceholderResponsive floated image +<div class="col-sm-9 p-3"> + .col-sm-9: width of 75% above sm breakpoint +</div>
    +

    The classes can be used together with utilities to create responsive floated images. Make sure to wrap the content in a .clearfix wrapper to clear the float if the text is shorter.

    +
    + PlaceholderResponsive floated image

    - A paragraph of placeholder text. We're using it here to show the use of the clearfix class. We're adding quite a few meaningless phrases here to demonstrate how the columns interact here with the floated image. + A paragraph of placeholder text. We’re using it here to show the use of the clearfix class. We’re adding quite a few meaningless phrases here to demonstrate how the columns interact here with the floated image.

    @@ -1279,111 +483,24 @@

    - And yet, here you are, still persevering in reading this placeholder text, hoping for some more insights, or some hidden easter egg of content. A joke, perhaps. Unfortunately, there's none of that here. + And yet, here you are, still persevering in reading this placeholder text, hoping for some more insights, or some hidden easter egg of content. A joke, perhaps. Unfortunately, there’s none of that here.

    -
    +
    html
    <div class="clearfix">
    +  <img src="..." class="col-md-6 float-md-end mb-3 ms-md-3" alt="...">
     
    -  
    - html -
    - - -
    -
    <div class="clearfix">
    -  <img src="..." class="col-md-6 float-md-end mb-3 ms-md-3" alt="...">
    -
    -  <p>
    -    A paragraph of placeholder text. We're using it here to show the use of the clearfix class. We're adding quite a few meaningless phrases here to demonstrate how the columns interact here with the floated image.
    -  </p>
    -
    -  <p>
    -    As you can see the paragraphs gracefully wrap around the floated image. Now imagine how this would look with some actual content in here, rather than just this boring placeholder text that goes on and on, but actually conveys no tangible information at. It simply takes up space and should not really be read.
    -  </p>
    -
    -  <p>
    -    And yet, here you are, still persevering in reading this placeholder text, hoping for some more insights, or some hidden easter egg of content. A joke, perhaps. Unfortunately, there's none of that here.
    -  </p>
    -</div>
    -
    + <p> + A paragraph of placeholder text. We’re using it here to show the use of the clearfix class. We’re adding quite a few meaningless phrases here to demonstrate how the columns interact here with the floated image. + </p> + <p> + As you can see the paragraphs gracefully wrap around the floated image. Now imagine how this would look with some actual content in here, rather than just this boring placeholder text that goes on and on, but actually conveys no tangible information at. It simply takes up space and should not really be read. + </p> -
    -
    -
    - - - - - - - - - - - - - - - + <p> + And yet, here you are, still persevering in reading this placeholder text, hoping for some more insights, or some hidden easter egg of content. A joke, perhaps. Unfortunately, there’s none of that here. + </p> +</div>
    \ No newline at end of file diff --git a/docs/5.3/layout/containers/index.html b/docs/5.3/layout/containers/index.html index 480443a8cd..a400b73f9a 100644 --- a/docs/5.3/layout/containers/index.html +++ b/docs/5.3/layout/containers/index.html @@ -1,569 +1,27 @@ - - - - - - - - - - - - - - - - -Containers · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Containers

    -
    -

    Containers are a fundamental building block of Bootstrap that contain, pad, and align your content within a given device or viewport.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    How they work

    + Containers · Bootstrap v5.3

    Containers

    Containers are a fundamental building block of Bootstrap that contain, pad, and align your content within a given device or viewport.

    +

    How they work

    Containers are the most basic layout element in Bootstrap and are required when using our default grid system. Containers are used to contain, pad, and (sometimes) center the content within them. While containers can be nested, most layouts do not require a nested container.

    Bootstrap comes with three different containers:

      @@ -571,213 +29,135 @@
    • .container-{breakpoint}, which is width: 100% until the specified breakpoint
    • .container-fluid, which is width: 100% at all breakpoints
    -

    The table below illustrates how each container’s max-width compares to the original .container and .container-fluid across each breakpoint.

    +

    The table below illustrates how each container’s max-width compares to the original .container and .container-fluid across each breakpoint.

    See them in action and compare them in our Grid example.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Extra small
    <576px
    Small
    ≥576px
    Medium
    ≥768px
    Large
    ≥992px
    X-Large
    ≥1200px
    XX-Large
    ≥1400px
    .container100%540px720px960px1140px1320px
    .container-sm100%540px720px960px1140px1320px
    .container-md100%100%720px960px1140px1320px
    .container-lg100%100%100%960px1140px1320px
    .container-xl100%100%100%100%1140px1320px
    .container-xxl100%100%100%100%100%1320px
    .container-fluid100%100%100%100%100%100%
    +
    -

    Default container

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Extra small
    <576px
    Small
    ≥576px
    Medium
    ≥768px
    Large
    ≥992px
    X-Large
    ≥1200px
    XX-Large
    ≥1400px
    .container100%540px720px960px1140px1320px
    .container-sm100%540px720px960px1140px1320px
    .container-md100%100%720px960px1140px1320px
    .container-lg100%100%100%960px1140px1320px
    .container-xl100%100%100%100%1140px1320px
    .container-xxl100%100%100%100%100%1320px
    .container-fluid100%100%100%100%100%100%
    +

    Default container

    Our default .container class is a responsive, fixed-width container, meaning its max-width changes at each breakpoint.

    -
    <div class="container">
    -  <!-- Content here -->
    -</div>
    -

    Responsive containers

    +
    <div class="container">
    +  <!-- Content here -->
    +</div>
    +
    +

    Responsive containers

    Responsive containers allow you to specify a class that is 100% wide until the specified breakpoint is reached, after which we apply max-widths for each of the higher breakpoints. For example, .container-sm is 100% wide to start until the sm breakpoint is reached, where it will scale up with md, lg, xl, and xxl.

    -
    <div class="container-sm">100% wide until small breakpoint</div>
    -<div class="container-md">100% wide until medium breakpoint</div>
    -<div class="container-lg">100% wide until large breakpoint</div>
    -<div class="container-xl">100% wide until extra large breakpoint</div>
    -<div class="container-xxl">100% wide until extra extra large breakpoint</div>
    -

    Fluid containers

    +
    <div class="container-sm">100% wide until small breakpoint</div>
    +<div class="container-md">100% wide until medium breakpoint</div>
    +<div class="container-lg">100% wide until large breakpoint</div>
    +<div class="container-xl">100% wide until extra large breakpoint</div>
    +<div class="container-xxl">100% wide until extra extra large breakpoint</div>
    +
    +

    Fluid containers

    Use .container-fluid for a full width container, spanning the entire width of the viewport.

    -
    <div class="container-fluid">
    -  ...
    -</div>
    -

    CSS

    -

    Sass variables

    +
    <div class="container-fluid">
    +  ...
    +</div>
    +
    +

    CSS

    +

    Sass variables

    As shown above, Bootstrap generates a series of predefined container classes to help you build the layouts you desire. You may customize these predefined container classes by modifying the Sass map (found in _variables.scss) that powers them:

    -
    -
    - scss/_variables.scss -
    - -
    -
    $container-max-widths: (
    -  sm: 540px,
    -  md: 720px,
    -  lg: 960px,
    -  xl: 1140px,
    -  xxl: 1320px
    -);
    -
    -

    For more information and examples on how to modify our Sass maps and variables, please refer to the Sass section of the Grid documentation.

    -

    Sass mixins

    +
    $container-max-widths: (
    +  sm: 540px,
    +  md: 720px,
    +  lg: 960px,
    +  xl: 1140px,
    +  xxl: 1320px
    +);
    +
    +

    For more information and examples on how to modify our Sass maps and variables, please refer to the Sass section of the Grid documentation.

    +

    Sass mixins

    In addition to customizing the Sass, you can also create your own containers with our Sass mixin.

    -
    // Source mixin
    -@mixin make-container($padding-x: $container-padding-x) {
    -  width: 100%;
    -  padding-right: $padding-x;
    -  padding-left: $padding-x;
    -  margin-right: auto;
    -  margin-left: auto;
    -}
    -
    -// Usage
    -.custom-container {
    -  @include make-container();
    -}
    -
    -
    -
    -
    +
    // Source mixin
    +@mixin make-container($padding-x: $container-padding-x) {
    +  width: 100%;
    +  padding-right: $padding-x;
    +  padding-left: $padding-x;
    +  margin-right: auto;
    +  margin-left: auto;
    +}
     
    -
    -    
    -
    -    
    -
    -
    -
    -
    -
    -    
    -  
    -
    -  
    -
    +// Usage
    +.custom-container {
    +  @include make-container();
    +}
    +
    \ No newline at end of file diff --git a/docs/5.3/layout/css-grid/index.html b/docs/5.3/layout/css-grid/index.html index fe41b715e5..225c089d6b 100644 --- a/docs/5.3/layout/css-grid/index.html +++ b/docs/5.3/layout/css-grid/index.html @@ -1,586 +1,29 @@ - - - - - - - - - - - - - - - - -CSS Grid · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    -
    Added in v5.1 - View on GitHub - -
    -

    CSS Grid

    -
    -

    Learn how to enable, use, and customize our alternate layout system built on CSS Grid with examples and code snippets.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Bootstrap’s default grid system represents the culmination of over a decade of CSS layout techniques, tried and tested by millions of people. But, it was also created without many of the modern CSS features and techniques we’re seeing in browsers like the new CSS Grid.

    -
    -Heads up—our CSS Grid system is experimental and opt-in as of v5.1.0! We included it in our documentation’s CSS to demonstrate it for you, but it’s disabled by default. Keep reading to learn how to enable it in your projects. -
    - -

    How it works

    -

    With Bootstrap 5, we’ve added the option to enable a separate grid system that’s built on CSS Grid, but with a Bootstrap twist. You still get classes you can apply on a whim to build responsive layouts, but with a different approach under the hood.

    + CSS Grid · Bootstrap v5.3
    +Added in v5.1 +View on GitHub +

    CSS Grid

    Learn how to enable, use, and customize our alternate layout system built on CSS Grid with examples and code snippets.

    +

    Bootstrap’s default grid system represents the culmination of over a decade of CSS layout techniques, tried and tested by millions of people. But, it was also created without many of the modern CSS features and techniques we’re seeing in browsers like the new CSS Grid.

    +

    Heads up—our CSS Grid system is experimental and opt-in as of v5.1.0! We included it in our documentation’s CSS to demonstrate it for you, but it’s disabled by default. Keep reading to learn how to enable it in your projects.

    +

    How it works

    +

    With Bootstrap 5, we’ve added the option to enable a separate grid system that’s built on CSS Grid, but with a Bootstrap twist. You still get classes you can apply on a whim to build responsive layouts, but with a different approach under the hood.

    • CSS Grid is opt-in. Disable the default grid system by setting $enable-grid-classes: false and enable the CSS Grid by setting $enable-cssgrid: true. Then, recompile your Sass.

      @@ -596,11 +39,11 @@

    In the future, Bootstrap will likely shift to a hybrid solution as the gap property has achieved nearly full browser support for flexbox.

    -

    Key differences

    +

    Key differences

    Compared to the default grid system:

    • -

      Flex utilities don’t affect the CSS Grid columns in the same way.

      +

      Flex utilities don’t affect the CSS Grid columns in the same way.

    • Gaps replaces gutters. The gap property replaces the horizontal padding from our default grid system and functions more like margin.

      @@ -615,152 +58,64 @@

      Nesting works similarly, but may require you to reset your column counts on each instance of a nested .grid. See the nesting section for details.

    -

    Examples

    -

    Three columns

    +

    Examples

    +

    Three columns

    Three equal-width columns across all viewports and devices can be created by using the .g-col-4 classes. Add responsive classes to change the layout by viewport size.

    -
    -
    - -
    +
    .g-col-4
    .g-col-4
    .g-col-4
    -
    - -
    - html -
    - - -
    -
    <div class="grid text-center">
    -  <div class="g-col-4">.g-col-4</div>
    -  <div class="g-col-4">.g-col-4</div>
    -  <div class="g-col-4">.g-col-4</div>
    -</div>
    -
    - -

    Responsive

    +
    html
    <div class="grid text-center">
    +  <div class="g-col-4">.g-col-4</div>
    +  <div class="g-col-4">.g-col-4</div>
    +  <div class="g-col-4">.g-col-4</div>
    +</div>
    +

    Responsive

    Use responsive classes to adjust your layout across viewports. Here we start with two columns on the narrowest viewports, and then grow to three columns on medium viewports and above.

    -
    -
    - -
    +
    .g-col-6 .g-col-md-4
    .g-col-6 .g-col-md-4
    .g-col-6 .g-col-md-4
    -
    - -
    - html -
    - - -
    -
    <div class="grid text-center">
    -  <div class="g-col-6 g-col-md-4">.g-col-6 .g-col-md-4</div>
    -  <div class="g-col-6 g-col-md-4">.g-col-6 .g-col-md-4</div>
    -  <div class="g-col-6 g-col-md-4">.g-col-6 .g-col-md-4</div>
    -</div>
    -
    - +
    html
    <div class="grid text-center">
    +  <div class="g-col-6 g-col-md-4">.g-col-6 .g-col-md-4</div>
    +  <div class="g-col-6 g-col-md-4">.g-col-6 .g-col-md-4</div>
    +  <div class="g-col-6 g-col-md-4">.g-col-6 .g-col-md-4</div>
    +</div>

    Compare that to this two column layout at all viewports.

    -
    -
    - -
    +
    .g-col-6
    .g-col-6
    -
    - -
    - html -
    - - -
    -
    <div class="grid text-center">
    -  <div class="g-col-6">.g-col-6</div>
    -  <div class="g-col-6">.g-col-6</div>
    -</div>
    -
    - -

    Wrapping

    -

    Grid items automatically wrap to the next line when there’s no more room horizontally. Note that the gap applies to horizontal and vertical gaps between grid items.

    -
    -
    - -
    +
    html
    <div class="grid text-center">
    +  <div class="g-col-6">.g-col-6</div>
    +  <div class="g-col-6">.g-col-6</div>
    +</div>
    +

    Wrapping

    +

    Grid items automatically wrap to the next line when there’s no more room horizontally. Note that the gap applies to horizontal and vertical gaps between grid items.

    +
    .g-col-6
    .g-col-6
    .g-col-6
    .g-col-6
    -
    +
    html
    <div class="grid text-center">
    +  <div class="g-col-6">.g-col-6</div>
    +  <div class="g-col-6">.g-col-6</div>
     
    -  
    - html -
    - - -
    -
    <div class="grid text-center">
    -  <div class="g-col-6">.g-col-6</div>
    -  <div class="g-col-6">.g-col-6</div>
    -
    -  <div class="g-col-6">.g-col-6</div>
    -  <div class="g-col-6">.g-col-6</div>
    -</div>
    -
    - -

    Starts

    -

    Start classes aim to replace our default grid’s offset classes, but they’re not entirely the same. CSS Grid creates a grid template through styles that tell browsers to “start at this column” and “end at this column.” Those properties are grid-column-start and grid-column-end. Start classes are shorthand for the former. Pair them with the column classes to size and align your columns however you need. Start classes begin at 1 as 0 is an invalid value for these properties.

    -
    -
    - -
    + <div class="g-col-6">.g-col-6</div> + <div class="g-col-6">.g-col-6</div> +</div>
    +

    Starts

    +

    Start classes aim to replace our default grid’s offset classes, but they’re not entirely the same. CSS Grid creates a grid template through styles that tell browsers to “start at this column” and “end at this column”. Those properties are grid-column-start and grid-column-end. Start classes are shorthand for the former. Pair them with the column classes to size and align your columns however you need. Start classes begin at 1 as 0 is an invalid value for these properties.

    +
    .g-col-3 .g-start-2
    .g-col-4 .g-start-6
    -
    - -
    - html -
    - - -
    -
    <div class="grid text-center">
    -  <div class="g-col-3 g-start-2">.g-col-3 .g-start-2</div>
    -  <div class="g-col-4 g-start-6">.g-col-4 .g-start-6</div>
    -</div>
    -
    - -

    Auto columns

    +
    html
    <div class="grid text-center">
    +  <div class="g-col-3 g-start-2">.g-col-3 .g-start-2</div>
    +  <div class="g-col-4 g-start-6">.g-col-4 .g-start-6</div>
    +</div>
    +

    Auto columns

    When there are no classes on the grid items (the immediate children of a .grid), each grid item will automatically be sized to one column.

    -
    -
    - -
    +
    1
    1
    1
    @@ -773,39 +128,22 @@
    1
    1
    1
    -
    - -
    - html -
    - - -
    -
    <div class="grid text-center">
    -  <div>1</div>
    -  <div>1</div>
    -  <div>1</div>
    -  <div>1</div>
    -  <div>1</div>
    -  <div>1</div>
    -  <div>1</div>
    -  <div>1</div>
    -  <div>1</div>
    -  <div>1</div>
    -  <div>1</div>
    -  <div>1</div>
    -</div>
    -
    - +
    html
    <div class="grid text-center">
    +  <div>1</div>
    +  <div>1</div>
    +  <div>1</div>
    +  <div>1</div>
    +  <div>1</div>
    +  <div>1</div>
    +  <div>1</div>
    +  <div>1</div>
    +  <div>1</div>
    +  <div>1</div>
    +  <div>1</div>
    +  <div>1</div>
    +</div>

    This behavior can be mixed with grid column classes.

    -
    -
    - -
    +
    .g-col-6
    1
    1
    @@ -813,42 +151,25 @@
    1
    1
    1
    -
    - -
    - html -
    - - -
    -
    <div class="grid text-center">
    -  <div class="g-col-6">.g-col-6</div>
    -  <div>1</div>
    -  <div>1</div>
    -  <div>1</div>
    -  <div>1</div>
    -  <div>1</div>
    -  <div>1</div>
    -</div>
    -
    - -

    Nesting

    +
    html
    <div class="grid text-center">
    +  <div class="g-col-6">.g-col-6</div>
    +  <div>1</div>
    +  <div>1</div>
    +  <div>1</div>
    +  <div>1</div>
    +  <div>1</div>
    +  <div>1</div>
    +</div>
    +

    Nesting

    Similar to our default grid system, our CSS Grid allows for easy nesting of .grids. However, unlike the default, this grid inherits changes in the rows, columns, and gaps. Consider the example below:

    • We override the default number of columns with a local CSS variable: --bs-columns: 3.
    • In the first auto-column, the column count is inherited and each column is one-third of the available width.
    • -
    • In the second auto-column, we’ve reset the column count on the nested .grid to 12 (our default).
    • +
    • In the second auto-column, we’ve reset the column count on the nested .grid to 12 (our default).
    • The third auto-column has no nested content.

    In practice this allows for more complex and custom layouts when compared to our default grid system.

    -
    -
    - -
    +
    First auto-column
    @@ -865,342 +186,135 @@
    Third auto-column
    -
    - -
    - html -
    - - -
    -
    <div class="grid text-center overflow-x-auto" style="--bs-columns: 3;">
    -  <div>
    -    First auto-column
    -    <div class="grid">
    -      <div>Auto-column</div>
    -      <div>Auto-column</div>
    -    </div>
    -  </div>
    -  <div>
    -    Second auto-column
    -    <div class="grid" style="--bs-columns: 12;">
    -      <div class="g-col-6">6 of 12</div>
    -      <div class="g-col-4">4 of 12</div>
    -      <div class="g-col-2">2 of 12</div>
    -    </div>
    -  </div>
    -  <div>Third auto-column</div>
    -</div>
    -
    - -

    Customizing

    +
    html
    <div class="grid text-center overflow-x-auto" style="--bs-columns: 3;">
    +  <div>
    +    First auto-column
    +    <div class="grid">
    +      <div>Auto-column</div>
    +      <div>Auto-column</div>
    +    </div>
    +  </div>
    +  <div>
    +    Second auto-column
    +    <div class="grid" style="--bs-columns: 12;">
    +      <div class="g-col-6">6 of 12</div>
    +      <div class="g-col-4">4 of 12</div>
    +      <div class="g-col-2">2 of 12</div>
    +    </div>
    +  </div>
    +  <div>Third auto-column</div>
    +</div>
    +

    Customizing

    Customize the number of columns, the number of rows, and the width of the gaps with local CSS variables.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - -
    VariableFallback valueDescription
    --bs-rows1The number of rows in your grid template
    --bs-columns12The number of columns in your grid template
    --bs-gap1.5remThe size of the gap between columns (vertical and horizontal)
    +
    -

    These CSS variables have no default value; instead, they apply fallback values that are used until a local instance is provided. For example, we use var(--bs-rows, 1) for our CSS Grid rows, which ignores --bs-rows because that hasn’t been set anywhere yet. Once it is, the .grid instance will use that value instead of the fallback value of 1.

    -

    No grid classes

    -

    Immediate children elements of .grid are grid items, so they’ll be sized without explicitly adding a .g-col class.

    -
    -
    - -
    + + + + + + + + + + + + + + + + + + + + + + + +
    VariableFallback valueDescription
    --bs-rows1The number of rows in your grid template
    --bs-columns12The number of columns in your grid template
    --bs-gap1.5remThe size of the gap between columns (vertical and horizontal)
    +

    These CSS variables have no default value; instead, they apply fallback values that are used until a local instance is provided. For example, we use var(--bs-rows, 1) for our CSS Grid rows, which ignores --bs-rows because that hasn’t been set anywhere yet. Once it is, the .grid instance will use that value instead of the fallback value of 1.

    +

    No grid classes

    +

    Immediate children elements of .grid are grid items, so they’ll be sized without explicitly adding a .g-col class.

    +
    Auto-column
    Auto-column
    Auto-column
    -
    - -
    - html -
    - - -
    -
    <div class="grid text-center" style="--bs-columns: 3;">
    -  <div>Auto-column</div>
    -  <div>Auto-column</div>
    -  <div>Auto-column</div>
    -</div>
    -
    - -

    Columns and gaps

    +
    html
    <div class="grid text-center" style="--bs-columns: 3;">
    +  <div>Auto-column</div>
    +  <div>Auto-column</div>
    +  <div>Auto-column</div>
    +</div>
    +

    Columns and gaps

    Adjust the number of columns and the gap.

    -
    -
    - -
    +
    .g-col-2
    .g-col-2
    -
    - -
    - html -
    - - -
    -
    <div class="grid text-center" style="--bs-columns: 4; --bs-gap: 5rem;">
    -  <div class="g-col-2">.g-col-2</div>
    -  <div class="g-col-2">.g-col-2</div>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="grid text-center" style="--bs-columns: 4; --bs-gap: 5rem;">
    +  <div class="g-col-2">.g-col-2</div>
    +  <div class="g-col-2">.g-col-2</div>
    +</div>
    +
    .g-col-6
    .g-col-4
    -
    - -
    - html -
    - - -
    -
    <div class="grid text-center" style="--bs-columns: 10; --bs-gap: 1rem;">
    -  <div class="g-col-6">.g-col-6</div>
    -  <div class="g-col-4">.g-col-4</div>
    -</div>
    -
    - -

    Adding rows

    +
    html
    <div class="grid text-center" style="--bs-columns: 10; --bs-gap: 1rem;">
    +  <div class="g-col-6">.g-col-6</div>
    +  <div class="g-col-4">.g-col-4</div>
    +</div>
    +

    Adding rows

    Adding more rows and changing the placement of columns:

    -
    -
    - -
    +
    Auto-column
    Auto-column
    Auto-column
    -
    - -
    - html -
    - - -
    -
    <div class="grid text-center" style="--bs-rows: 3; --bs-columns: 3;">
    -  <div>Auto-column</div>
    -  <div class="g-start-2" style="grid-row: 2">Auto-column</div>
    -  <div class="g-start-3" style="grid-row: 3">Auto-column</div>
    -</div>
    -
    - -

    Gaps

    +
    html
    <div class="grid text-center" style="--bs-rows: 3; --bs-columns: 3;">
    +  <div>Auto-column</div>
    +  <div class="g-start-2" style="grid-row: 2">Auto-column</div>
    +  <div class="g-start-3" style="grid-row: 3">Auto-column</div>
    +</div>
    +

    Gaps

    Change the vertical gaps only by modifying the row-gap. Note that we use gap on .grids, but row-gap and column-gap can be modified as needed.

    -
    -
    - -
    +
    .g-col-6
    .g-col-6
    .g-col-6
    .g-col-6
    -
    - -
    - html -
    - - -
    -
    <div class="grid text-center" style="row-gap: 0;">
    -  <div class="g-col-6">.g-col-6</div>
    -  <div class="g-col-6">.g-col-6</div>
    -
    -  <div class="g-col-6">.g-col-6</div>
    -  <div class="g-col-6">.g-col-6</div>
    -</div>
    -
    +
    html
    <div class="grid text-center" style="row-gap: 0;">
    +  <div class="g-col-6">.g-col-6</div>
    +  <div class="g-col-6">.g-col-6</div>
     
    +  <div class="g-col-6">.g-col-6</div>
    +  <div class="g-col-6">.g-col-6</div>
    +</div>

    Because of that, you can have different vertical and horizontal gaps, which can take a single value (all sides) or a pair of values (vertical and horizontal). This can be applied with an inline style for gap, or with our --bs-gap CSS variable.

    -
    -
    - -
    +
    .g-col-6
    .g-col-6
    .g-col-6
    .g-col-6
    -
    +
    html
    <div class="grid text-center" style="--bs-gap: .25rem 1rem;">
    +  <div class="g-col-6">.g-col-6</div>
    +  <div class="g-col-6">.g-col-6</div>
     
    -  
    - html -
    - - -
    -
    <div class="grid text-center" style="--bs-gap: .25rem 1rem;">
    -  <div class="g-col-6">.g-col-6</div>
    -  <div class="g-col-6">.g-col-6</div>
    -
    -  <div class="g-col-6">.g-col-6</div>
    -  <div class="g-col-6">.g-col-6</div>
    -</div>
    -
    - -

    Sass

    + <div class="g-col-6">.g-col-6</div> + <div class="g-col-6">.g-col-6</div> +</div>
    +

    Sass

    One limitation of the CSS Grid is that our default classes are still generated by two Sass variables, $grid-columns and $grid-gutter-width. This effectively predetermines the number of classes generated in our compiled CSS. You have two options here:

    • Modify those default Sass variables and recompile your CSS.
    • Use inline or custom styles to augment the provided classes.
    -

    For example, you can increase the column count and change the gap size, and then size your “columns” with a mix of inline styles and predefined CSS Grid column classes (e.g., .g-col-4).

    -
    -
    - -
    +

    For example, you can increase the column count and change the gap size, and then size your “columns” with a mix of inline styles and predefined CSS Grid column classes (e.g., .g-col-4).

    +
    14 columns
    .g-col-4
    -
    - -
    - html -
    - - -
    -
    <div class="grid text-center" style="--bs-columns: 18; --bs-gap: .5rem;">
    -  <div style="grid-column: span 14;">14 columns</div>
    -  <div class="g-col-4">.g-col-4</div>
    -</div>
    -
    - - -
    -
    -
    - - - - - - - - - - - - - - - +
    html
    <div class="grid text-center" style="--bs-columns: 18; --bs-gap: .5rem;">
    +  <div style="grid-column: span 14;">14 columns</div>
    +  <div class="g-col-4">.g-col-4</div>
    +</div>
    \ No newline at end of file diff --git a/docs/5.3/layout/grid/index.html b/docs/5.3/layout/grid/index.html index 3e4ae9ded9..c76f6d38cb 100644 --- a/docs/5.3/layout/grid/index.html +++ b/docs/5.3/layout/grid/index.html @@ -1,600 +1,30 @@ - - - - - - - - - - - - - - - - -Grid system · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Grid system

    -
    -

    Use our powerful mobile-first flexbox grid to build layouts of all shapes and sizes thanks to a twelve column system, six default responsive tiers, Sass variables and mixins, and dozens of predefined classes.

    - - -
    - - - - - -
    - - -

    Example

    -

    Bootstrap’s grid system uses a series of containers, rows, and columns to layout and align content. It’s built with flexbox and is fully responsive. Below is an example and an in-depth explanation for how the grid system comes together.

    -
    -New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets. -
    - -
    -
    - -
    + Grid system · Bootstrap v5.3

    Grid system

    Use our powerful mobile-first flexbox grid to build layouts of all shapes and sizes thanks to a twelve column system, six default responsive tiers, Sass variables and mixins, and dozens of predefined classes.

    +

    Example

    +

    Bootstrap’s grid system uses a series of containers, rows, and columns to layout and align content. It’s built with flexbox and is fully responsive. Below is an example and an in-depth explanation for how the grid system comes together.

    +

    New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets.

    +
    Column @@ -606,59 +36,45 @@ Column
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row">
    -    <div class="col">
    -      Column
    -    </div>
    -    <div class="col">
    -      Column
    -    </div>
    -    <div class="col">
    -      Column
    -    </div>
    -  </div>
    -</div>
    -
    - +
    html
    <div class="container text-center">
    +  <div class="row">
    +    <div class="col">
    +      Column
    +    </div>
    +    <div class="col">
    +      Column
    +    </div>
    +    <div class="col">
    +      Column
    +    </div>
    +  </div>
    +</div>

    The above example creates three equal-width columns across all devices and viewports using our predefined grid classes. Those columns are centered in the page with the parent .container.

    -

    How it works

    -

    Breaking it down, here’s how the grid system comes together:

    +

    How it works

    +

    Breaking it down, here’s how the grid system comes together:

    • -

      Our grid supports six responsive breakpoints. Breakpoints are based on min-width media queries, meaning they affect that breakpoint and all those above it (e.g., .col-sm-4 applies to sm, md, lg, xl, and xxl). This means you can control container and column sizing and behavior by each breakpoint.

      +

      Our grid supports six responsive breakpoints. Breakpoints are based on min-width media queries, meaning they affect that breakpoint and all those above it (e.g., .col-sm-4 applies to sm, md, lg, xl, and xxl). This means you can control container and column sizing and behavior by each breakpoint.

    • Containers center and horizontally pad your content. Use .container for a responsive pixel width, .container-fluid for width: 100% across all viewports and devices, or a responsive container (e.g., .container-md) for a combination of fluid and pixel widths.

    • -

      Rows are wrappers for columns. Each column has horizontal padding (called a gutter) for controlling the space between them. This padding is then counteracted on the rows with negative margins to ensure the content in your columns is visually aligned down the left side. Rows also support modifier classes to uniformly apply column sizing and gutter classes to change the spacing of your content.

      +

      Rows are wrappers for columns. Each column has horizontal padding (called a gutter) for controlling the space between them. This padding is then counteracted on the rows with negative margins to ensure the content in your columns is visually aligned down the left side. Rows also support modifier classes to uniformly apply column sizing and gutter classes to change the spacing of your content.

    • Columns are incredibly flexible. There are 12 template columns available per row, allowing you to create different combinations of elements that span any number of columns. Column classes indicate the number of template columns to span (e.g., col-4 spans four). widths are set in percentages so you always have the same relative sizing.

    • -

      Gutters are also responsive and customizable. Gutter classes are available across all breakpoints, with all the same sizes as our margin and padding spacing. Change horizontal gutters with .gx-* classes, vertical gutters with .gy-*, or all gutters with .g-* classes. .g-0 is also available to remove gutters.

      +

      Gutters are also responsive and customizable. Gutter classes are available across all breakpoints, with all the same sizes as our margin and padding spacing. Change horizontal gutters with .gx-* classes, vertical gutters with .gy-*, or all gutters with .g-* classes. .g-0 is also available to remove gutters.

    • -

      Sass variables, maps, and mixins power the grid. If you don’t want to use the predefined grid classes in Bootstrap, you can use our grid’s source Sass to create your own with more semantic markup. We also include some CSS custom properties to consume these Sass variables for even greater flexibility for you.

      +

      Sass variables, maps, and mixins power the grid. If you don’t want to use the predefined grid classes in Bootstrap, you can use our grid’s source Sass to create your own with more semantic markup. We also include some CSS custom properties to consume these Sass variables for even greater flexibility for you.

    Be aware of the limitations and bugs around flexbox, like the inability to use some HTML elements as flex containers.

    -

    Grid options

    -

    Bootstrap’s grid system can adapt across all six default breakpoints, and any breakpoints you customize. The six default grid tiers are as follows:

    +

    Grid options

    +

    Bootstrap’s grid system can adapt across all six default breakpoints, and any breakpoints you customize. The six default grid tiers are as follows:

    • Extra small (xs)
    • Small (sm)
    • @@ -667,88 +83,13 @@
    • Extra large (xl)
    • Extra extra large (xxl)
    -

    As noted above, each of these breakpoints have their own container, unique class prefix, and modifiers. Here’s how the grid changes across these breakpoints:

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - xs
    - <576px -
    - sm
    - ≥576px -
    - md
    - ≥768px -
    - lg
    - ≥992px -
    - xl
    - ≥1200px -
    - xxl
    - ≥1400px -
    Container max-widthNone (auto)540px720px960px1140px1320px
    Class prefix.col-.col-sm-.col-md-.col-lg-.col-xl-.col-xxl-
    # of columns12
    Gutter width1.5rem (.75rem on left and right)
    Custom guttersYes
    NestableYes
    Column orderingYes
    -
    -

    Auto-layout columns

    +

    As noted above, each of these breakpoints have their own container, unique class prefix, and modifiers. Here’s how the grid changes across these breakpoints:

    +
    xs
    <576px
    sm
    ≥576px
    md
    ≥768px
    lg
    ≥992px
    xl
    ≥1200px
    xxl
    ≥1400px
    Container max-widthNone (auto)540px720px960px1140px1320px
    Class prefix.col-.col-sm-.col-md-.col-lg-.col-xl-.col-xxl-
    # of columns12
    Gutter width1.5rem (.75rem on left and right)
    Custom guttersYes
    NestableYes
    Column orderingYes
    +

    Auto-layout columns

    Utilize breakpoint-specific column classes for easy column sizing without an explicit numbered class like .col-sm-6.

    -

    Equal-width

    +

    Equal-width

    For example, here are two grid layouts that apply to every device and viewport, from xs to xxl. Add any number of unit-less classes for each breakpoint you need and every column will be the same width.

    -
    -
    - -
    +
    1 of 2 @@ -768,47 +109,30 @@ 3 of 3
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row">
    -    <div class="col">
    -      1 of 2
    -    </div>
    -    <div class="col">
    -      2 of 2
    -    </div>
    -  </div>
    -  <div class="row">
    -    <div class="col">
    -      1 of 3
    -    </div>
    -    <div class="col">
    -      2 of 3
    -    </div>
    -    <div class="col">
    -      3 of 3
    -    </div>
    -  </div>
    -</div>
    -
    - -

    Setting one column width

    +
    html
    <div class="container text-center">
    +  <div class="row">
    +    <div class="col">
    +      1 of 2
    +    </div>
    +    <div class="col">
    +      2 of 2
    +    </div>
    +  </div>
    +  <div class="row">
    +    <div class="col">
    +      1 of 3
    +    </div>
    +    <div class="col">
    +      2 of 3
    +    </div>
    +    <div class="col">
    +      3 of 3
    +    </div>
    +  </div>
    +</div>
    +

    Setting one column width

    Auto-layout for flexbox grid columns also means you can set the width of one column and have the sibling columns automatically resize around it. You may use predefined grid classes (as shown below), grid mixins, or inline widths. Note that the other columns will resize no matter the width of the center column.

    -
    -
    - -
    +
    1 of 3 @@ -831,50 +155,33 @@ 3 of 3
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row">
    -    <div class="col">
    -      1 of 3
    -    </div>
    -    <div class="col-6">
    -      2 of 3 (wider)
    -    </div>
    -    <div class="col">
    -      3 of 3
    -    </div>
    -  </div>
    -  <div class="row">
    -    <div class="col">
    -      1 of 3
    -    </div>
    -    <div class="col-5">
    -      2 of 3 (wider)
    -    </div>
    -    <div class="col">
    -      3 of 3
    -    </div>
    -  </div>
    -</div>
    -
    - -

    Variable width content

    +
    html
    <div class="container text-center">
    +  <div class="row">
    +    <div class="col">
    +      1 of 3
    +    </div>
    +    <div class="col-6">
    +      2 of 3 (wider)
    +    </div>
    +    <div class="col">
    +      3 of 3
    +    </div>
    +  </div>
    +  <div class="row">
    +    <div class="col">
    +      1 of 3
    +    </div>
    +    <div class="col-5">
    +      2 of 3 (wider)
    +    </div>
    +    <div class="col">
    +      3 of 3
    +    </div>
    +  </div>
    +</div>
    +

    Variable width content

    Use col-{breakpoint}-auto classes to size columns based on the natural width of their content.

    -
    -
    - -
    +
    1 of 3 @@ -897,52 +204,35 @@ 3 of 3
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row justify-content-md-center">
    -    <div class="col col-lg-2">
    -      1 of 3
    -    </div>
    -    <div class="col-md-auto">
    -      Variable width content
    -    </div>
    -    <div class="col col-lg-2">
    -      3 of 3
    -    </div>
    -  </div>
    -  <div class="row">
    -    <div class="col">
    -      1 of 3
    -    </div>
    -    <div class="col-md-auto">
    -      Variable width content
    -    </div>
    -    <div class="col col-lg-2">
    -      3 of 3
    -    </div>
    -  </div>
    -</div>
    -
    - -

    Responsive classes

    -

    Bootstrap’s grid includes six tiers of predefined classes for building complex responsive layouts. Customize the size of your columns on extra small, small, medium, large, or extra large devices however you see fit.

    -

    All breakpoints

    +
    html
    <div class="container text-center">
    +  <div class="row justify-content-md-center">
    +    <div class="col col-lg-2">
    +      1 of 3
    +    </div>
    +    <div class="col-md-auto">
    +      Variable width content
    +    </div>
    +    <div class="col col-lg-2">
    +      3 of 3
    +    </div>
    +  </div>
    +  <div class="row">
    +    <div class="col">
    +      1 of 3
    +    </div>
    +    <div class="col-md-auto">
    +      Variable width content
    +    </div>
    +    <div class="col col-lg-2">
    +      3 of 3
    +    </div>
    +  </div>
    +</div>
    +

    Responsive classes

    +

    Bootstrap’s grid includes six tiers of predefined classes for building complex responsive layouts. Customize the size of your columns on extra small, small, medium, large, or extra large devices however you see fit.

    +

    All breakpoints

    For grids that are the same from the smallest of devices to the largest, use the .col and .col-* classes. Specify a numbered class when you need a particularly sized column; otherwise, feel free to stick to .col.

    -
    -
    - -
    +
    col
    col
    @@ -953,38 +243,21 @@
    col-8
    col-4
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row">
    -    <div class="col">col</div>
    -    <div class="col">col</div>
    -    <div class="col">col</div>
    -    <div class="col">col</div>
    -  </div>
    -  <div class="row">
    -    <div class="col-8">col-8</div>
    -    <div class="col-4">col-4</div>
    -  </div>
    -</div>
    -
    - -

    Stacked to horizontal

    +
    html
    <div class="container text-center">
    +  <div class="row">
    +    <div class="col">col</div>
    +    <div class="col">col</div>
    +    <div class="col">col</div>
    +    <div class="col">col</div>
    +  </div>
    +  <div class="row">
    +    <div class="col-8">col-8</div>
    +    <div class="col-4">col-4</div>
    +  </div>
    +</div>
    +

    Stacked to horizontal

    Using a single set of .col-sm-* classes, you can create a basic grid system that starts out stacked and becomes horizontal at the small breakpoint (sm).

    -
    -
    - -
    +
    col-sm-8
    col-sm-4
    @@ -994,37 +267,20 @@
    col-sm
    col-sm
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row">
    -    <div class="col-sm-8">col-sm-8</div>
    -    <div class="col-sm-4">col-sm-4</div>
    -  </div>
    -  <div class="row">
    -    <div class="col-sm">col-sm</div>
    -    <div class="col-sm">col-sm</div>
    -    <div class="col-sm">col-sm</div>
    -  </div>
    -</div>
    -
    - -

    Mix and match

    -

    Don’t want your columns to simply stack in some grid tiers? Use a combination of different classes for each tier as needed. See the example below for a better idea of how it all works.

    -
    -
    - -
    +
    html
    <div class="container text-center">
    +  <div class="row">
    +    <div class="col-sm-8">col-sm-8</div>
    +    <div class="col-sm-4">col-sm-4</div>
    +  </div>
    +  <div class="row">
    +    <div class="col-sm">col-sm</div>
    +    <div class="col-sm">col-sm</div>
    +    <div class="col-sm">col-sm</div>
    +  </div>
    +</div>
    +

    Mix and match

    +

    Don’t want your columns to simply stack in some grid tiers? Use a combination of different classes for each tier as needed. See the example below for a better idea of how it all works.

    +
    .col-md-8
    @@ -1043,251 +299,133 @@
    .col-6
    .col-6
    -
    +
    html
    <div class="container text-center">
    +  <!-- Stack the columns on mobile by making one full-width and the other half-width -->
    +  <div class="row">
    +    <div class="col-md-8">.col-md-8</div>
    +    <div class="col-6 col-md-4">.col-6 .col-md-4</div>
    +  </div>
     
    -  
    - html -
    - - -
    -
    <div class="container text-center">
    -  <!-- Stack the columns on mobile by making one full-width and the other half-width -->
    -  <div class="row">
    -    <div class="col-md-8">.col-md-8</div>
    -    <div class="col-6 col-md-4">.col-6 .col-md-4</div>
    -  </div>
    -
    -  <!-- Columns start at 50% wide on mobile and bump up to 33.3% wide on desktop -->
    -  <div class="row">
    -    <div class="col-6 col-md-4">.col-6 .col-md-4</div>
    -    <div class="col-6 col-md-4">.col-6 .col-md-4</div>
    -    <div class="col-6 col-md-4">.col-6 .col-md-4</div>
    -  </div>
    -
    -  <!-- Columns are always 50% wide, on mobile and desktop -->
    -  <div class="row">
    -    <div class="col-6">.col-6</div>
    -    <div class="col-6">.col-6</div>
    -  </div>
    -</div>
    -
    + <!-- Columns start at 50% wide on mobile and bump up to 33.3% wide on desktop --> + <div class="row"> + <div class="col-6 col-md-4">.col-6 .col-md-4</div> + <div class="col-6 col-md-4">.col-6 .col-md-4</div> + <div class="col-6 col-md-4">.col-6 .col-md-4</div> + </div> -

    Row columns

    + <!-- Columns are always 50% wide, on mobile and desktop --> + <div class="row"> + <div class="col-6">.col-6</div> + <div class="col-6">.col-6</div> + </div> +</div>
    +

    Row columns

    Use the responsive .row-cols-* classes to quickly set the number of columns that best render your content and layout. Whereas normal .col-* classes apply to the individual columns (e.g., .col-md-4), the row columns classes are set on the parent .row as a shortcut. With .row-cols-auto you can give the columns their natural width.

    Use these row columns classes to quickly create basic grid layouts or to control your card layouts.

    -
    -
    - -
    +
    Column
    Column
    Column
    Column
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row row-cols-2">
    -    <div class="col">Column</div>
    -    <div class="col">Column</div>
    -    <div class="col">Column</div>
    -    <div class="col">Column</div>
    -  </div>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="container text-center">
    +  <div class="row row-cols-2">
    +    <div class="col">Column</div>
    +    <div class="col">Column</div>
    +    <div class="col">Column</div>
    +    <div class="col">Column</div>
    +  </div>
    +</div>
    +
    Column
    Column
    Column
    Column
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row row-cols-3">
    -    <div class="col">Column</div>
    -    <div class="col">Column</div>
    -    <div class="col">Column</div>
    -    <div class="col">Column</div>
    -  </div>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="container text-center">
    +  <div class="row row-cols-3">
    +    <div class="col">Column</div>
    +    <div class="col">Column</div>
    +    <div class="col">Column</div>
    +    <div class="col">Column</div>
    +  </div>
    +</div>
    +
    Column
    Column
    Column
    Column
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row row-cols-auto">
    -    <div class="col">Column</div>
    -    <div class="col">Column</div>
    -    <div class="col">Column</div>
    -    <div class="col">Column</div>
    -  </div>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="container text-center">
    +  <div class="row row-cols-auto">
    +    <div class="col">Column</div>
    +    <div class="col">Column</div>
    +    <div class="col">Column</div>
    +    <div class="col">Column</div>
    +  </div>
    +</div>
    +
    Column
    Column
    Column
    Column
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row row-cols-4">
    -    <div class="col">Column</div>
    -    <div class="col">Column</div>
    -    <div class="col">Column</div>
    -    <div class="col">Column</div>
    -  </div>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="container text-center">
    +  <div class="row row-cols-4">
    +    <div class="col">Column</div>
    +    <div class="col">Column</div>
    +    <div class="col">Column</div>
    +    <div class="col">Column</div>
    +  </div>
    +</div>
    +
    Column
    Column
    Column
    Column
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row row-cols-4">
    -    <div class="col">Column</div>
    -    <div class="col">Column</div>
    -    <div class="col-6">Column</div>
    -    <div class="col">Column</div>
    -  </div>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div class="container text-center">
    +  <div class="row row-cols-4">
    +    <div class="col">Column</div>
    +    <div class="col">Column</div>
    +    <div class="col-6">Column</div>
    +    <div class="col">Column</div>
    +  </div>
    +</div>
    +
    Column
    Column
    Column
    Column
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row row-cols-1 row-cols-sm-2 row-cols-md-4">
    -    <div class="col">Column</div>
    -    <div class="col">Column</div>
    -    <div class="col">Column</div>
    -    <div class="col">Column</div>
    -  </div>
    -</div>
    -
    - +
    html
    <div class="container text-center">
    +  <div class="row row-cols-1 row-cols-sm-2 row-cols-md-4">
    +    <div class="col">Column</div>
    +    <div class="col">Column</div>
    +    <div class="col">Column</div>
    +    <div class="col">Column</div>
    +  </div>
    +</div>

    You can also use the accompanying Sass mixin, row-cols():

    -
    .element {
    -  // Three columns to start
    -  @include row-cols(3);
    -
    -  // Five columns from medium breakpoint up
    -  @include media-breakpoint-up(md) {
    -    @include row-cols(5);
    -  }
    -}
    -

    Nesting

    +
    .element {
    +  // Three columns to start
    +  @include row-cols(3);
    +
    +  // Five columns from medium breakpoint up
    +  @include media-breakpoint-up(md) {
    +    @include row-cols(5);
    +  }
    +}
    +
    +

    Nesting

    To nest your content with the default grid, add a new .row and set of .col-sm-* columns within an existing .col-sm-* column. Nested rows should include a set of columns that add up to 12 or fewer (it is not required that you use all 12 available columns).

    -
    -
    - -
    +
    Level 1: .col-sm-3 @@ -1303,249 +441,134 @@
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row">
    -    <div class="col-sm-3">
    -      Level 1: .col-sm-3
    -    </div>
    -    <div class="col-sm-9">
    -      <div class="row">
    -        <div class="col-8 col-sm-6">
    -          Level 2: .col-8 .col-sm-6
    -        </div>
    -        <div class="col-4 col-sm-6">
    -          Level 2: .col-4 .col-sm-6
    -        </div>
    -      </div>
    -    </div>
    -  </div>
    -</div>
    -
    - -

    CSS

    -

    When using Bootstrap’s source Sass files, you have the option of using Sass variables and mixins to create custom, semantic, and responsive page layouts. Our predefined grid classes use these same variables and mixins to provide a whole suite of ready-to-use classes for fast responsive layouts.

    -

    Sass variables

    +
    html
    <div class="container text-center">
    +  <div class="row">
    +    <div class="col-sm-3">
    +      Level 1: .col-sm-3
    +    </div>
    +    <div class="col-sm-9">
    +      <div class="row">
    +        <div class="col-8 col-sm-6">
    +          Level 2: .col-8 .col-sm-6
    +        </div>
    +        <div class="col-4 col-sm-6">
    +          Level 2: .col-4 .col-sm-6
    +        </div>
    +      </div>
    +    </div>
    +  </div>
    +</div>
    +

    CSS

    +

    When using Bootstrap’s source Sass files, you have the option of using Sass variables and mixins to create custom, semantic, and responsive page layouts. Our predefined grid classes use these same variables and mixins to provide a whole suite of ready-to-use classes for fast responsive layouts.

    +

    Sass variables

    Variables and maps determine the number of columns, the gutter width, and the media query point at which to begin floating columns. We use these to generate the predefined grid classes documented above, as well as for the custom mixins listed below.

    -
    $grid-columns:      12;
    -$grid-gutter-width: 1.5rem;
    -$grid-row-columns:  6;
    -
    -
    - scss/_variables.scss -
    - -
    -
    $grid-breakpoints: (
    -  xs: 0,
    -  sm: 576px,
    -  md: 768px,
    -  lg: 992px,
    -  xl: 1200px,
    -  xxl: 1400px
    -);
    -
    -
    -
    - scss/_variables.scss -
    - -
    -
    $container-max-widths: (
    -  sm: 540px,
    -  md: 720px,
    -  lg: 960px,
    -  xl: 1140px,
    -  xxl: 1320px
    -);
    -
    -

    Sass mixins

    +
    $grid-columns:      12;
    +$grid-gutter-width: 1.5rem;
    +$grid-row-columns:  6;
    +
    +
    $grid-breakpoints: (
    +  xs: 0,
    +  sm: 576px,
    +  md: 768px,
    +  lg: 992px,
    +  xl: 1200px,
    +  xxl: 1400px
    +);
    +
    +
    $container-max-widths: (
    +  sm: 540px,
    +  md: 720px,
    +  lg: 960px,
    +  xl: 1140px,
    +  xxl: 1320px
    +);
    +
    +

    Sass mixins

    Mixins are used in conjunction with the grid variables to generate semantic CSS for individual grid columns.

    -
    // Creates a wrapper for a series of columns
    -@include make-row();
    -
    -// Make the element grid-ready (applying everything but the width)
    -@include make-col-ready();
    -
    -// Without optional size values, the mixin will create equal columns (similar to using .col)
    -@include make-col();
    -@include make-col($size, $columns: $grid-columns);
    -
    -// Offset with margins
    -@include make-col-offset($size, $columns: $grid-columns);
    -

    Example usage

    -

    You can modify the variables to your own custom values, or just use the mixins with their default values. Here’s an example of using the default settings to create a two-column layout with a gap between.

    -
    .example-container {
    -  @include make-container();
    -  // Make sure to define this width after the mixin to override
    -  // `width: 100%` generated by `make-container()`
    -  width: 800px;
    -}
    -
    -.example-row {
    -  @include make-row();
    -}
    -
    -.example-content-main {
    -  @include make-col-ready();
    -
    -  @include media-breakpoint-up(sm) {
    -    @include make-col(6);
    -  }
    -  @include media-breakpoint-up(lg) {
    -    @include make-col(8);
    -  }
    -}
    -
    -.example-content-secondary {
    -  @include make-col-ready();
    -
    -  @include media-breakpoint-up(sm) {
    -    @include make-col(6);
    -  }
    -  @include media-breakpoint-up(lg) {
    -    @include make-col(4);
    -  }
    -}
    -
    -
    - -
    +
    // Creates a wrapper for a series of columns
    +@include make-row();
    +
    +// Make the element grid-ready (applying everything but the width)
    +@include make-col-ready();
    +
    +// Without optional size values, the mixin will create equal columns (similar to using .col)
    +@include make-col();
    +@include make-col($size, $columns: $grid-columns);
    +
    +// Offset with margins
    +@include make-col-offset($size, $columns: $grid-columns);
    +
    +

    Example usage

    +

    You can modify the variables to your own custom values, or just use the mixins with their default values. Here’s an example of using the default settings to create a two-column layout with a gap between.

    +
    .example-container {
    +  @include make-container();
    +  // Make sure to define this width after the mixin to override
    +  // `width: 100%` generated by `make-container()`
    +  width: 800px;
    +}
    +
    +.example-row {
    +  @include make-row();
    +}
    +
    +.example-content-main {
    +  @include make-col-ready();
    +
    +  @include media-breakpoint-up(sm) {
    +    @include make-col(6);
    +  }
    +  @include media-breakpoint-up(lg) {
    +    @include make-col(8);
    +  }
    +}
    +
    +.example-content-secondary {
    +  @include make-col-ready();
    +
    +  @include media-breakpoint-up(sm) {
    +    @include make-col(6);
    +  }
    +  @include media-breakpoint-up(lg) {
    +    @include make-col(4);
    +  }
    +}
    +
    +
    Main content
    Secondary content
    -
    - -
    - html -
    - - -
    -
    <div class="example-container">
    -  <div class="example-row">
    -    <div class="example-content-main">Main content</div>
    -    <div class="example-content-secondary">Secondary content</div>
    -  </div>
    -</div>
    -
    - -

    Customizing the grid

    -

    Using our built-in grid Sass variables and maps, it’s possible to completely customize the predefined grid classes. Change the number of tiers, the media query dimensions, and the container widths—then recompile.

    -

    Columns and gutters

    +
    html
    <div class="example-container">
    +  <div class="example-row">
    +    <div class="example-content-main">Main content</div>
    +    <div class="example-content-secondary">Secondary content</div>
    +  </div>
    +</div>
    +

    Customizing the grid

    +

    Using our built-in grid Sass variables and maps, it’s possible to completely customize the predefined grid classes. Change the number of tiers, the media query dimensions, and the container widths—then recompile.

    +

    Columns and gutters

    The number of grid columns can be modified via Sass variables. $grid-columns is used to generate the widths (in percent) of each individual column while $grid-gutter-width sets the width for the column gutters. $grid-row-columns is used to set the maximum number of columns of .row-cols-*, any number over this limit is ignored.

    -
    $grid-columns: 12 !default;
    -$grid-gutter-width: 1.5rem !default;
    -$grid-row-columns: 6 !default;
    -

    Grid tiers

    -

    Moving beyond the columns themselves, you may also customize the number of grid tiers. If you wanted just four grid tiers, you’d update the $grid-breakpoints and $container-max-widths to something like this:

    -
    $grid-breakpoints: (
    -  xs: 0,
    -  sm: 480px,
    -  md: 768px,
    -  lg: 1024px
    -);
    -
    -$container-max-widths: (
    -  sm: 420px,
    -  md: 720px,
    -  lg: 960px
    -);
    -

    When making any changes to the Sass variables or maps, you’ll need to save your changes and recompile. Doing so will output a brand-new set of predefined grid classes for column widths, offsets, and ordering. Responsive visibility utilities will also be updated to use the custom breakpoints. Make sure to set grid values in px (not rem, em, or %).

    +
    $grid-columns: 12 !default;
    +$grid-gutter-width: 1.5rem !default;
    +$grid-row-columns: 6 !default;
    +
    +

    Grid tiers

    +

    Moving beyond the columns themselves, you may also customize the number of grid tiers. If you wanted just four grid tiers, you’d update the $grid-breakpoints and $container-max-widths to something like this:

    +
    $grid-breakpoints: (
    +  xs: 0,
    +  sm: 480px,
    +  md: 768px,
    +  lg: 1024px
    +);
     
    -      
    -
    -
    - - - - - - - - - - - - - - - +$container-max-widths: ( + sm: 420px, + md: 720px, + lg: 960px +); + +

    When making any changes to the Sass variables or maps, you’ll need to save your changes and recompile. Doing so will output a brand-new set of predefined grid classes for column widths, offsets, and ordering. Responsive visibility utilities will also be updated to use the custom breakpoints. Make sure to set grid values in px (not rem, em, or %).

    \ No newline at end of file diff --git a/docs/5.3/layout/gutters/index.html b/docs/5.3/layout/gutters/index.html index c0081d6207..1070312a50 100644 --- a/docs/5.3/layout/gutters/index.html +++ b/docs/5.3/layout/gutters/index.html @@ -1,658 +1,82 @@ - - - - - - - - - - - - - - - - -Gutters · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Gutters

    -
    -

    Gutters are the padding between your columns, used to responsively space and align content in the Bootstrap grid system.

    - - -
    - - - - - -
    - - -

    How they work

    + Gutters · Bootstrap v5.3

    Gutters are the padding between your columns, used to responsively space and align content in the Bootstrap grid system.

    +

    How they work

    • Gutters are the gaps between column content, created by horizontal padding. We set padding-right and padding-left on each column, and use negative margin to offset that at the start and end of each row to align content.

    • -

      Gutters start at 1.5rem (24px) wide. This allows us to match our grid to the padding and margin spacers scale.

      +

      Gutters start at 1.5rem (24px) wide. This allows us to match our grid to the padding and margin spacers scale.

    • Gutters can be responsively adjusted. Use breakpoint-specific gutter classes to modify horizontal gutters, vertical gutters, and all gutters.

    -

    Horizontal gutters

    -

    .gx-* classes can be used to control the horizontal gutter widths. The .container or .container-fluid parent may need to be adjusted if larger gutters are used too to avoid unwanted overflow, using a matching padding utility. For example, in the following example we’ve increased the padding with .px-4:

    -
    -
    - -
    +

    Horizontal gutters

    +

    .gx-* classes can be used to control the horizontal gutter widths. The .container or .container-fluid parent may need to be adjusted if larger gutters are used too to avoid unwanted overflow, using a matching padding utility. For example, in the following example we’ve increased the padding with .px-4:

    +
    -
    Custom column padding
    +
    Custom column padding
    Custom column padding
    -
    - -
    - html -
    - - -
    -
    <div class="container px-4 text-center">
    -  <div class="row gx-5">
    -    <div class="col">
    -     <div class="p-3">Custom column padding</div>
    -    </div>
    -    <div class="col">
    -      <div class="p-3">Custom column padding</div>
    -    </div>
    -  </div>
    -</div>
    -
    - +
    html
    <div class="container px-4 text-center">
    +  <div class="row gx-5">
    +    <div class="col">
    +      <div class="p-3">Custom column padding</div>
    +    </div>
    +    <div class="col">
    +      <div class="p-3">Custom column padding</div>
    +    </div>
    +  </div>
    +</div>

    An alternative solution is to add a wrapper around the .row with the .overflow-hidden class:

    -
    -
    - -
    +
    -
    Custom column padding
    +
    Custom column padding
    Custom column padding
    -
    - -
    - html -
    - - -
    -
    <div class="container overflow-hidden text-center">
    -  <div class="row gx-5">
    -    <div class="col">
    -     <div class="p-3">Custom column padding</div>
    -    </div>
    -    <div class="col">
    -      <div class="p-3">Custom column padding</div>
    -    </div>
    -  </div>
    -</div>
    -
    - -

    Vertical gutters

    +
    html
    <div class="container overflow-hidden text-center">
    +  <div class="row gx-5">
    +    <div class="col">
    +      <div class="p-3">Custom column padding</div>
    +    </div>
    +    <div class="col">
    +      <div class="p-3">Custom column padding</div>
    +    </div>
    +  </div>
    +</div>
    +

    Vertical gutters

    .gy-* classes can be used to control the vertical gutter widths within a row when columns wrap to new lines. Like the horizontal gutters, the vertical gutters can cause some overflow below the .row at the end of a page. If this occurs, you add a wrapper around .row with the .overflow-hidden class:

    -
    -
    - -
    +
    Custom column padding
    @@ -667,42 +91,25 @@
    Custom column padding
    -
    - -
    - html -
    - - -
    -
    <div class="container overflow-hidden text-center">
    -  <div class="row gy-5">
    -    <div class="col-6">
    -      <div class="p-3">Custom column padding</div>
    -    </div>
    -    <div class="col-6">
    -      <div class="p-3">Custom column padding</div>
    -    </div>
    -    <div class="col-6">
    -      <div class="p-3">Custom column padding</div>
    -    </div>
    -    <div class="col-6">
    -      <div class="p-3">Custom column padding</div>
    -    </div>
    -  </div>
    -</div>
    -
    - -

    Horizontal & vertical gutters

    -

    Use .g-* classes to control the horizontal and vertical grid gutters. In the example below, we use a smaller gutter width, so there isn’t a need for the .overflow-hidden wrapper class.

    -
    -
    - -
    +
    html
    <div class="container overflow-hidden text-center">
    +  <div class="row gy-5">
    +    <div class="col-6">
    +      <div class="p-3">Custom column padding</div>
    +    </div>
    +    <div class="col-6">
    +      <div class="p-3">Custom column padding</div>
    +    </div>
    +    <div class="col-6">
    +      <div class="p-3">Custom column padding</div>
    +    </div>
    +    <div class="col-6">
    +      <div class="p-3">Custom column padding</div>
    +    </div>
    +  </div>
    +</div>
    +

    Horizontal & vertical gutters

    +

    Use .g-* classes to control the horizontal and vertical grid gutters. In the example below, we use a smaller gutter width, so there isn’t a need for the .overflow-hidden wrapper class.

    +
    Custom column padding
    @@ -717,42 +124,25 @@
    Custom column padding
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row g-2">
    -    <div class="col-6">
    -      <div class="p-3">Custom column padding</div>
    -    </div>
    -    <div class="col-6">
    -      <div class="p-3">Custom column padding</div>
    -    </div>
    -    <div class="col-6">
    -      <div class="p-3">Custom column padding</div>
    -    </div>
    -    <div class="col-6">
    -      <div class="p-3">Custom column padding</div>
    -    </div>
    -  </div>
    -</div>
    -
    - -

    Row columns gutters

    -

    Gutter classes can also be added to row columns. In the following example, we use responsive row columns and responsive gutter classes.

    -
    -
    - -
    +
    html
    <div class="container text-center">
    +  <div class="row g-2">
    +    <div class="col-6">
    +      <div class="p-3">Custom column padding</div>
    +    </div>
    +    <div class="col-6">
    +      <div class="p-3">Custom column padding</div>
    +    </div>
    +    <div class="col-6">
    +      <div class="p-3">Custom column padding</div>
    +    </div>
    +    <div class="col-6">
    +      <div class="p-3">Custom column padding</div>
    +    </div>
    +  </div>
    +</div>
    +

    Row columns gutters

    +

    Gutter classes can also be added to row columns. In the following example, we use responsive row columns and responsive gutter classes.

    +
    Row column
    @@ -785,167 +175,64 @@
    Row column
    -
    - -
    - html -
    - - -
    -
    <div class="container text-center">
    -  <div class="row row-cols-2 row-cols-lg-5 g-2 g-lg-3">
    -    <div class="col">
    -      <div class="p-3">Row column</div>
    -    </div>
    -    <div class="col">
    -      <div class="p-3">Row column</div>
    -    </div>
    -    <div class="col">
    -      <div class="p-3">Row column</div>
    -    </div>
    -    <div class="col">
    -      <div class="p-3">Row column</div>
    -    </div>
    -    <div class="col">
    -      <div class="p-3">Row column</div>
    -    </div>
    -    <div class="col">
    -      <div class="p-3">Row column</div>
    -    </div>
    -    <div class="col">
    -      <div class="p-3">Row column</div>
    -    </div>
    -    <div class="col">
    -      <div class="p-3">Row column</div>
    -    </div>
    -    <div class="col">
    -      <div class="p-3">Row column</div>
    -    </div>
    -    <div class="col">
    -      <div class="p-3">Row column</div>
    -    </div>
    -  </div>
    -</div>
    -
    - -

    No gutters

    +
    html
    <div class="container text-center">
    +  <div class="row row-cols-2 row-cols-lg-5 g-2 g-lg-3">
    +    <div class="col">
    +      <div class="p-3">Row column</div>
    +    </div>
    +    <div class="col">
    +      <div class="p-3">Row column</div>
    +    </div>
    +    <div class="col">
    +      <div class="p-3">Row column</div>
    +    </div>
    +    <div class="col">
    +      <div class="p-3">Row column</div>
    +    </div>
    +    <div class="col">
    +      <div class="p-3">Row column</div>
    +    </div>
    +    <div class="col">
    +      <div class="p-3">Row column</div>
    +    </div>
    +    <div class="col">
    +      <div class="p-3">Row column</div>
    +    </div>
    +    <div class="col">
    +      <div class="p-3">Row column</div>
    +    </div>
    +    <div class="col">
    +      <div class="p-3">Row column</div>
    +    </div>
    +    <div class="col">
    +      <div class="p-3">Row column</div>
    +    </div>
    +  </div>
    +</div>
    +

    No gutters

    The gutters between columns in our predefined grid classes can be removed with .g-0. This removes the negative margins from .row and the horizontal padding from all immediate children columns.

    Need an edge-to-edge design? Drop the parent .container or .container-fluid and add .mx-0 to the .row to prevent overflow.

    -

    In practice, here’s how it looks. Note that you can continue to use this with all other predefined grid classes (including column widths, responsive tiers, reorders, and more).

    -
    -
    - -
    +

    In practice, here’s how it looks. Note that you can continue to use this with all other predefined grid classes (including column widths, responsive tiers, reorders, and more).

    +
    .col-sm-6 .col-md-8
    .col-6 .col-md-4
    -
    - -
    - html -
    - - -
    -
    <div class="row g-0 text-center">
    -  <div class="col-sm-6 col-md-8">.col-sm-6 .col-md-8</div>
    -  <div class="col-6 col-md-4">.col-6 .col-md-4</div>
    -</div>
    -
    - -

    Change the gutters

    +
    html
    <div class="row g-0 text-center">
    +  <div class="col-sm-6 col-md-8">.col-sm-6 .col-md-8</div>
    +  <div class="col-6 col-md-4">.col-6 .col-md-4</div>
    +</div>
    +

    Change the gutters

    Classes are built from the $gutters Sass map which is inherited from the $spacers Sass map.

    -
    $grid-gutter-width: 1.5rem;
    -$gutters: (
    -  0: 0,
    -  1: $spacer * .25,
    -  2: $spacer * .5,
    -  3: $spacer,
    -  4: $spacer * 1.5,
    -  5: $spacer * 3,
    -);
    -
    -
    -
    -
    - - - - - - - - - - - - - - - +
    $grid-gutter-width: 1.5rem;
    +$gutters: (
    +  0: 0,
    +  1: $spacer * .25,
    +  2: $spacer * .5,
    +  3: $spacer,
    +  4: $spacer * 1.5,
    +  5: $spacer * 3,
    +);
    +
    \ No newline at end of file diff --git a/docs/5.3/layout/index.html b/docs/5.3/layout/index.html index afc1eb735a..8fbb6c5cd2 100644 --- a/docs/5.3/layout/index.html +++ b/docs/5.3/layout/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/layout/breakpoints/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/layout/utilities/index.html b/docs/5.3/layout/utilities/index.html index 5fc54fc84a..acb58dfc6f 100644 --- a/docs/5.3/layout/utilities/index.html +++ b/docs/5.3/layout/utilities/index.html @@ -1,645 +1,36 @@ - - - - - - - - - - - - - - - - -Utilities for layout · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Utilities for layout

    -
    -

    For faster mobile-friendly and responsive development, Bootstrap includes dozens of utility classes for showing, hiding, aligning, and spacing content.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Changing display

    -

    Use our display utilities for responsively toggling common values of the display property. Mix it with our grid system, content, or components to show or hide them across specific viewports.

    -

    Flexbox options

    -

    Bootstrap is built with flexbox, but not every element’s display has been changed to display: flex as this would add many unnecessary overrides and unexpectedly change key browser behaviors. Most of our components are built with flexbox enabled.

    -

    Should you need to add display: flex to an element, do so with .d-flex or one of the responsive variants (e.g., .d-sm-flex). You’ll need this class or display value to allow the use of our extra flexbox utilities for sizing, alignment, spacing, and more.

    -

    Margin and padding

    -

    Use the margin and padding spacing utilities to control how elements and components are spaced and sized. Bootstrap includes a six-level scale for spacing utilities, based on a 1rem value default $spacer variable. Choose values for all viewports (e.g., .me-3 for margin-right: 1rem in LTR), or pick responsive variants to target specific viewports (e.g., .me-md-3 for margin-right: 1rem —in LTR— starting at the md breakpoint).

    -

    Toggle visibility

    -

    When toggling display isn’t needed, you can toggle the visibility of an element with our visibility utilities. Invisible elements will still affect the layout of the page, but are visually hidden from visitors.

    - -
    -
    -
    - - - - - - - - - - - - - - - + Utilities for layout · Bootstrap v5.3

    Utilities for layout

    For faster mobile-friendly and responsive development, Bootstrap includes dozens of utility classes for showing, hiding, aligning, and spacing content.

    +

    Changing display

    +

    Use our display utilities for responsively toggling common values of the display property. Mix it with our grid system, content, or components to show or hide them across specific viewports.

    +

    Flexbox options

    +

    Bootstrap is built with flexbox, but not every element’s display has been changed to display: flex as this would add many unnecessary overrides and unexpectedly change key browser behaviors. Most of our components are built with flexbox enabled.

    +

    Should you need to add display: flex to an element, do so with .d-flex or one of the responsive variants (e.g., .d-sm-flex). You’ll need this class or display value to allow the use of our extra flexbox utilities for sizing, alignment, spacing, and more.

    +

    Margin and padding

    +

    Use the margin and padding spacing utilities to control how elements and components are spaced and sized. Bootstrap includes a six-level scale for spacing utilities, based on a 1rem value default $spacer variable. Choose values for all viewports (e.g., .me-3 for margin-right: 1rem in LTR), or pick responsive variants to target specific viewports (e.g., .me-md-3 for margin-right: 1rem —in LTR— starting at the md breakpoint).

    +

    Toggle visibility

    +

    When toggling display isn’t needed, you can toggle the visibility of an element with our visibility utilities. Invisible elements will still affect the layout of the page, but are visually hidden from visitors.

    \ No newline at end of file diff --git a/docs/5.3/layout/z-index/index.html b/docs/5.3/layout/z-index/index.html index b7d7e19899..7d24d79329 100644 --- a/docs/5.3/layout/z-index/index.html +++ b/docs/5.3/layout/z-index/index.html @@ -1,640 +1,40 @@ - - - - - - - - - - - - - - - - -Z-index · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Z-index

    -
    -

    While not a part of Bootstrap’s grid system, z-indexes play an important part in how our components overlay and interact with one another.

    - - -
    - - - -
    - - -

    Several Bootstrap components utilize z-index, the CSS property that helps control layout by providing a third axis to arrange content. We utilize a default z-index scale in Bootstrap that’s been designed to properly layer navigation, tooltips and popovers, modals, and more.

    -

    These higher values start at an arbitrary number, high and specific enough to ideally avoid conflicts. We need a standard set of these across our layered components—tooltips, popovers, navbars, dropdowns, modals—so we can be reasonably consistent in the behaviors. There’s no reason we couldn’t have used 100+ or 500+.

    -

    We don’t encourage customization of these individual values; should you change one, you likely need to change them all.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $zindex-dropdown:                   1000;
    -$zindex-sticky:                     1020;
    -$zindex-fixed:                      1030;
    -$zindex-offcanvas-backdrop:         1040;
    -$zindex-offcanvas:                  1045;
    -$zindex-modal-backdrop:             1050;
    -$zindex-modal:                      1055;
    -$zindex-popover:                    1070;
    -$zindex-tooltip:                    1080;
    -$zindex-toast:                      1090;
    -
    -

    To handle overlapping borders within components (e.g., buttons and inputs in input groups), we use low single digit z-index values of 1, 2, and 3 for default, hover, and active states. On hover/focus/active, we bring a particular element to the forefront with a higher z-index value to show their border over the sibling elements.

    - -
    -
    -
    - - - - - - - - - - - - - - - + Z-index · Bootstrap v5.3

    While not a part of Bootstrap’s grid system, z-indexes play an important part in how our components overlay and interact with one another.

    +

    Several Bootstrap components utilize z-index, the CSS property that helps control layout by providing a third axis to arrange content. We utilize a default z-index scale in Bootstrap that’s been designed to properly layer navigation, tooltips and popovers, modals, and more.

    +

    These higher values start at an arbitrary number, high and specific enough to ideally avoid conflicts. We need a standard set of these across our layered components—tooltips, popovers, navbars, dropdowns, modals—so we can be reasonably consistent in the behaviors. There’s no reason we couldn’t have used 100+ or 500+.

    +

    We don’t encourage customization of these individual values; should you change one, you likely need to change them all.

    +
    $zindex-dropdown:                   1000;
    +$zindex-sticky:                     1020;
    +$zindex-fixed:                      1030;
    +$zindex-offcanvas-backdrop:         1040;
    +$zindex-offcanvas:                  1045;
    +$zindex-modal-backdrop:             1050;
    +$zindex-modal:                      1055;
    +$zindex-popover:                    1070;
    +$zindex-tooltip:                    1080;
    +$zindex-toast:                      1090;
    +
    +

    To handle overlapping borders within components (e.g., buttons and inputs in input groups), we use low single digit z-index values of 1, 2, and 3 for default, hover, and active states. On hover/focus/active, we bring a particular element to the forefront with a higher z-index value to show their border over the sibling elements.

    \ No newline at end of file diff --git a/docs/5.3/migration/index.html b/docs/5.3/migration/index.html index 735d04a29b..0fb3862940 100644 --- a/docs/5.3/migration/index.html +++ b/docs/5.3/migration/index.html @@ -1,661 +1,48 @@ - - - - - - - - - - - - - - - - -Migrating to v5 · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Migrating to v5

    -
    -

    Track and review changes to the Bootstrap source files, documentation, and components to help you migrate from v4 to v5.

    - - -
    - - - - - -
    - - -

    v5.3.0

    -

    If you’re migrating from our previous alpha releases of v5.3.0, please review their changes in addition to this section.

    -

    Helpers

    + Migrating to v5 · Bootstrap v5.3

    Migrating to v5

    Track and review changes to the Bootstrap source files, documentation, and components to help you migrate from v4 to v5.

    +

    v5.3.6

    +

    Dependencies

      -
    • Colored links once again have !important so they work better with our newly added link utilities.
    • +
    • Migrated from Hugo to Astro for building our documentation
    -

    Utilities

    +

    v5.3.0

    +

    If you’re migrating from our previous alpha releases of v5.3.0, please review their changes in addition to this section.

    +

    Helpers

      -
    • Added new .d-inline-grid display utility.
    • +
    • Colored links once again have !important so they work better with our newly added link utilities.
    -

    v5.3.0-alpha2

    -

    If you’re migrating from our previous alpha release of v5.3.0, please review the changes listed below.

    -

    CSS variables

    +

    Utilities

    + +

    v5.3.0-alpha2

    +

    If you’re migrating from our previous alpha release of v5.3.0, please review the changes listed below.

    +

    CSS variables

    • Removed several duplicate and unused root CSS variables.
    -

    Color modes

    +

    Color modes

    • Dark mode colors are now derived from our theme colors (e.g., $primary) in Sass, rather than color specific tints or shades (e.g., $blue-300). This allows for a more automated dark mode when customizing the default theme colors.

      @@ -673,7 +60,7 @@

      Form validation border-color and text color states now respond to dark mode, thanks to new Sass and CSS variables.

    • -

      Dropped recently added form control background CSS variables and reassigned the Sass variables to use CSS variables instead. This simplifies the styling across color modes and avoids an issue where form controls in dark mode wouldn’t update properly.

      +

      Dropped recently added form control background CSS variables and reassigned the Sass variables to use CSS variables instead. This simplifies the styling across color modes and avoids an issue where form controls in dark mode wouldn’t update properly.

    • Our box-shadows will once again always stay dark instead of inverting to white when in dark mode.

      @@ -685,23 +72,23 @@

      Improved docs code syntax colors and more across light and dark modes.

    -

    Typography

    +

    Typography

      -
    • We no longer set a color for $headings-color-dark or --bs-heading-color for dark mode. To avoid several problems of headings within components appearing the wrong color, we’ve set the Sass variable to null and added a null check like we use on the default light mode.
    • +
    • We no longer set a color for $headings-color-dark or --bs-heading-color for dark mode. To avoid several problems of headings within components appearing the wrong color, we’ve set the Sass variable to null and added a null check like we use on the default light mode.
    -

    Components

    +

    Components

    • Cards now have a color set on them to improve rendering across color modes.

    • -

      Added new .nav-underline variant for our navigation with a simpler bottom border under the active nav link. See the docs for an example.

      +

      Added new .nav-underline variant for our navigation with a simpler bottom border under the active nav link. See the docs for an example.

    • Navs now have new :focus-visible styles that better match our custom button focus styles.

    -

    Helpers

    +

    Helpers

    • Added new .icon-link helper to quickly place and align Bootstrap Icons alongside a textual link. Icon links support our new link utilities, too.

      @@ -710,16 +97,16 @@

      Added new focus ring helper for removing the default outline and setting a custom box-shadow focus ring.

    -

    Utilities

    +

    Utilities

    • Renamed Sass and CSS variables ${color}-text to ${color}-text-emphasis to match their associated utilities.

    • -

      Added new .link-body-emphasis helper alongside our colored links. This creates a colored link using our color mode responsive emphasis color.

      +

      Added new .link-body-emphasis helper alongside our colored links. This creates a colored link using our color mode responsive emphasis color.

    • -

      Added new link utilities for link color opacity, underline offset, underline color, and underline opacity. Explore the new links utilities.

      +

      Added new link utilities for link color opacity, underline offset, underline color, and underline opacity. Explore the new links utilities.

    • CSS variable based border-width utilities have been reverted to set their property directly (as was done prior to v5.2.0). This avoids inheritance issues across nested elements, including tables.

      @@ -731,7 +118,7 @@

      Deprecated The .text-muted utility and $text-muted Sass variable have been deprecated and replaced with .text-body-secondary and $body-secondary-color.

    -

    Docs

    +

    Docs

    • Examples are now displayed with the appropriate light or dark color mode as dictated by the setting in our docs. Each example has an individual color mode picker.

      @@ -743,7 +130,7 @@

      Added twbs/examples repo contents to the top of the Examples page.

    -

    Tooling

    +

    Tooling

    • Added SCSS testing via True to help test our utilities API and other customizations.

      @@ -752,52 +139,53 @@

      Replaced instances of our bootstrap-npm-starter project with the newer and more complete twbs/examples repo.

    -
    +

    For a complete list of changes, see the v5.3.0-alpha2 project on GitHub.

    -

    v5.3.0-alpha1

    -
    -

    Color modes!

    -

    Learn more by reading the new color modes documentation.

    +

    v5.3.0-alpha1

    +
    +

    Color modes!

    +

    Learn more by reading the new color modes documentation.

    • Global support for light (default) and dark color modes. Set color mode globally on the :root element, on groups of elements and components with a wrapper class, or directly on components, with data-bs-theme="light|dark". Also included is a new color-mode() mixin that can output a ruleset with the data-bs-theme selector or a media query, depending on your preference.

      Deprecated Color modes replace dark variants for components, so .btn-close-white, .carousel-dark, .dropdown-menu-dark, and .navbar-dark are deprecated.

    • -

      New extended color system. We’ve added new theme colors (but not in $theme-colors) for a more nuanced, system-wide color palette with new secondary, tertiary, and emphasis colors for color and background-color. These new colors are available as Sass variables, CSS variables, and utilities.

      +

      New extended color system. We’ve added new theme colors (but not in $theme-colors) for a more nuanced, system-wide color palette with new secondary, tertiary, and emphasis colors for color and background-color. These new colors are available as Sass variables, CSS variables, and utilities.

    • -

      We’ve also expanded our theme color Sass variables, CSS variables, and utilities to include text emphasis, subtle background colors, and subtle border colors. These are available as Sass variables, CSS variables, and utilities.

      +

      We’ve also expanded our theme color Sass variables, CSS variables, and utilities to include text emphasis, subtle background colors, and subtle border colors. These are available as Sass variables, CSS variables, and utilities.

    • Adds new _variables-dark.scss stylesheet to house dark-mode specific overrides. This stylesheet should be imported immediately after the existing _variables.scss file in your import stack.

      -
      diff --git a/scss/bootstrap.scss b/scss/bootstrap.scss
      -index 8f8296def..449d70487 100644
      ---- a/scss/bootstrap.scss
      -+++ b/scss/bootstrap.scss
      -@@ -6,6 +6,7 @@
      - // Configuration
      - @import "functions";
      - @import "variables";
      -+@import "variables-dark";
      - @import "maps";
      - @import "mixins";
      - @import "utilities";
      -
    • +
      diff --git a/scss/bootstrap.scss b/scss/bootstrap.scss
      +index 8f8296def..449d70487 100644
      +--- a/scss/bootstrap.scss
      ++++ b/scss/bootstrap.scss
      +@@ -6,6 +6,7 @@
      + // Configuration
      + @import "functions";
      + @import "variables";
      ++@import "variables-dark";
      + @import "maps";
      + @import "mixins";
      + @import "utilities";
      +
      +
    -

    CSS variables

    +

    CSS variables

    • -

      Restores CSS variables for breakpoints, though we don’t use them in our media queries as they’re not supported. However, these can be useful in JS-specific contexts.

      +

      Restores CSS variables for breakpoints, though we don’t use them in our media queries as they’re not supported. However, these can be useful in JS-specific contexts.

    • -

      Per the color modes update, we’ve added new utilities for new Sass CSS variables secondary and tertiary text and background colors, plus {color}-bg-subtle, {color}-border-subtle, and {color}-text-emphasis for our theme colors. These new colors are available through Sass and CSS variables (but not our color maps) with the express goal of making it easier to customize across multiple colors modes like light and dark.

      +

      Per the color modes update, we’ve added new utilities for new Sass CSS variables secondary and tertiary text and background colors, plus {color}-bg-subtle, {color}-border-subtle, and {color}-text-emphasis for our theme colors. These new colors are available through Sass and CSS variables (but not our color maps) with the express goal of making it easier to customize across multiple colors modes like light and dark.

    • Adds additional variables for alerts, .btn-close, and .offcanvas.

    • -

      The --bs-heading-color variable is back with an update and dark mode support. First, we now check for a null value on the associated Sass variable, $headings-color, before trying to output the CSS variable, so by default it’s not present in our compiled CSS. Second, we use the CSS variable with a fallback value, inherit, allowing the original behavior to persist, but also allowing for overrides.

      +

      The --bs-heading-color variable is back with an update and dark mode support. First, we now check for a null value on the associated Sass variable, $headings-color, before trying to output the CSS variable, so by default it’s not present in our compiled CSS. Second, we use the CSS variable with a fallback value, inherit, allowing the original behavior to persist, but also allowing for overrides.

    • Converts links to use CSS variables for styling color, but not text-decoration. Colors are now set with --bs-link-color-rgb and --bs-link-opacity as rgba() color, allowing you to customize the translucency with ease. The a:hover pseudo-class now overrides --bs-link-color-rgb instead of explicitly setting the color property.

      @@ -809,76 +197,78 @@

      Adds new root CSS variables for our box-shadows, including --bs-box-shadow, --bs-box-shadow-sm, --bs-box-shadow-lg, and --bs-box-shadow-inset.

    -

    Components

    -

    Alert

    +

    Components

    +

    Alert

    • Alert variants are now styled via CSS variables.

    • -

      Deprecated The alert-variant() mixin is now deprecated. We now use a Sass loop directly to modify the component’s default CSS variables for each variant.

      +

      Deprecated The alert-variant() mixin is now deprecated. We now use a Sass loop directly to modify the component’s default CSS variables for each variant.

    -

    List group

    +

    List group

    • List group item variants are now styled via CSS variables.

    • -

      Deprecated The list-group-item-variant() mixin is now deprecated. We now use a Sass loop directly to modify the component’s default CSS variables for each variant.

      +

      Deprecated The list-group-item-variant() mixin is now deprecated. We now use a Sass loop directly to modify the component’s default CSS variables for each variant.

    - +
      -
    • Deprecated The .dropdown-menu-dark class has been deprecated and replaced with data-bs-theme="dark" on the dropdown or any parent element. See the docs for an example.
    • +
    • Deprecated The .dropdown-menu-dark class has been deprecated and replaced with data-bs-theme="dark" on the dropdown or any parent element. See the docs for an example.
    -

    Close button

    +

    Close button

      -
    • Deprecated The .btn-close-white class has been deprecated and replaced with data-bs-theme="dark" on the close button or any parent element. See the docs for an example.
    • +
    • Deprecated The .btn-close-white class has been deprecated and replaced with data-bs-theme="dark" on the close button or any parent element. See the docs for an example.
    - + -

    Progress bars

    -

    The markup for progress bars has been updated in v5.3.0. Due to the placement of role and various aria- attributes on the inner .progress-bar element, some screen readers were not announcing zero value progress bars. Now, role="progressbar" and the relevant aria-* attributes are on the outer .progress element, leaving the .progress-bar purely for the visual presentation of the bar and optional label.

    +

    Progress bars

    +

    The markup for progress bars has been updated in v5.3.0. Due to the placement of role and various aria- attributes on the inner .progress-bar element, some screen readers were not announcing zero value progress bars. Now, role="progressbar" and the relevant aria-* attributes are on the outer .progress element, leaving the .progress-bar purely for the visual presentation of the bar and optional label.

    While we recommend adopting the new markup for improved compatibility with all screen readers, note that the legacy progress bar structure will continue to work as before.

    -
    <!-- Previous markup -->
    -<div class="progress">
    -  <div class="progress-bar" role="progressbar" aria-label="Basic example" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
    -</div>
    -
    -<!-- New markup -->
    -<div class="progress" role="progressbar" aria-label="Basic example" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">
    -  <div class="progress-bar" style="width: 25%"></div>
    -</div>
    -

    We’ve also introduced a new .progress-stacked class to more logically wrap multiple progress bars into a single stacked progress bar.

    -
    <!-- Previous markup -->
    -<div class="progress">
    -  <div class="progress-bar" role="progressbar" aria-label="Segment one" style="width: 15%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div>
    -  <div class="progress-bar bg-success" role="progressbar" aria-label="Segment two" style="width: 30%" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100"></div>
    -  <div class="progress-bar bg-info" role="progressbar" aria-label="Segment three" style="width: 20%" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"></div>
    -</div>
    -
    -<!-- New markup -->
    -<div class="progress-stacked">
    -  <div class="progress" role="progressbar" aria-label="Segment one" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100" style="width: 15%">
    -    <div class="progress-bar"></div>
    -  </div>
    -  <div class="progress" role="progressbar" aria-label="Segment two" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" style="width: 30%">
    -    <div class="progress-bar bg-success"></div>
    -  </div>
    -  <div class="progress" role="progressbar" aria-label="Segment three" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 20%">
    -    <div class="progress-bar bg-info"></div>
    -  </div>
    -</div>
    -

    Forms

    +
    <!-- Previous markup -->
    +<div class="progress">
    +  <div class="progress-bar" role="progressbar" aria-label="Basic example" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100"></div>
    +</div>
    +
    +<!-- New markup -->
    +<div class="progress" role="progressbar" aria-label="Basic example" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">
    +  <div class="progress-bar" style="width: 25%"></div>
    +</div>
    +
    +

    We’ve also introduced a new .progress-stacked class to more logically wrap multiple progress bars into a single stacked progress bar.

    +
    <!-- Previous markup -->
    +<div class="progress">
    +  <div class="progress-bar" role="progressbar" aria-label="Segment one" style="width: 15%" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100"></div>
    +  <div class="progress-bar bg-success" role="progressbar" aria-label="Segment two" style="width: 30%" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100"></div>
    +  <div class="progress-bar bg-info" role="progressbar" aria-label="Segment three" style="width: 20%" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100"></div>
    +</div>
    +
    +<!-- New markup -->
    +<div class="progress-stacked">
    +  <div class="progress" role="progressbar" aria-label="Segment one" aria-valuenow="15" aria-valuemin="0" aria-valuemax="100" style="width: 15%">
    +    <div class="progress-bar"></div>
    +  </div>
    +  <div class="progress" role="progressbar" aria-label="Segment two" aria-valuenow="30" aria-valuemin="0" aria-valuemax="100" style="width: 30%">
    +    <div class="progress-bar bg-success"></div>
    +  </div>
    +  <div class="progress" role="progressbar" aria-label="Segment three" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 20%">
    +    <div class="progress-bar bg-info"></div>
    +  </div>
    +</div>
    +
    +

    Forms

    • .form-control is now styled with CSS variables to support color modes. This includes the addition of two new root CSS variables for the default and disabled form control backgrounds.

    • -

      .form-check and .form-switch components are now built with CSS variables for setting the background-image. The usage here differs from other components in that the various focus, active, etc states for each component aren’t set on the base class. Instead, the states override one variable (e.g., --bs-form-switch-bg).

      +

      .form-check and .form-switch components are now built with CSS variables for setting the background-image. The usage here differs from other components in that the various focus, active, etc states for each component aren’t set on the base class. Instead, the states override one variable (e.g., --bs-form-switch-bg).

    • Floating form labels now have a background-color to fix support for <textarea> elements. Additional changes have been made to also support disabled states and more.

      @@ -887,7 +277,7 @@

      Fixed display of date and time inputs in WebKit based browsers.

    -

    Utilities

    +

    Utilities

    • Deprecated .text-muted will be replaced by .text-body-secondary in v6.

      @@ -900,23 +290,23 @@

      Adds new .fw-medium utility.

    • -

      Added new .z-* utilities for z-index.

      +

      Added new .z-* utilities for z-index.

    • -

      Box shadow utilities (and Sass variables) have been updated for dark mode. They now use --bs-body-color-rgb to generate the rgba() color values, allowing them to easily adapt to color modes based on the specified foreground color.

      +

      Box shadow utilities (and Sass variables) have been updated for dark mode. They now use --bs-body-color-rgb to generate the rgba() color values, allowing them to easily adapt to color modes based on the specified foreground color.

    For a complete list of changes, see the v5.3.0 project on GitHub.

    -

    v5.2.0

    -
    -

    Refreshed design

    +

    v5.2.0

    +
    +

    Refreshed design

    Bootstrap v5.2.0 features a subtle design update for a handful of components and properties across the project, most notably through refined border-radius values on buttons and form controls. Our documentation also has been updated with a new homepage, simpler docs layout that no longer collapses sections of the sidebar, and more prominent examples of Bootstrap Icons.

    -

    More CSS variables

    -

    We’ve updated all our components to use CSS variables. While Sass still underpins everything, each component has been updated to include CSS variables on the component base classes (e.g., .btn), allowing for more real-time customization of Bootstrap. In subsequent releases, we’ll continue to expand our use of CSS variables into our layout, forms, helpers, and utilities. Read more about CSS variables in each component on their respective documentation pages.

    -

    Our CSS variable usage will be somewhat incomplete until Bootstrap 6. While we’d love to fully implement these across the board, they do run the risk of causing breaking changes. For example, setting $alert-border-width: var(--bs-border-width) in our source code breaks potential Sass in your own code if you were doing $alert-border-width * 2 for some reason.

    +

    More CSS variables

    +

    We’ve updated all our components to use CSS variables. While Sass still underpins everything, each component has been updated to include CSS variables on the component base classes (e.g., .btn), allowing for more real-time customization of Bootstrap. In subsequent releases, we'll continue to expand our use of CSS variables into our layout, forms, helpers, and utilities. Read more about CSS variables in each component on their respective documentation pages.

    +

    Our CSS variable usage will be somewhat incomplete until Bootstrap 6. While we’d love to fully implement these across the board, they do run the risk of causing breaking changes. For example, setting $alert-border-width: var(--bs-border-width) in our source code breaks potential Sass in your own code if you were doing $alert-border-width * 2 for some reason.

    As such, wherever possible, we will continue to push towards more CSS variables, but please recognize our implementation may be slightly limited in v5.

    -

    New _maps.scss

    -

    Bootstrap v5.2.0 introduced a new Sass file with _maps.scss. It pulls out several Sass maps from _variables.scss to fix an issue where updates to an original map were not applied to secondary maps that extend them. For example, updates to $theme-colors were not being applied to other theme maps that relied on $theme-colors, breaking key customization workflows. In short, Sass has a limitation where once a default variable or map has been used, it cannot be updated. There’s a similar shortcoming with CSS variables when they’re used to compose other CSS variables.

    +

    New _maps.scss

    +

    Bootstrap v5.2.0 introduced a new Sass file with _maps.scss. It pulls out several Sass maps from _variables.scss to fix an issue where updates to an original map were not applied to secondary maps that extend them. For example, updates to $theme-colors were not being applied to other theme maps that relied on $theme-colors, breaking key customization workflows. In short, Sass has a limitation where once a default variable or map has been used, it cannot be updated. There’s a similar shortcoming with CSS variables when they’re used to compose other CSS variables.

    This is why variable customizations in Bootstrap have to come after @import "functions", but before @import "variables" and the rest of our import stack. The same applies to Sass maps—you must override the defaults before they get used. The following maps have been moved to the new _maps.scss:

    • $theme-colors-rgb
    • @@ -929,45 +319,46 @@
    • $gutters

    Your custom Bootstrap CSS builds should now look something like this with a separate maps import.

    -
      // Functions come first
    -  @import "functions";
    -
    -  // Optional variable overrides here
    -+ $custom-color: #df711b;
    -+ $custom-theme-colors: (
    -+   "custom": $custom-color
    -+ );
    -
    -  // Variables come next
    -  @import "variables";
    -
    -+ // Optional Sass map overrides here
    -+ $theme-colors: map-merge($theme-colors, $custom-theme-colors);
    -+
    -+ // Followed by our default maps
    -+ @import "maps";
    -+
    -  // Rest of our imports
    -  @import "mixins";
    -  @import "utilities";
    -  @import "root";
    -  @import "reboot";
    -  // etc
    -

    New utilities

    +
      // Functions come first
    +  @import "functions";
    +
    +  // Optional variable overrides here
    ++ $custom-color: #df711b;
    ++ $custom-theme-colors: (
    ++   "custom": $custom-color
    ++ );
    +
    +  // Variables come next
    +  @import "variables";
    +
    ++ // Optional Sass map overrides here
    ++ $theme-colors: map-merge($theme-colors, $custom-theme-colors);
    ++
    ++ // Followed by our default maps
    ++ @import "maps";
    ++
    +  // Rest of our imports
    +  @import "mixins";
    +  @import "utilities";
    +  @import "root";
    +  @import "reboot";
    +  // etc
    +
    +

    New utilities

    -

    Additional changes

    +

    Additional changes

    • Introduced new $enable-container-classes option. — Now when opting into the experimental CSS Grid layout, .container-* classes will still be compiled, unless this option is set to false. Containers also now keep their gutter values.

    • -

      Offcanvas component now has responsive variations. The original .offcanvas class remains unchanged—it hides content across all viewports. To make it responsive, change that .offcanvas class to any .offcanvas-{sm|md|lg|xl|xxl} class.

      +

      Offcanvas component now has responsive variations. The original .offcanvas class remains unchanged—it hides content across all viewports. To make it responsive, change that .offcanvas class to any .offcanvas-{sm|md|lg|xl|xxl} class.

    • -

      Thicker table dividers are now opt-in. — We’ve removed the thicker and more difficult to override border between table groups and moved it to an optional class you can apply, .table-group-divider. See the table docs for an example.

      +

      Thicker table dividers are now opt-in. — We’ve removed the thicker and more difficult to override border between table groups and moved it to an optional class you can apply, .table-group-divider. See the table docs for an example.

    • Scrollspy has been rewritten to use the Intersection Observer API, which means you no longer need relative parent wrappers, deprecates offset config, and more. Look for your Scrollspy implementations to be more accurate and consistent in their nav highlighting.

      @@ -976,30 +367,30 @@

      Popovers and tooltips now use CSS variables. Some CSS variables have been updated from their Sass counterparts to reduce the number of variables. As a result, three variables have been deprecated in this release: $popover-arrow-color, $popover-arrow-outer-color, and $tooltip-arrow-color.

    • -

      Added new .text-bg-{color} helpers. Instead of setting individual .text-* and .bg-* utilities, you can now use the .text-bg-* helpers to set a background-color with contrasting foreground color.

      +

      Added new .text-bg-{color} helpers. Instead of setting individual .text-* and .bg-* utilities, you can now use the .text-bg-* helpers to set a background-color with contrasting foreground color.

    • Added .form-check-reverse modifier to flip the order of labels and associated checkboxes/radios.

    • -

      Added striped columns support to tables via the new .table-striped-columns class.

      +

      Added striped columns support to tables via the new .table-striped-columns class.

    For a complete list of changes, see the v5.2.0 project on GitHub.

    -

    v5.1.0

    -
    +

    v5.1.0

    +
    • -

      Added experimental support for CSS Grid layout. — This is a work in progress, and is not yet ready for production use, but you can opt into the new feature via Sass. To enable it, disable the default grid, by setting $enable-grid-classes: false and enable the CSS Grid by setting $enable-cssgrid: true.

      +

      Added experimental support for CSS Grid layout. — This is a work in progress, and is not yet ready for production use, but you can opt into the new feature via Sass. To enable it, disable the default grid, by setting $enable-grid-classes: false and enable the CSS Grid by setting $enable-cssgrid: true.

    • -

      Updated navbars to support offcanvas. — Add offcanvas drawers in any navbar with the responsive .navbar-expand-* classes and some offcanvas markup.

      +

      Updated navbars to support offcanvas. — Add offcanvas drawers in any navbar with the responsive .navbar-expand-* classes and some offcanvas markup.

    • Added new placeholder component. — Our newest component, a way to provide temporary blocks in lieu of real content to help indicate that something is still loading in your site or app.

    • -

      Collapse plugin now supports horizontal collapsing. — Add .collapse-horizontal to your .collapse to collapse the width instead of the height. Avoid browser repainting by setting a min-height or height.

      +

      Collapse plugin now supports horizontal collapsing. — Add .collapse-horizontal to your .collapse to collapse the width instead of the height. Avoid browser repainting by setting a min-height or height.

    • Added new stack and vertical rule helpers. — Quickly apply multiple flexbox properties to quickly create custom layouts with stacks. Choose from horizontal (.hstack) and vertical (.vstack) stacks. Add vertical dividers similar to <hr> elements with the new .vr helpers.

      @@ -1008,7 +399,7 @@

      Added new global :root CSS variables. — Added several new CSS variables to the :root level for controlling <body> styles. More are in the works, including across our utilities and components, but for now read up CSS variables in the Customize section.

    • -

      Overhauled color and background utilities to use CSS variables, and added new text opacity and background opacity utilities. — .text-* and .bg-* utilities are now built with CSS variables and rgba() color values, allowing you to easily customize any utility with new opacity utilities.

      +

      Overhauled color and background utilities to use CSS variables, and added new text opacity and background opacity utilities. — .text-* and .bg-* utilities are now built with CSS variables and rgba() color values, allowing you to easily customize any utility with new opacity utilities.

    • Added new snippet examples based to show how to customize our components. — Pull ready to use customized components and other common design patterns with our new Snippets examples. Includes footers, dropdowns, list groups, and modals.

      @@ -1018,20 +409,17 @@

    Want more information? Read the v5.1.0 blog post.

    -

    v5.0.0

    -
    -
    -Hey there! Changes to our first major release of Bootstrap 5, v5.0.0, are documented below. They don’t reflect the additional changes shown above. -
    - -

    Dependencies

    +

    v5.0.0

    +
    +

    Hey there! Changes to our first major release of Bootstrap 5, v5.0.0, are documented below. They don’t reflect the additional changes shown above.

    +

    Dependencies

    • Dropped jQuery.
    • Upgraded from Popper v1.x to Popper v2.x.
    • Replaced Libsass with Dart Sass as our Sass compiler given Libsass was deprecated.
    • Migrated from Jekyll to Hugo for building our documentation
    -

    Browser support

    +

    Browser support

    • Dropped Internet Explorer 10 and 11
    • Dropped Microsoft Edge < 16 (Legacy Edge)
    • @@ -1040,26 +428,26 @@
    • Dropped iOS Safari < 12
    • Dropped Chrome < 60
    -
    -

    Documentation changes

    +
    +

    Documentation changes

    • Redesigned homepage, docs layout, and footer.
    • -
    • Added new Parcel guide.
    • -
    • Added new Customize section, replacing v4’s Theming page, with new details on Sass, global configuration options, color schemes, CSS variables, and more.
    • +
    • Added new Parcel guide.
    • +
    • Added new Customize section, replacing v4’s Theming page, with new details on Sass, global configuration options, color schemes, CSS variables, and more.
    • Reorganized all form documentation into new Forms section, breaking apart the content into more focused pages.
    • -
    • Similarly, updated the Layout section, to flesh out grid content more clearly.
    • -
    • Renamed “Navs” component page to “Navs & Tabs”.
    • -
    • Renamed “Checks” page to “Checks & radios”.
    • +
    • Similarly, updated the Layout section, to flesh out grid content more clearly.
    • +
    • Renamed “Navs” component page to "Navs & Tabs".
    • +
    • Renamed “Checks” page to "Checks & radios".
    • Redesigned the navbar and added a new subnav to make it easier to get around our sites and docs versions.
    • Added new keyboard shortcut for the search field: Ctrl + /.
    -

    Sass

    +

    Sass

    • -

      We’ve ditched the default Sass map merges to make it easier to remove redundant values. Keep in mind you now have to define all values in the Sass maps like $theme-colors. Check out how to deal with Sass maps.

      +

      We’ve ditched the default Sass map merges to make it easier to remove redundant values. Keep in mind you now have to define all values in the Sass maps like $theme-colors. Check out how to deal with Sass maps.

    • -

      Breaking Renamed color-yiq() function and related variables to color-contrast() as it’s no longer related to YIQ color space. See #30168.

      +

      Breaking Renamed color-yiq() function and related variables to color-contrast() as it’s no longer related to YIQ color space. See #30168.

      • $yiq-contrasted-threshold is renamed to $min-contrast-ratio.
      • $yiq-text-dark and $yiq-text-light are respectively renamed to $color-contrast-dark and $color-contrast-light.
      • @@ -1101,7 +489,7 @@
    • -

      Breaking Renamed scale-color() function to shift-color() to avoid collision with Sass’s own color scaling function.

      +

      Breaking Renamed scale-color() function to shift-color() to avoid collision with Sass’s own color scaling function.

    • box-shadow mixins now allow null values and drop none from multiple arguments. See #30394.

      @@ -1110,7 +498,7 @@

      The border-radius() mixin now has a default value.

    -

    Color system

    +

    Color system

    • The color system which worked with color-level() and $theme-color-interval was removed in favor of a new color system. All lighten() and darken() functions in our codebase are replaced by tint-color() and shade-color(). These functions will mix the color with either white or black instead of changing its lightness by a fixed amount. The shift-color() will either tint or shade a color depending on whether its weight parameter is positive or negative. See #30622 for more details.

      @@ -1122,18 +510,18 @@

      Improved color contrast. Bumped color contrast ratio from 3:1 to 4.5:1 and updated blue, green, cyan, and pink colors to ensure WCAG 2.2 AA contrast. Also changed our color contrast color from $gray-900 to $black.

    • -

      To support our color system, we’ve added new custom tint-color() and shade-color() functions to mix our colors appropriately.

      +

      To support our color system, we’ve added new custom tint-color() and shade-color() functions to mix our colors appropriately.

    -

    Grid updates

    +

    Grid updates

    • New breakpoint! Added new xxl breakpoint for 1400px and up. No changes to all other breakpoints.

    • -

      Improved gutters. Gutters are now set in rems, and are narrower than v4 (1.5rem, or about 24px, down from 30px). This aligns our grid system’s gutters with our spacing utilities.

      +

      Improved gutters. Gutters are now set in rems, and are narrower than v4 (1.5rem, or about 24px, down from 30px). This aligns our grid system’s gutters with our spacing utilities.

        -
      • Added new gutter class (.g-*, .gx-*, and .gy-*) to control horizontal/vertical gutters, horizontal gutters, and vertical gutters.
      • +
      • Added new gutter class (.g-*, .gx-*, and .gy-*) to control horizontal/vertical gutters, horizontal gutters, and vertical gutters.
      • Breaking Renamed .no-gutters to .g-0 to match new gutter utilities.
    • @@ -1144,7 +532,7 @@

      Breaking Dropped several .order-* classes that often went unused. We now only provide .order-0 to .order-5 out of the box.

    • -

      Breaking Dropped the .media component as it can be easily replicated with utilities. See #28265 and the flex utilities page for an example.

      +

      Breaking Dropped the .media component as it can be easily replicated with utilities. See #28265 and the flex utilities page for an example.

    • Breaking bootstrap-grid.css now only applies box-sizing: border-box to the column instead of resetting the global box-sizing. This way, our grid styles can be used in more places without interference.

      @@ -1156,10 +544,10 @@

      Updated the make-col mixin to default to equal columns without a specified size.

    -

    Content, Reboot, etc

    +

    Content, Reboot, etc

    • -

      RFS is now enabled by default. Headings using the font-size() mixin will automatically adjust their font-size to scale with the viewport. This feature was previously opt-in with v4.

      +

      RFS is now enabled by default. Headings using the font-size() mixin will automatically adjust their font-size to scale with the viewport. This feature was previously opt-in with v4.

    • Breaking Overhauled our display typography to replace our $display-* variables and with a $display-font-sizes Sass map. Also removed the individual $display-*-weight variables for a single $display-font-weight and adjusted font-sizes.

      @@ -1168,7 +556,7 @@

      Added two new .display-* heading sizes, .display-5 and .display-6.

    • -

      Links are underlined by default (not just on hover), unless they’re part of specific components.

      +

      Links are underlined by default (not just on hover), unless they’re part of specific components.

    • Redesigned tables to refresh their styles and rebuild them with CSS variables for more control over styling.

      @@ -1204,14 +592,14 @@

      Added $enable-smooth-scroll, which applies scroll-behavior: smooth globally—except for users asking for reduced motion through prefers-reduced-motion media query. See #31877

    -

    RTL

    +

    RTL

    • Horizontal direction specific variables, utilities, and mixins have all been renamed to use logical properties like those found in flexbox layouts—e.g., start and end in lieu of left and right.
    -

    Forms

    +

    Forms

    • -

      Added new floating forms! We’ve promoted the Floating labels example to fully supported form components. See the new Floating labels page.

      +

      Added new floating forms! We’ve promoted the Floating labels example to fully supported form components. See the new Floating labels page.

    • Breaking Consolidated native and custom form elements. Checkboxes, radios, selects, and other inputs that had native and custom classes in v4 have been consolidated. Now nearly all our form elements are entirely custom, most without the need for custom HTML.

      @@ -1250,25 +638,25 @@

      Rearranged source Sass files under scss/forms/, including input group styles.

    -
    -

    Components

    +
    +

    Components

    • Unified padding values for alerts, breadcrumbs, cards, dropdowns, list groups, modals, popovers, and tooltips to be based on our $spacer variable. See #30564.
    -

    Accordion

    +

    Accordion

    -

    Alerts

    +

    Alerts

    -

    Badges

    +

    Badges

    • Breaking Dropped all .badge-* color classes for background utilities (e.g., use .bg-primary instead of .badge-primary).

      @@ -1283,7 +671,7 @@

      Increased default padding for badges from .25em/.5em to .35em/.65em.

    - +
    • Simplified the default appearance of breadcrumbs by removing padding, background-color, and border-radius.

      @@ -1292,13 +680,13 @@

      Added new CSS custom property --bs-breadcrumb-divider for easy customization without needing to recompile CSS.

    -

    Buttons

    +

    Buttons

    • -

      Breaking Toggle buttons, with checkboxes or radios, no longer require JavaScript and have new markup. We no longer require a wrapping element, add .btn-check to the <input>, and pair it with any .btn classes on the <label>. See #30650. The docs for this has moved from our Buttons page to the new Forms section.

      +

      Breaking Toggle buttons, with checkboxes or radios, no longer require JavaScript and have new markup. We no longer require a wrapping element, add .btn-check to the <input>, and pair it with any .btn classes on the <label>. See #30650. The docs for this has moved from our Buttons page to the new Forms section.

    • -

      Breaking Dropped .btn-block for utilities. Instead of using .btn-block on the .btn, wrap your buttons with .d-grid and a .gap-* utility to space them as needed. Switch to responsive classes for even more control over them. Read the docs for some examples.

      +

      Breaking Dropped .btn-block for utilities. Instead of using .btn-block on the .btn, wrap your buttons with .d-grid and a .gap-* utility to space them as needed. Switch to responsive classes for even more control over them. Read the docs for some examples.

    • Updated our button-variant() and button-outline-variant() mixins to support additional parameters.

      @@ -1310,7 +698,7 @@

      Disabled buttons now have pointer-events: none;.

    -

    Card

    +

    Card

    • Breaking Dropped .card-deck in favor of our grid. Wrap your cards in column classes and add a parent .row-cols-* container to recreate card decks (but with more control over responsive alignment).

      @@ -1319,19 +707,19 @@

      Breaking Dropped .card-columns in favor of Masonry. See #28922.

    • -

      Breaking Replaced the .card based accordion with a new Accordion component.

      +

      Breaking Replaced the .card based accordion with a new Accordion component.

    - +
    • -

      Added new .carousel-dark variant for dark text, controls, and indicators (great for lighter backgrounds).

      +

      Added new .carousel-dark variant for dark text, controls, and indicators (great for lighter backgrounds).

    • Replaced chevron icons for carousel controls with new SVGs from Bootstrap Icons.

    -

    Close button

    +

    Close button

    • Breaking Renamed .close to .btn-close for a less generic name.

      @@ -1343,11 +731,11 @@

      Added new .btn-close-white variant that uses filter: invert(1) to enable higher contrast dismiss icons against darker backgrounds.

    -

    Collapse

    +

    Collapse

    • Removed scroll anchoring for accordions.
    - +
    • Added new .dropdown-menu-dark variant and associated variables for on-demand dark dropdowns.

      @@ -1362,40 +750,40 @@

      Breaking All the events for the dropdown are now triggered on the dropdown toggle button and then bubbled up to the parent element.

    • -

      Dropdown menus now have a data-bs-popper="static" attribute set when the positioning of the dropdown is static, or dropdown is in the navbar. This is added by our JavaScript and helps us use custom position styles without interfering with Popper’s positioning.

      +

      Dropdown menus now have a data-bs-popper="static" attribute set when the positioning of the dropdown is static, or dropdown is in the navbar. This is added by our JavaScript and helps us use custom position styles without interfering with Popper’s positioning.

    • Breaking Dropped flip option for dropdown plugin in favor of native Popper configuration. You can now disable the flipping behavior by passing an empty array for fallbackPlacements option in flip modifier.

    • -

      Dropdown menus can now be clickable with a new autoClose option to handle the auto close behavior. You can use this option to accept the click inside or outside the dropdown menu to make it interactive.

      +

      Dropdown menus can now be clickable with a new autoClose option to handle the auto close behavior. You can use this option to accept the click inside or outside the dropdown menu to make it interactive.

    • Dropdowns now support .dropdown-items wrapped in <li>s.

    -

    Jumbotron

    +

    Jumbotron

    -

    List group

    +

    List group

    - +
    • Added new null variables for font-size, font-weight, color, and :hover color to the .nav-link class.
    - +
    • Breaking Navbars now require a container within (to drastically simplify spacing requirements and CSS required).
    • Breaking The .active class can no longer be applied to .nav-items, it must be applied directly on .nav-links.
    -

    Offcanvas

    +

    Offcanvas

    -

    Pagination

    +

    Pagination

    • Pagination links now have customizable margin-left that are dynamically rounded on all corners when separated from one another.

      @@ -1404,7 +792,7 @@

      Added transitions to pagination links.

    -

    Popovers

    +

    Popovers

    • Breaking Renamed .arrow to .popover-arrow in our default popover template.

      @@ -1413,7 +801,7 @@

      Renamed whiteList option to allowList.

    -

    Spinners

    +

    Spinners

    • Spinners now honor prefers-reduced-motion: reduce by slowing down animations. See #31882.

      @@ -1422,10 +810,10 @@

      Improved spinner vertical alignment.

    -

    Toasts

    +

    Toasts

    • -

      Toasts can now be positioned in a .toast-container with the help of positioning utilities.

      +

      Toasts can now be positioned in a .toast-container with the help of positioning utilities.

    • Changed default toast duration to 5 seconds.

      @@ -1434,19 +822,19 @@

      Removed overflow: hidden from toasts and replaced with proper border-radiuss with calc() functions.

    -

    Tooltips

    +

    Tooltips

    • Breaking Renamed .arrow to .tooltip-arrow in our default tooltip template.

    • -

      Breaking The default value for the fallbackPlacements is changed to ['top', 'right', 'bottom', 'left'] for better placement of popper elements.

      +

      Breaking The default value for the fallbackPlacements is changed to ['top', 'right', 'bottom', 'left'] for better placement of popper elements.

    • Breaking Renamed whiteList option to allowList.

    -

    Utilities

    +

    Utilities

    • Breaking Renamed several utilities to use logical property names instead of directional names with the addition of RTL support:

      @@ -1463,25 +851,25 @@

      Breaking Disabled negative margins by default.

    • -

      Added new .bg-body class for quickly setting the <body>’s background to additional elements.

      +

      Added new .bg-body class for quickly setting the <body>’s background to additional elements.

    • -

      Added new position utilities for top, right, bottom, and left. Values include 0, 50%, and 100% for each property.

      +

      Added new position utilities for top, right, bottom, and left. Values include 0, 50%, and 100% for each property.

    • Added new .translate-middle-x & .translate-middle-y utilities to horizontally or vertically center absolute/fixed positioned elements.

    • -

      Added new border-width utilities.

      +

      Added new border-width utilities.

    • Breaking Renamed .text-monospace to .font-monospace.

    • -

      Breaking Removed .text-hide as it’s an antiquated method for hiding text that shouldn’t be used anymore.

      +

      Breaking Removed .text-hide as it’s an antiquated method for hiding text that shouldn’t be used anymore.

    • -

      Added .fs-* utilities for font-size utilities (with RFS enabled). These use the same scale as HTML’s default headings (1-6, large to small), and can be modified via Sass map.

      +

      Added .fs-* utilities for font-size utilities (with RFS enabled). These use the same scale as HTML’s default headings (1-6, large to small), and can be modified via Sass map.

    • Breaking Renamed .font-weight-* utilities as .fw-* for brevity and consistency.

      @@ -1496,7 +884,7 @@

      Breaking Removed .rounded-sm and rounded-lg, and introduced a new scale of classes, .rounded-0 to .rounded-3. See #31687.

    • -

      Added new line-height utilities: .lh-1, .lh-sm, .lh-base and .lh-lg. See here.

      +

      Added new line-height utilities: .lh-1, .lh-sm, .lh-base and .lh-lg. See here.

    • Moved the .d-none utility in our CSS to give it more weight over other display utilities.

      @@ -1505,19 +893,19 @@

      Extended the .visually-hidden-focusable helper to also work on containers, using :focus-within.

    -

    Helpers

    +

    Helpers

    • -

      Breaking Responsive embed helpers have been renamed to ratio helpers with new class names and improved behaviors, as well as a helpful CSS variable.

      +

      Breaking Responsive embed helpers have been renamed to ratio helpers with new class names and improved behaviors, as well as a helpful CSS variable.

      • Classes have been renamed to change by to x in the aspect ratio. For example, .ratio-16by9 is now .ratio-16x9.
      • -
      • We’ve dropped the .embed-responsive-item and element group selector in favor of a simpler .ratio > * selector. No more class is needed, and the ratio helper now works with any HTML element.
      • +
      • We’ve dropped the .embed-responsive-item and element group selector in favor of a simpler .ratio > * selector. No more class is needed, and the ratio helper now works with any HTML element.
      • The $embed-responsive-aspect-ratios Sass map has been renamed to $aspect-ratios and its values have been simplified to include the class name and the percentage as the key: value pair.
      • -
      • CSS variables are now generated and included for each value in the Sass map. Modify the --bs-aspect-ratio variable on the .ratio to create any custom aspect ratio.
      • +
      • CSS variables are now generated and included for each value in the Sass map. Modify the --bs-aspect-ratio variable on the .ratio to create any custom aspect ratio.
    • -

      Breaking “Screen reader” classes are now “visually hidden” classes.

      +

      Breaking "Screen reader" classes are now "visually hidden" classes.

      • Changed the Sass file from scss/helpers/_screenreaders.scss to scss/helpers/_visually-hidden.scss
      • Renamed .sr-only and .sr-only-focusable to .visually-hidden and .visually-hidden-focusable
      • @@ -1525,10 +913,10 @@
    • -

      bootstrap-utilities.css now also includes our helpers. Helpers don’t need to be imported in custom builds anymore.

      +

      bootstrap-utilities.css now also includes our helpers. Helpers don’t need to be imported in custom builds anymore.

    -

    JavaScript

    +

    JavaScript

    • Dropped jQuery dependency and rewrote plugins to be in regular JavaScript.

      @@ -1538,14 +926,15 @@
    • All plugins can now accept a CSS selector as the first argument. You can either pass a DOM element or any valid CSS selector to create a new instance of the plugin:

      -
      const modal = new bootstrap.Modal('#myModal')
      -const dropdown = new bootstrap.Dropdown('[data-bs-toggle="dropdown"]')
      -
    • -
    • -

      popperConfig can be passed as a function that accepts the Bootstrap’s default Popper config as an argument, so that you can merge this default configuration in your way. Applies to dropdowns, popovers, and tooltips.

      +
      const modal = new bootstrap.Modal('#myModal')
      +const dropdown = new bootstrap.Dropdown('[data-bs-toggle="dropdown"]')
      +
    • -

      The default value for the fallbackPlacements is changed to ['top', 'right', 'bottom', 'left'] for better placement of Popper elements. Applies to dropdowns, popovers, and tooltips.

      +

      popperConfig can be passed as a function that accepts the Bootstrap’s default Popper config as an argument, so that you can merge this default configuration in your way. Applies to dropdowns, popovers, and tooltips.

      +
    • +
    • +

      The default value for the fallbackPlacements is changed to ['top', 'right', 'bottom', 'left'] for better placement of Popper elements. Applies to dropdowns, popovers, and tooltips.

    • Removed underscore from public static methods like _getInstance()getInstance().

      @@ -1553,81 +942,8 @@
    • Removed util.js, with its functionality now integrated into individual plugins. If you previously included util.js manually, you can safely remove it, as it is no longer needed. Each plugin now contains only the utilities it requires, enhancing modularity and reducing dependencies.

    • -
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    \ No newline at end of file diff --git a/docs/5.3/utilities/api/index.html b/docs/5.3/utilities/api/index.html index 0e2a7236f1..f1bbc8bfdc 100644 --- a/docs/5.3/utilities/api/index.html +++ b/docs/5.3/utilities/api/index.html @@ -1,1186 +1,581 @@ - - - - - - - - - - - - - - - - -Utility API · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Utility API

    -
    -

    The utility API is a Sass-based tool to generate utility classes.

    - - -
    - - - - - -
    - - -

    Bootstrap utilities are generated with our utility API and can be used to modify or extend our default set of utility classes via Sass. Our utility API is based on a series of Sass maps and functions for generating families of classes with various options. If you’re unfamiliar with Sass maps, read up on the official Sass docs to get started.

    + Utility API · Bootstrap v5.3

    Utility API

    The utility API is a Sass-based tool to generate utility classes.

    +

    Bootstrap utilities are generated with our utility API and can be used to modify or extend our default set of utility classes via Sass. Our utility API is based on a series of Sass maps and functions for generating families of classes with various options. If you’re unfamiliar with Sass maps, read up on the official Sass docs to get started.

    The $utilities map contains all our utilities and is later merged with your custom $utilities map, if present. The utility map contains a keyed list of utility groups which accept the following options:

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    OptionTypeDefault valueDescription
    propertyRequiredName of the property, this can be a string or an array of strings (e.g., horizontal paddings or margins).
    valuesRequiredList of values, or a map if you don’t want the class name to be the same as the value. If null is used as map key, class is not prepended to the class name.
    classOptionalnullName of the generated class. If not provided and property is an array of strings, class will default to the first element of the property array. If not provided and property is a string, the values keys are used for the class names.
    css-varOptionalfalseBoolean to generate CSS variables instead of CSS rules.
    css-variable-nameOptionalnullCustom un-prefixed name for the CSS variable inside the ruleset.
    local-varsOptionalnullMap of local CSS variables to generate in addition to the CSS rules.
    stateOptionalnullList of pseudo-class variants (e.g., :hover or :focus) to generate.
    responsiveOptionalfalseBoolean indicating if responsive classes should be generated.
    rfsOptionalfalseBoolean to enable fluid rescaling with RFS.
    printOptionalfalseBoolean indicating if print classes need to be generated.
    rtlOptionaltrueBoolean indicating if utility should be kept in RTL.
    +
    -

    API explained

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    OptionTypeDefault valueDescription
    propertyRequiredName of the property, this can be a string or an array of strings (e.g., horizontal paddings or margins).
    valuesRequiredList of values, or a map if you don’t want the class name to be the same as the value. If null is used as map key, class is not prepended to the class name.
    classOptionalnullName of the generated class. If not provided and property is an array of strings, class will default to the first element of the property array. If not provided and property is a string, the values keys are used for the class names.
    css-varOptionalfalseBoolean to generate CSS variables instead of CSS rules.
    css-variable-nameOptionalnullCustom un-prefixed name for the CSS variable inside the ruleset.
    local-varsOptionalnullMap of local CSS variables to generate in addition to the CSS rules.
    stateOptionalnullList of pseudo-class variants (e.g., :hover or :focus) to generate.
    responsiveOptionalfalseBoolean indicating if responsive classes should be generated.
    rfsOptionalfalseBoolean to enable fluid rescaling with RFS.
    printOptionalfalseBoolean indicating if print classes need to be generated.
    rtlOptionaltrueBoolean indicating if utility should be kept in RTL.
    +

    API explained

    All utility variables are added to the $utilities variable within our _utilities.scss stylesheet. Each group of utilities looks something like this:

    -
    $utilities: (
    -  "opacity": (
    -    property: opacity,
    -    values: (
    -      0: 0,
    -      25: .25,
    -      50: .5,
    -      75: .75,
    -      100: 1,
    -    )
    -  )
    -);
    -

    Which outputs the following:

    -
    .opacity-0 { opacity: 0; }
    -.opacity-25 { opacity: .25; }
    -.opacity-50 { opacity: .5; }
    -.opacity-75 { opacity: .75; }
    -.opacity-100 { opacity: 1; }
    -

    Property

    -

    The required property key must be set for any utility, and it must contain a valid CSS property. This property is used in the generated utility’s ruleset. When the class key is omitted, it also serves as the default class name. Consider the text-decoration utility:

    -
    $utilities: (
    -  "text-decoration": (
    -    property: text-decoration,
    -    values: none underline line-through
    -  )
    -);
    -

    Output:

    -
    .text-decoration-none { text-decoration: none !important; }
    -.text-decoration-underline { text-decoration: underline !important; }
    -.text-decoration-line-through { text-decoration: line-through !important; }
    -

    Values

    +
    $utilities: (
    +  "opacity": (
    +    property: opacity,
    +    values: (
    +      0: 0,
    +      25: .25,
    +      50: .5,
    +      75: .75,
    +      100: 1,
    +    )
    +  )
    +);
    +
    +

    Which outputs the following:

    +
    .opacity-0 { opacity: 0; }
    +.opacity-25 { opacity: .25; }
    +.opacity-50 { opacity: .5; }
    +.opacity-75 { opacity: .75; }
    +.opacity-100 { opacity: 1; }
    +
    +

    Property

    +

    The required property key must be set for any utility, and it must contain a valid CSS property. This property is used in the generated utility’s ruleset. When the class key is omitted, it also serves as the default class name. Consider the text-decoration utility:

    +
    $utilities: (
    +  "text-decoration": (
    +    property: text-decoration,
    +    values: none underline line-through
    +  )
    +);
    +
    +

    Output:

    +
    .text-decoration-none { text-decoration: none !important; }
    +.text-decoration-underline { text-decoration: underline !important; }
    +.text-decoration-line-through { text-decoration: line-through !important; }
    +
    +

    Values

    Use the values key to specify which values for the specified property should be used in the generated class names and rules. Can be a list or map (set in the utilities or in a Sass variable).

    -

    As a list, like with text-decoration utilities:

    -
    values: none underline line-through
    -

    As a map, like with opacity utilities:

    -
    values: (
    -  0: 0,
    -  25: .25,
    -  50: .5,
    -  75: .75,
    -  100: 1,
    -)
    -

    As a Sass variable that sets the list or map, as in our position utilities:

    -
    values: $position-values
    -

    Class

    +

    As a list, like with text-decoration utilities:

    +
    values: none underline line-through
    +
    +

    As a map, like with opacity utilities:

    +
    values: (
    +  0: 0,
    +  25: .25,
    +  50: .5,
    +  75: .75,
    +  100: 1,
    +)
    +
    +

    As a Sass variable that sets the list or map, as in our position utilities:

    +
    values: $position-values
    +
    +

    Class

    Use the class option to change the class prefix used in the compiled CSS. For example, to change from .opacity-* to .o-*:

    -
    $utilities: (
    -  "opacity": (
    -    property: opacity,
    -    class: o,
    -    values: (
    -      0: 0,
    -      25: .25,
    -      50: .5,
    -      75: .75,
    -      100: 1,
    -    )
    -  )
    -);
    -

    Output:

    -
    .o-0 { opacity: 0 !important; }
    -.o-25 { opacity: .25 !important; }
    -.o-50 { opacity: .5 !important; }
    -.o-75 { opacity: .75 !important; }
    -.o-100 { opacity: 1 !important; }
    -

    If class: null, generates classes for each of the values keys:

    -
    $utilities: (
    -  "visibility": (
    -    property: visibility,
    -    class: null,
    -    values: (
    -      visible: visible,
    -      invisible: hidden,
    -    )
    -  )
    -);
    -

    Output:

    -
    .visible { visibility: visible !important; }
    -.invisible { visibility: hidden !important; }
    -

    CSS variable utilities

    +
    $utilities: (
    +  "opacity": (
    +    property: opacity,
    +    class: o,
    +    values: (
    +      0: 0,
    +      25: .25,
    +      50: .5,
    +      75: .75,
    +      100: 1,
    +    )
    +  )
    +);
    +
    +

    Output:

    +
    .o-0 { opacity: 0 !important; }
    +.o-25 { opacity: .25 !important; }
    +.o-50 { opacity: .5 !important; }
    +.o-75 { opacity: .75 !important; }
    +.o-100 { opacity: 1 !important; }
    +
    +

    If class: null, generates classes for each of the values keys:

    +
    $utilities: (
    +  "visibility": (
    +    property: visibility,
    +    class: null,
    +    values: (
    +      visible: visible,
    +      invisible: hidden,
    +    )
    +  )
    +);
    +
    +

    Output:

    +
    .visible { visibility: visible !important; }
    +.invisible { visibility: hidden !important; }
    +
    +

    CSS variable utilities

    Set the css-var boolean option to true and the API will generate local CSS variables for the given selector instead of the usual property: value rules. Add an optional css-variable-name to set a different CSS variable name than the class name.

    -

    Consider our .text-opacity-* utilities. If we add the css-variable-name option, we’ll get a custom output.

    -
    $utilities: (
    -  "text-opacity": (
    -    css-var: true,
    -    css-variable-name: text-alpha,
    -    class: text-opacity,
    -    values: (
    -      25: .25,
    -      50: .5,
    -      75: .75,
    -      100: 1
    -    )
    -  ),
    -);
    -

    Output:

    -
    .text-opacity-25 { --bs-text-alpha: .25; }
    -.text-opacity-50 { --bs-text-alpha: .5; }
    -.text-opacity-75 { --bs-text-alpha: .75; }
    -.text-opacity-100 { --bs-text-alpha: 1; }
    -

    Local CSS variables

    -

    Use the local-vars option to specify a Sass map that will generate local CSS variables within the utility class’s ruleset. Please note that it may require additional work to consume those local CSS variables in the generated CSS rules. For example, consider our .bg-* utilities:

    -
    $utilities: (
    -  "background-color": (
    -    property: background-color,
    -    class: bg,
    -    local-vars: (
    -      "bg-opacity": 1
    -    ),
    -    values: map-merge(
    -      $utilities-bg-colors,
    -      (
    -        "transparent": transparent
    -      )
    -    )
    -  )
    -);
    -

    Output:

    -
    .bg-primary {
    -  --bs-bg-opacity: 1;
    -  background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;
    -}
    -

    States

    -

    Use the state option to generate pseudo-class variations. Example pseudo-classes are :hover and :focus. When a list of states are provided, classnames are created for that pseudo-class. For example, to change opacity on hover, add state: hover and you’ll get .opacity-hover:hover in your compiled CSS.

    +

    Consider our .text-opacity-* utilities. If we add the css-variable-name option, we'll get a custom output.

    +
    $utilities: (
    +  "text-opacity": (
    +    css-var: true,
    +    css-variable-name: text-alpha,
    +    class: text-opacity,
    +    values: (
    +      25: .25,
    +      50: .5,
    +      75: .75,
    +      100: 1
    +    )
    +  ),
    +);
    +
    +

    Output:

    +
    .text-opacity-25 { --bs-text-alpha: .25; }
    +.text-opacity-50 { --bs-text-alpha: .5; }
    +.text-opacity-75 { --bs-text-alpha: .75; }
    +.text-opacity-100 { --bs-text-alpha: 1; }
    +
    +

    Local CSS variables

    +

    Use the local-vars option to specify a Sass map that will generate local CSS variables within the utility class’s ruleset. Please note that it may require additional work to consume those local CSS variables in the generated CSS rules. For example, consider our .bg-* utilities:

    +
    $utilities: (
    +  "background-color": (
    +    property: background-color,
    +    class: bg,
    +    local-vars: (
    +      "bg-opacity": 1
    +    ),
    +    values: map-merge(
    +      $utilities-bg-colors,
    +      (
    +        "transparent": transparent
    +      )
    +    )
    +  )
    +);
    +
    +

    Output:

    +
    .bg-primary {
    +  --bs-bg-opacity: 1;
    +  background-color: rgba(var(--bs-primary-rgb), var(--bs-bg-opacity)) !important;
    +}
    +
    +

    States

    +

    Use the state option to generate pseudo-class variations. Example pseudo-classes are :hover and :focus. When a list of states are provided, classnames are created for that pseudo-class. For example, to change opacity on hover, add state: hover and you’ll get .opacity-hover:hover in your compiled CSS.

    Need multiple pseudo-classes? Use a space-separated list of states: state: hover focus.

    -
    $utilities: (
    -  "opacity": (
    -    property: opacity,
    -    class: opacity,
    -    state: hover,
    -    values: (
    -      0: 0,
    -      25: .25,
    -      50: .5,
    -      75: .75,
    -      100: 1,
    -    )
    -  )
    -);
    -

    Output:

    -
    .opacity-0-hover:hover { opacity: 0 !important; }
    -.opacity-25-hover:hover { opacity: .25 !important; }
    -.opacity-50-hover:hover { opacity: .5 !important; }
    -.opacity-75-hover:hover { opacity: .75 !important; }
    -.opacity-100-hover:hover { opacity: 1 !important; }
    -

    Responsive

    -

    Add the responsive boolean to generate responsive utilities (e.g., .opacity-md-25) across all breakpoints.

    -
    $utilities: (
    -  "opacity": (
    -    property: opacity,
    -    responsive: true,
    -    values: (
    -      0: 0,
    -      25: .25,
    -      50: .5,
    -      75: .75,
    -      100: 1,
    -    )
    -  )
    -);
    -

    Output:

    -
    .opacity-0 { opacity: 0 !important; }
    -.opacity-25 { opacity: .25 !important; }
    -.opacity-50 { opacity: .5 !important; }
    -.opacity-75 { opacity: .75 !important; }
    -.opacity-100 { opacity: 1 !important; }
    -
    -@media (min-width: 576px) {
    -  .opacity-sm-0 { opacity: 0 !important; }
    -  .opacity-sm-25 { opacity: .25 !important; }
    -  .opacity-sm-50 { opacity: .5 !important; }
    -  .opacity-sm-75 { opacity: .75 !important; }
    -  .opacity-sm-100 { opacity: 1 !important; }
    -}
    -
    -@media (min-width: 768px) {
    -  .opacity-md-0 { opacity: 0 !important; }
    -  .opacity-md-25 { opacity: .25 !important; }
    -  .opacity-md-50 { opacity: .5 !important; }
    -  .opacity-md-75 { opacity: .75 !important; }
    -  .opacity-md-100 { opacity: 1 !important; }
    -}
    -
    -@media (min-width: 992px) {
    -  .opacity-lg-0 { opacity: 0 !important; }
    -  .opacity-lg-25 { opacity: .25 !important; }
    -  .opacity-lg-50 { opacity: .5 !important; }
    -  .opacity-lg-75 { opacity: .75 !important; }
    -  .opacity-lg-100 { opacity: 1 !important; }
    -}
    -
    -@media (min-width: 1200px) {
    -  .opacity-xl-0 { opacity: 0 !important; }
    -  .opacity-xl-25 { opacity: .25 !important; }
    -  .opacity-xl-50 { opacity: .5 !important; }
    -  .opacity-xl-75 { opacity: .75 !important; }
    -  .opacity-xl-100 { opacity: 1 !important; }
    -}
    -
    -@media (min-width: 1400px) {
    -  .opacity-xxl-0 { opacity: 0 !important; }
    -  .opacity-xxl-25 { opacity: .25 !important; }
    -  .opacity-xxl-50 { opacity: .5 !important; }
    -  .opacity-xxl-75 { opacity: .75 !important; }
    -  .opacity-xxl-100 { opacity: 1 !important; }
    -}
    -

    Print

    +
    $utilities: (
    +  "opacity": (
    +    property: opacity,
    +    class: opacity,
    +    state: hover,
    +    values: (
    +      0: 0,
    +      25: .25,
    +      50: .5,
    +      75: .75,
    +      100: 1,
    +    )
    +  )
    +);
    +
    +

    Output:

    +
    .opacity-0-hover:hover { opacity: 0 !important; }
    +.opacity-25-hover:hover { opacity: .25 !important; }
    +.opacity-50-hover:hover { opacity: .5 !important; }
    +.opacity-75-hover:hover { opacity: .75 !important; }
    +.opacity-100-hover:hover { opacity: 1 !important; }
    +
    +

    Responsive

    +

    Add the responsive boolean to generate responsive utilities (e.g., .opacity-md-25) across all breakpoints.

    +
    $utilities: (
    +  "opacity": (
    +    property: opacity,
    +    responsive: true,
    +    values: (
    +      0: 0,
    +      25: .25,
    +      50: .5,
    +      75: .75,
    +      100: 1,
    +    )
    +  )
    +);
    +
    +

    Output:

    +
    .opacity-0 { opacity: 0 !important; }
    +.opacity-25 { opacity: .25 !important; }
    +.opacity-50 { opacity: .5 !important; }
    +.opacity-75 { opacity: .75 !important; }
    +.opacity-100 { opacity: 1 !important; }
    +
    +@media (min-width: 576px) {
    +  .opacity-sm-0 { opacity: 0 !important; }
    +  .opacity-sm-25 { opacity: .25 !important; }
    +  .opacity-sm-50 { opacity: .5 !important; }
    +  .opacity-sm-75 { opacity: .75 !important; }
    +  .opacity-sm-100 { opacity: 1 !important; }
    +}
    +
    +@media (min-width: 768px) {
    +  .opacity-md-0 { opacity: 0 !important; }
    +  .opacity-md-25 { opacity: .25 !important; }
    +  .opacity-md-50 { opacity: .5 !important; }
    +  .opacity-md-75 { opacity: .75 !important; }
    +  .opacity-md-100 { opacity: 1 !important; }
    +}
    +
    +@media (min-width: 992px) {
    +  .opacity-lg-0 { opacity: 0 !important; }
    +  .opacity-lg-25 { opacity: .25 !important; }
    +  .opacity-lg-50 { opacity: .5 !important; }
    +  .opacity-lg-75 { opacity: .75 !important; }
    +  .opacity-lg-100 { opacity: 1 !important; }
    +}
    +
    +@media (min-width: 1200px) {
    +  .opacity-xl-0 { opacity: 0 !important; }
    +  .opacity-xl-25 { opacity: .25 !important; }
    +  .opacity-xl-50 { opacity: .5 !important; }
    +  .opacity-xl-75 { opacity: .75 !important; }
    +  .opacity-xl-100 { opacity: 1 !important; }
    +}
    +
    +@media (min-width: 1400px) {
    +  .opacity-xxl-0 { opacity: 0 !important; }
    +  .opacity-xxl-25 { opacity: .25 !important; }
    +  .opacity-xxl-50 { opacity: .5 !important; }
    +  .opacity-xxl-75 { opacity: .75 !important; }
    +  .opacity-xxl-100 { opacity: 1 !important; }
    +}
    +
    +

    Print

    Enabling the print option will also generate utility classes for print, which are only applied within the @media print { ... } media query.

    -
    $utilities: (
    -  "opacity": (
    -    property: opacity,
    -    print: true,
    -    values: (
    -      0: 0,
    -      25: .25,
    -      50: .5,
    -      75: .75,
    -      100: 1,
    -    )
    -  )
    -);
    -

    Output:

    -
    .opacity-0 { opacity: 0 !important; }
    -.opacity-25 { opacity: .25 !important; }
    -.opacity-50 { opacity: .5 !important; }
    -.opacity-75 { opacity: .75 !important; }
    -.opacity-100 { opacity: 1 !important; }
    -
    -@media print {
    -  .opacity-print-0 { opacity: 0 !important; }
    -  .opacity-print-25 { opacity: .25 !important; }
    -  .opacity-print-50 { opacity: .5 !important; }
    -  .opacity-print-75 { opacity: .75 !important; }
    -  .opacity-print-100 { opacity: 1 !important; }
    -}
    -

    Importance

    +
    $utilities: (
    +  "opacity": (
    +    property: opacity,
    +    print: true,
    +    values: (
    +      0: 0,
    +      25: .25,
    +      50: .5,
    +      75: .75,
    +      100: 1,
    +    )
    +  )
    +);
    +
    +

    Output:

    +
    .opacity-0 { opacity: 0 !important; }
    +.opacity-25 { opacity: .25 !important; }
    +.opacity-50 { opacity: .5 !important; }
    +.opacity-75 { opacity: .75 !important; }
    +.opacity-100 { opacity: 1 !important; }
    +
    +@media print {
    +  .opacity-print-0 { opacity: 0 !important; }
    +  .opacity-print-25 { opacity: .25 !important; }
    +  .opacity-print-50 { opacity: .5 !important; }
    +  .opacity-print-75 { opacity: .75 !important; }
    +  .opacity-print-100 { opacity: 1 !important; }
    +}
    +
    +

    Importance

    All utilities generated by the API include !important to ensure they override components and modifier classes as intended. You can toggle this setting globally with the $enable-important-utilities variable (defaults to true).

    -

    Using the API

    -

    Now that you’re familiar with how the utilities API works, learn how to add your own custom classes and modify our default utilities.

    -

    Override utilities

    +

    Using the API

    +

    Now that you’re familiar with how the utilities API works, learn how to add your own custom classes and modify our default utilities.

    +

    Override utilities

    Override existing utilities by using the same key. For example, if you want additional responsive overflow utility classes, you can do this:

    -
    $utilities: (
    -  "overflow": (
    -    responsive: true,
    -    property: overflow,
    -    values: visible hidden scroll auto,
    -  ),
    -);
    -

    Add utilities

    -

    New utilities can be added to the default $utilities map with a map-merge. Make sure our required Sass files and _utilities.scss are imported first, then use the map-merge to add your additional utilities. For example, here’s how to add a responsive cursor utility with three values.

    -
    @import "bootstrap/scss/functions";
    -@import "bootstrap/scss/variables";
    -@import "bootstrap/scss/variables-dark";
    -@import "bootstrap/scss/maps";
    -@import "bootstrap/scss/mixins";
    -@import "bootstrap/scss/utilities";
    -
    -$utilities: map-merge(
    -  $utilities,
    -  (
    -    "cursor": (
    -      property: cursor,
    -      class: cursor,
    -      responsive: true,
    -      values: auto pointer grab,
    -    )
    -  )
    -);
    -
    -@import "bootstrap/scss/utilities/api";
    -

    Modify utilities

    -

    Modify existing utilities in the default $utilities map with map-get and map-merge functions. In the example below, we’re adding an additional value to the width utilities. Start with an initial map-merge and then specify which utility you want to modify. From there, fetch the nested "width" map with map-get to access and modify the utility’s options and values.

    -
    @import "bootstrap/scss/functions";
    -@import "bootstrap/scss/variables";
    -@import "bootstrap/scss/variables-dark";
    -@import "bootstrap/scss/maps";
    -@import "bootstrap/scss/mixins";
    -@import "bootstrap/scss/utilities";
    -
    -$utilities: map-merge(
    -  $utilities,
    -  (
    -    "width": map-merge(
    -      map-get($utilities, "width"),
    -      (
    -        values: map-merge(
    -          map-get(map-get($utilities, "width"), "values"),
    -          (10: 10%),
    -        ),
    -      ),
    -    ),
    -  )
    -);
    -
    -@import "bootstrap/scss/utilities/api";
    -

    Enable responsive

    +
    $utilities: (
    +  "overflow": (
    +    responsive: true,
    +    property: overflow,
    +    values: visible hidden scroll auto,
    +  ),
    +);
    +
    +

    Add utilities

    +

    New utilities can be added to the default $utilities map with a map-merge. Make sure our required Sass files and _utilities.scss are imported first, then use the map-merge to add your additional utilities. For example, here’s how to add a responsive cursor utility with three values.

    +
    @import "bootstrap/scss/functions";
    +@import "bootstrap/scss/variables";
    +@import "bootstrap/scss/variables-dark";
    +@import "bootstrap/scss/maps";
    +@import "bootstrap/scss/mixins";
    +@import "bootstrap/scss/utilities";
    +
    +$utilities: map-merge(
    +  $utilities,
    +  (
    +    "cursor": (
    +      property: cursor,
    +      class: cursor,
    +      responsive: true,
    +      values: auto pointer grab,
    +    )
    +  )
    +);
    +
    +@import "bootstrap/scss/utilities/api";
    +
    +

    Modify utilities

    +

    Modify existing utilities in the default $utilities map with map-get and map-merge functions. In the example below, we’re adding an additional value to the width utilities. Start with an initial map-merge and then specify which utility you want to modify. From there, fetch the nested "width" map with map-get to access and modify the utility’s options and values.

    +
    @import "bootstrap/scss/functions";
    +@import "bootstrap/scss/variables";
    +@import "bootstrap/scss/variables-dark";
    +@import "bootstrap/scss/maps";
    +@import "bootstrap/scss/mixins";
    +@import "bootstrap/scss/utilities";
    +
    +$utilities: map-merge(
    +  $utilities,
    +  (
    +    "width": map-merge(
    +      map-get($utilities, "width"),
    +      (
    +        values: map-merge(
    +          map-get(map-get($utilities, "width"), "values"),
    +          (10: 10%),
    +        ),
    +      ),
    +    ),
    +  )
    +);
    +
    +@import "bootstrap/scss/utilities/api";
    +
    +

    Enable responsive

    You can enable responsive classes for an existing set of utilities that are not currently responsive by default. For example, to make the border classes responsive:

    -
    @import "bootstrap/scss/functions";
    -@import "bootstrap/scss/variables";
    -@import "bootstrap/scss/variables-dark";
    -@import "bootstrap/scss/maps";
    -@import "bootstrap/scss/mixins";
    -@import "bootstrap/scss/utilities";
    -
    -$utilities: map-merge(
    -  $utilities,
    -  (
    -    "border": map-merge(
    -      map-get($utilities, "border"),
    -      ( responsive: true ),
    -    ),
    -  )
    -);
    -
    -@import "bootstrap/scss/utilities/api";
    -

    This will now generate responsive variations of .border and .border-0 for each breakpoint. Your generated CSS will look like this:

    -
    .border { ... }
    -.border-0 { ... }
    -
    -@media (min-width: 576px) {
    -  .border-sm { ... }
    -  .border-sm-0 { ... }
    -}
    -
    -@media (min-width: 768px) {
    -  .border-md { ... }
    -  .border-md-0 { ... }
    -}
    -
    -@media (min-width: 992px) {
    -  .border-lg { ... }
    -  .border-lg-0 { ... }
    -}
    -
    -@media (min-width: 1200px) {
    -  .border-xl { ... }
    -  .border-xl-0 { ... }
    -}
    -
    -@media (min-width: 1400px) {
    -  .border-xxl { ... }
    -  .border-xxl-0 { ... }
    -}
    -

    Rename utilities

    +
    @import "bootstrap/scss/functions";
    +@import "bootstrap/scss/variables";
    +@import "bootstrap/scss/variables-dark";
    +@import "bootstrap/scss/maps";
    +@import "bootstrap/scss/mixins";
    +@import "bootstrap/scss/utilities";
    +
    +$utilities: map-merge(
    +  $utilities,
    +  (
    +    "border": map-merge(
    +      map-get($utilities, "border"),
    +      ( responsive: true ),
    +    ),
    +  )
    +);
    +
    +@import "bootstrap/scss/utilities/api";
    +
    +

    This will now generate responsive variations of .border and .border-0 for each breakpoint. Your generated CSS will look like this:

    +
    .border { ... }
    +.border-0 { ... }
    +
    +@media (min-width: 576px) {
    +  .border-sm { ... }
    +  .border-sm-0 { ... }
    +}
    +
    +@media (min-width: 768px) {
    +  .border-md { ... }
    +  .border-md-0 { ... }
    +}
    +
    +@media (min-width: 992px) {
    +  .border-lg { ... }
    +  .border-lg-0 { ... }
    +}
    +
    +@media (min-width: 1200px) {
    +  .border-xl { ... }
    +  .border-xl-0 { ... }
    +}
    +
    +@media (min-width: 1400px) {
    +  .border-xxl { ... }
    +  .border-xxl-0 { ... }
    +}
    +
    +

    Rename utilities

    Missing v4 utilities, or used to another naming convention? The utilities API can be used to override the resulting class of a given utility—for example, to rename .ms-* utilities to oldish .ml-*:

    -
    @import "bootstrap/scss/functions";
    -@import "bootstrap/scss/variables";
    -@import "bootstrap/scss/variables-dark";
    -@import "bootstrap/scss/maps";
    -@import "bootstrap/scss/mixins";
    -@import "bootstrap/scss/utilities";
    -
    -$utilities: map-merge(
    -  $utilities,
    -  (
    -    "margin-start": map-merge(
    -      map-get($utilities, "margin-start"),
    -      ( class: ml ),
    -    ),
    -  )
    -);
    -
    -@import "bootstrap/scss/utilities/api";
    -

    Remove utilities

    +
    @import "bootstrap/scss/functions";
    +@import "bootstrap/scss/variables";
    +@import "bootstrap/scss/variables-dark";
    +@import "bootstrap/scss/maps";
    +@import "bootstrap/scss/mixins";
    +@import "bootstrap/scss/utilities";
    +
    +$utilities: map-merge(
    +  $utilities,
    +  (
    +    "margin-start": map-merge(
    +      map-get($utilities, "margin-start"),
    +      ( class: ml ),
    +    ),
    +  )
    +);
    +
    +@import "bootstrap/scss/utilities/api";
    +
    +

    Remove utilities

    Remove any of the default utilities with the map-remove() Sass function.

    -
    @import "bootstrap/scss/functions";
    -@import "bootstrap/scss/variables";
    -@import "bootstrap/scss/variables-dark";
    -@import "bootstrap/scss/maps";
    -@import "bootstrap/scss/mixins";
    -@import "bootstrap/scss/utilities";
    -
    -// Remove multiple utilities with a comma-separated list
    -$utilities: map-remove($utilities, "width", "float");
    -
    -@import "bootstrap/scss/utilities/api";
    -

    You can also use the map-merge() Sass function and set the group key to null to remove the utility.

    -
    @import "bootstrap/scss/functions";
    -@import "bootstrap/scss/variables";
    -@import "bootstrap/scss/variables-dark";
    -@import "bootstrap/scss/maps";
    -@import "bootstrap/scss/mixins";
    -@import "bootstrap/scss/utilities";
    -
    -$utilities: map-merge(
    -  $utilities,
    -  (
    -    "width": null
    -  )
    -);
    -
    -@import "bootstrap/scss/utilities/api";
    -

    Add, remove, modify

    -

    You can add, remove, and modify many utilities all at once with the map-merge() Sass function. Here’s how you can combine the previous examples into one larger map.

    -
    @import "bootstrap/scss/functions";
    -@import "bootstrap/scss/variables";
    -@import "bootstrap/scss/variables-dark";
    -@import "bootstrap/scss/maps";
    -@import "bootstrap/scss/mixins";
    -@import "bootstrap/scss/utilities";
    -
    -$utilities: map-merge(
    -  $utilities,
    -  (
    -    // Remove the `width` utility
    -    "width": null,
    -    // Make an existing utility responsive
    -    "border": map-merge(
    -      map-get($utilities, "border"),
    -      ( responsive: true ),
    -    ),
    -    // Add new utilities
    -    "cursor": (
    -      property: cursor,
    -      class: cursor,
    -      responsive: true,
    -      values: auto pointer grab,
    -    )
    -  )
    -);
    -
    -@import "bootstrap/scss/utilities/api";
    -

    Remove utility in RTL

    +
    @import "bootstrap/scss/functions";
    +@import "bootstrap/scss/variables";
    +@import "bootstrap/scss/variables-dark";
    +@import "bootstrap/scss/maps";
    +@import "bootstrap/scss/mixins";
    +@import "bootstrap/scss/utilities";
    +
    +// Remove multiple utilities with a comma-separated list
    +$utilities: map-remove($utilities, "width", "float");
    +
    +@import "bootstrap/scss/utilities/api";
    +
    +

    You can also use the map-merge() Sass function and set the group key to null to remove the utility.

    +
    @import "bootstrap/scss/functions";
    +@import "bootstrap/scss/variables";
    +@import "bootstrap/scss/variables-dark";
    +@import "bootstrap/scss/maps";
    +@import "bootstrap/scss/mixins";
    +@import "bootstrap/scss/utilities";
    +
    +$utilities: map-merge(
    +  $utilities,
    +  (
    +    "width": null
    +  )
    +);
    +
    +@import "bootstrap/scss/utilities/api";
    +
    +

    Add, remove, modify

    +

    You can add, remove, and modify many utilities all at once with the map-merge() Sass function. Here’s how you can combine the previous examples into one larger map.

    +
    @import "bootstrap/scss/functions";
    +@import "bootstrap/scss/variables";
    +@import "bootstrap/scss/variables-dark";
    +@import "bootstrap/scss/maps";
    +@import "bootstrap/scss/mixins";
    +@import "bootstrap/scss/utilities";
    +
    +$utilities: map-merge(
    +  $utilities,
    +  (
    +    // Remove the `width` utility
    +    "width": null,
    +    // Make an existing utility responsive
    +    "border": map-merge(
    +      map-get($utilities, "border"),
    +      ( responsive: true ),
    +    ),
    +    // Add new utilities
    +    "cursor": (
    +      property: cursor,
    +      class: cursor,
    +      responsive: true,
    +      values: auto pointer grab,
    +    )
    +  )
    +);
    +
    +@import "bootstrap/scss/utilities/api";
    +
    +

    Remove utility in RTL

    Some edge cases make RTL styling difficult, such as line breaks in Arabic. Thus utilities can be dropped from RTL output by setting the rtl option to false:

    -
    $utilities: (
    -  "word-wrap": (
    -    property: word-wrap word-break,
    -    class: text,
    -    values: (break: break-word),
    -    rtl: false
    -  ),
    -);
    -

    Output:

    -
    /* rtl:begin:remove */
    -.text-break {
    -  word-wrap: break-word !important;
    -  word-break: break-word !important;
    -}
    -/* rtl:end:remove */
    -

    This doesn’t output anything in RTL, thanks to the RTLCSS remove control directive.

    - -
    -
    -
    - - - - - - - - - - - - - - - +
    $utilities: (
    +  "word-wrap": (
    +    property: word-wrap word-break,
    +    class: text,
    +    values: (break: break-word),
    +    rtl: false
    +  ),
    +);
    +
    +

    Output:

    +
    /* rtl:begin:remove */
    +.text-break {
    +  word-wrap: break-word !important;
    +  word-break: break-word !important;
    +}
    +/* rtl:end:remove */
    +
    +

    This doesn’t output anything in RTL, thanks to the RTLCSS remove control directive.

    \ No newline at end of file diff --git a/docs/5.3/utilities/background/index.html b/docs/5.3/utilities/background/index.html index 8953f327c9..988877c298 100644 --- a/docs/5.3/utilities/background/index.html +++ b/docs/5.3/utilities/background/index.html @@ -1,589 +1,31 @@ - - - - - - - - - - - - - - - - -Background · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Background

    -
    -

    Convey meaning through background-color and add decoration with gradients.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -
    -Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class. -
    - -

    Background color

    -

    Similar to the contextual text color classes, set the background of an element to any contextual class. Background utilities do not set color, so in some cases you’ll want to use .text-* color utilities.

    -
    -Background utilities like .bg-* that generated from our original $theme-colors Sass map don’t yet respond to color modes, however, any .bg-*-subtle utility will. This will be resolved in v6. -
    - -
    -
    - - -
    .bg-primary
    + Background · Bootstrap v5.3

    Background

    Convey meaning through background-color and add decoration with gradients.

    +

    Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class.

    +

    Background color

    +

    Similar to the contextual text color classes, set the background of an element to any contextual class. Background utilities do not set color, so in some cases you’ll want to use .text-* color utilities.

    +

    Background utilities like .bg-* that generated from our original $theme-colors Sass map don’t yet respond to color modes, however, any .bg-*-subtle utility will. This will be resolved in v6.

    +
    .bg-primary
    .bg-primary-subtle
    .bg-secondary
    .bg-secondary-subtle
    @@ -604,517 +46,270 @@ Background utilities like .bg-* that generated from our original .bg-body
    .bg-black
    .bg-white
    -
    .bg-transparent
    - -
    - html -
    - - -
    -
    <div class="p-3 mb-2 bg-primary text-white">.bg-primary</div>
    -<div class="p-3 mb-2 bg-primary-subtle text-primary-emphasis">.bg-primary-subtle</div>
    -<div class="p-3 mb-2 bg-secondary text-white">.bg-secondary</div>
    -<div class="p-3 mb-2 bg-secondary-subtle text-secondary-emphasis">.bg-secondary-subtle</div>
    -<div class="p-3 mb-2 bg-success text-white">.bg-success</div>
    -<div class="p-3 mb-2 bg-success-subtle text-success-emphasis">.bg-success-subtle</div>
    -<div class="p-3 mb-2 bg-danger text-white">.bg-danger</div>
    -<div class="p-3 mb-2 bg-danger-subtle text-danger-emphasis">.bg-danger-subtle</div>
    -<div class="p-3 mb-2 bg-warning text-dark">.bg-warning</div>
    -<div class="p-3 mb-2 bg-warning-subtle text-warning-emphasis">.bg-warning-subtle</div>
    -<div class="p-3 mb-2 bg-info text-dark">.bg-info</div>
    -<div class="p-3 mb-2 bg-info-subtle text-info-emphasis">.bg-info-subtle</div>
    -<div class="p-3 mb-2 bg-light text-dark">.bg-light</div>
    -<div class="p-3 mb-2 bg-light-subtle text-light-emphasis">.bg-light-subtle</div>
    -<div class="p-3 mb-2 bg-dark text-white">.bg-dark</div>
    -<div class="p-3 mb-2 bg-dark-subtle text-dark-emphasis">.bg-dark-subtle</div>
    -<div class="p-3 mb-2 bg-body-secondary">.bg-body-secondary</div>
    -<div class="p-3 mb-2 bg-body-tertiary">.bg-body-tertiary</div>
    -<div class="p-3 mb-2 bg-body text-body">.bg-body</div>
    -<div class="p-3 mb-2 bg-black text-white">.bg-black</div>
    -<div class="p-3 mb-2 bg-white text-dark">.bg-white</div>
    -<div class="p-3 mb-2 bg-transparent text-body">.bg-transparent</div>
    -
    - -

    Background gradient

    +
    .bg-transparent
    html
    <div class="p-3 mb-2 bg-primary text-white">.bg-primary</div>
    +<div class="p-3 mb-2 bg-primary-subtle text-primary-emphasis">.bg-primary-subtle</div>
    +<div class="p-3 mb-2 bg-secondary text-white">.bg-secondary</div>
    +<div class="p-3 mb-2 bg-secondary-subtle text-secondary-emphasis">.bg-secondary-subtle</div>
    +<div class="p-3 mb-2 bg-success text-white">.bg-success</div>
    +<div class="p-3 mb-2 bg-success-subtle text-success-emphasis">.bg-success-subtle</div>
    +<div class="p-3 mb-2 bg-danger text-white">.bg-danger</div>
    +<div class="p-3 mb-2 bg-danger-subtle text-danger-emphasis">.bg-danger-subtle</div>
    +<div class="p-3 mb-2 bg-warning text-dark">.bg-warning</div>
    +<div class="p-3 mb-2 bg-warning-subtle text-warning-emphasis">.bg-warning-subtle</div>
    +<div class="p-3 mb-2 bg-info text-dark">.bg-info</div>
    +<div class="p-3 mb-2 bg-info-subtle text-info-emphasis">.bg-info-subtle</div>
    +<div class="p-3 mb-2 bg-light text-dark">.bg-light</div>
    +<div class="p-3 mb-2 bg-light-subtle text-light-emphasis">.bg-light-subtle</div>
    +<div class="p-3 mb-2 bg-dark text-white">.bg-dark</div>
    +<div class="p-3 mb-2 bg-dark-subtle text-dark-emphasis">.bg-dark-subtle</div>
    +<div class="p-3 mb-2 bg-body-secondary">.bg-body-secondary</div>
    +<div class="p-3 mb-2 bg-body-tertiary">.bg-body-tertiary</div>
    +<div class="p-3 mb-2 bg-body text-body">.bg-body</div>
    +<div class="p-3 mb-2 bg-black text-white">.bg-black</div>
    +<div class="p-3 mb-2 bg-white text-dark">.bg-white</div>
    +<div class="p-3 mb-2 bg-transparent text-body">.bg-transparent</div>
    +

    Background gradient

    By adding a .bg-gradient class, a linear gradient is added as background image to the backgrounds. This gradient starts with a semi-transparent white which fades out to the bottom.

    Do you need a gradient in your custom CSS? Just add background-image: var(--bs-gradient);.

    -
    .bg-primary.bg-gradient
    -
    .bg-secondary.bg-gradient
    -
    .bg-success.bg-gradient
    -
    .bg-danger.bg-gradient
    -
    .bg-warning.bg-gradient
    -
    .bg-info.bg-gradient
    -
    .bg-light.bg-gradient
    -
    .bg-dark.bg-gradient
    +
    .bg-primary.bg-gradient
    .bg-secondary.bg-gradient
    .bg-success.bg-gradient
    .bg-danger.bg-gradient
    .bg-warning.bg-gradient
    .bg-info.bg-gradient
    .bg-light.bg-gradient
    .bg-dark.bg-gradient
    .bg-black.bg-gradient
    - -

    Opacity

    +

    Opacity

    Added in v5.1.0 -

    As of v5.1.0, background-color utilities are generated with Sass using CSS variables. This allows for real-time color changes without compilation and dynamic alpha transparency changes.

    -

    How it works

    +

    How it works

    Consider our default .bg-success utility.

    -
    .bg-success {
    -  --bs-bg-opacity: 1;
    -  background-color: rgba(var(--bs-success-rgb), var(--bs-bg-opacity)) !important;
    -}
    -

    We use an RGB version of our --bs-success (with the value of 25, 135, 84) CSS variable and attached a second CSS variable, --bs-bg-opacity, for the alpha transparency (with a default value 1 thanks to a local CSS variable). That means anytime you use .bg-success now, your computed color value is rgba(25, 135, 84, 1). The local CSS variable inside each .bg-* class avoids inheritance issues so nested instances of the utilities don’t automatically have a modified alpha transparency.

    -

    Example

    +
    .bg-success {
    +  --bs-bg-opacity: 1;
    +  background-color: rgba(var(--bs-success-rgb), var(--bs-bg-opacity)) !important;
    +}
    +
    +

    We use an RGB version of our --bs-success (with the value of 25, 135, 84) CSS variable and attached a second CSS variable, --bs-bg-opacity, for the alpha transparency (with a default value 1 thanks to a local CSS variable). That means anytime you use .bg-success now, your computed color value is rgba(25, 135, 84, 1). The local CSS variable inside each .bg-* class avoids inheritance issues so nested instances of the utilities don’t automatically have a modified alpha transparency.

    +

    Example

    To change that opacity, override --bs-bg-opacity via custom styles or inline styles.

    -
    -
    - -
    This is default success background
    -
    This is 50% opacity success background
    - -
    - html -
    - - -
    -
    <div class="bg-success p-2 text-white">This is default success background</div>
    -<div class="bg-success p-2" style="--bs-bg-opacity: .5;">This is 50% opacity success background</div>
    -
    - +
    This is default success background
    +
    This is 50% opacity success background
    html
    <div class="bg-success p-2 text-white">This is default success background</div>
    +<div class="bg-success p-2" style="--bs-bg-opacity: .5;">This is 50% opacity success background</div>

    Or, choose from any of the .bg-opacity utilities:

    -
    -
    - -
    This is default success background
    +
    This is default success background
    This is 75% opacity success background
    This is 50% opacity success background
    This is 25% opacity success background
    -
    This is 10% opacity success background
    - -
    - html -
    - - -
    -
    <div class="bg-success p-2 text-white">This is default success background</div>
    -<div class="bg-success p-2 text-white bg-opacity-75">This is 75% opacity success background</div>
    -<div class="bg-success p-2 text-dark bg-opacity-50">This is 50% opacity success background</div>
    -<div class="bg-success p-2 text-dark bg-opacity-25">This is 25% opacity success background</div>
    -<div class="bg-success p-2 text-dark bg-opacity-10">This is 10% opacity success background</div>
    -
    - -

    CSS

    -

    In addition to the following Sass functionality, consider reading about our included CSS custom properties (aka CSS variables) for colors and more.

    -

    Sass variables

    +
    This is 10% opacity success background
    html
    <div class="bg-success p-2 text-white">This is default success background</div>
    +<div class="bg-success p-2 text-white bg-opacity-75">This is 75% opacity success background</div>
    +<div class="bg-success p-2 text-dark bg-opacity-50">This is 50% opacity success background</div>
    +<div class="bg-success p-2 text-dark bg-opacity-25">This is 25% opacity success background</div>
    +<div class="bg-success p-2 text-dark bg-opacity-10">This is 10% opacity success background</div>
    +

    CSS

    +

    In addition to the following Sass functionality, consider reading about our included CSS custom properties (aka CSS variables) for colors and more.

    +

    Sass variables

    Most background-color utilities are generated by our theme colors, reassigned from our generic color palette variables.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $blue:    #0d6efd;
    -$indigo:  #6610f2;
    -$purple:  #6f42c1;
    -$pink:    #d63384;
    -$red:     #dc3545;
    -$orange:  #fd7e14;
    -$yellow:  #ffc107;
    -$green:   #198754;
    -$teal:    #20c997;
    -$cyan:    #0dcaf0;
    -
    -
    -
    - scss/_variables.scss -
    - -
    -
    $primary:       $blue;
    -$secondary:     $gray-600;
    -$success:       $green;
    -$info:          $cyan;
    -$warning:       $yellow;
    -$danger:        $red;
    -$light:         $gray-100;
    -$dark:          $gray-900;
    -
    -
    -
    - scss/_variables.scss -
    - -
    -
    $gradient: linear-gradient(180deg, rgba($white, .15), rgba($white, 0));
    -
    +
    $blue:    #0d6efd;
    +$indigo:  #6610f2;
    +$purple:  #6f42c1;
    +$pink:    #d63384;
    +$red:     #dc3545;
    +$orange:  #fd7e14;
    +$yellow:  #ffc107;
    +$green:   #198754;
    +$teal:    #20c997;
    +$cyan:    #0dcaf0;
    +
    +
    $primary:       $blue;
    +$secondary:     $gray-600;
    +$success:       $green;
    +$info:          $cyan;
    +$warning:       $yellow;
    +$danger:        $red;
    +$light:         $gray-100;
    +$dark:          $gray-900;
    +
    +
    $gradient: linear-gradient(180deg, rgba($white, .15), rgba($white, 0));
    +

    Grayscale colors are also available, but only a subset are used to generate any utilities.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $white:    #fff;
    -$gray-100: #f8f9fa;
    -$gray-200: #e9ecef;
    -$gray-300: #dee2e6;
    -$gray-400: #ced4da;
    -$gray-500: #adb5bd;
    -$gray-600: #6c757d;
    -$gray-700: #495057;
    -$gray-800: #343a40;
    -$gray-900: #212529;
    -$black:    #000;
    -
    +
    $white:    #fff;
    +$gray-100: #f8f9fa;
    +$gray-200: #e9ecef;
    +$gray-300: #dee2e6;
    +$gray-400: #ced4da;
    +$gray-500: #adb5bd;
    +$gray-600: #6c757d;
    +$gray-700: #495057;
    +$gray-800: #343a40;
    +$gray-900: #212529;
    +$black:    #000;
    +

    Variables for setting background-color in .bg-*-subtle utilities in light and dark mode:

    -
    -
    - scss/_variables.scss -
    - -
    -
    $primary-bg-subtle:       tint-color($primary, 80%);
    -$secondary-bg-subtle:     tint-color($secondary, 80%);
    -$success-bg-subtle:       tint-color($success, 80%);
    -$info-bg-subtle:          tint-color($info, 80%);
    -$warning-bg-subtle:       tint-color($warning, 80%);
    -$danger-bg-subtle:        tint-color($danger, 80%);
    -$light-bg-subtle:         mix($gray-100, $white);
    -$dark-bg-subtle:          $gray-400;
    -
    -
    -
    $primary-bg-subtle-dark:            shade-color($primary, 80%);
    -$secondary-bg-subtle-dark:          shade-color($secondary, 80%);
    -$success-bg-subtle-dark:            shade-color($success, 80%);
    -$info-bg-subtle-dark:               shade-color($info, 80%);
    -$warning-bg-subtle-dark:            shade-color($warning, 80%);
    -$danger-bg-subtle-dark:             shade-color($danger, 80%);
    -$light-bg-subtle-dark:              $gray-800;
    -$dark-bg-subtle-dark:               mix($gray-800, $black);
    -
    -

    Sass maps

    +
    $primary-bg-subtle:       tint-color($primary, 80%);
    +$secondary-bg-subtle:     tint-color($secondary, 80%);
    +$success-bg-subtle:       tint-color($success, 80%);
    +$info-bg-subtle:          tint-color($info, 80%);
    +$warning-bg-subtle:       tint-color($warning, 80%);
    +$danger-bg-subtle:        tint-color($danger, 80%);
    +$light-bg-subtle:         mix($gray-100, $white);
    +$dark-bg-subtle:          $gray-400;
    +
    +
    $primary-bg-subtle-dark:            shade-color($primary, 80%);
    +$secondary-bg-subtle-dark:          shade-color($secondary, 80%);
    +$success-bg-subtle-dark:            shade-color($success, 80%);
    +$info-bg-subtle-dark:               shade-color($info, 80%);
    +$warning-bg-subtle-dark:            shade-color($warning, 80%);
    +$danger-bg-subtle-dark:             shade-color($danger, 80%);
    +$light-bg-subtle-dark:              $gray-800;
    +$dark-bg-subtle-dark:               mix($gray-800, $black);
    +
    +

    Sass maps

    Theme colors are then put into a Sass map so we can loop over them to generate our utilities, component modifiers, and more.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $theme-colors: (
    -  "primary":    $primary,
    -  "secondary":  $secondary,
    -  "success":    $success,
    -  "info":       $info,
    -  "warning":    $warning,
    -  "danger":     $danger,
    -  "light":      $light,
    -  "dark":       $dark
    -);
    -
    +
    $theme-colors: (
    +  "primary":    $primary,
    +  "secondary":  $secondary,
    +  "success":    $success,
    +  "info":       $info,
    +  "warning":    $warning,
    +  "danger":     $danger,
    +  "light":      $light,
    +  "dark":       $dark
    +);
    +

    Grayscale colors are also available as a Sass map. This map is not used to generate any utilities.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $grays: (
    -  "100": $gray-100,
    -  "200": $gray-200,
    -  "300": $gray-300,
    -  "400": $gray-400,
    -  "500": $gray-500,
    -  "600": $gray-600,
    -  "700": $gray-700,
    -  "800": $gray-800,
    -  "900": $gray-900
    -);
    -
    +
    $grays: (
    +  "100": $gray-100,
    +  "200": $gray-200,
    +  "300": $gray-300,
    +  "400": $gray-400,
    +  "500": $gray-500,
    +  "600": $gray-600,
    +  "700": $gray-700,
    +  "800": $gray-800,
    +  "900": $gray-900
    +);
    +

    RGB colors are generated from a separate Sass map:

    -
    -
    - scss/_maps.scss -
    - -
    -
    $theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value");
    -
    -

    Background color opacities build on that with their own map that’s consumed by the utilities API:

    -
    -
    - scss/_maps.scss -
    - -
    -
    $utilities-bg: map-merge(
    -  $utilities-colors,
    -  (
    -    "black": to-rgb($black),
    -    "white": to-rgb($white),
    -    "body": to-rgb($body-bg)
    -  )
    -);
    -$utilities-bg-colors: map-loop($utilities-bg, rgba-css-var, "$key", "bg");
    -
    -$utilities-bg-subtle: (
    -  "primary-subtle": var(--#{$prefix}primary-bg-subtle),
    -  "secondary-subtle": var(--#{$prefix}secondary-bg-subtle),
    -  "success-subtle": var(--#{$prefix}success-bg-subtle),
    -  "info-subtle": var(--#{$prefix}info-bg-subtle),
    -  "warning-subtle": var(--#{$prefix}warning-bg-subtle),
    -  "danger-subtle": var(--#{$prefix}danger-bg-subtle),
    -  "light-subtle": var(--#{$prefix}light-bg-subtle),
    -  "dark-subtle": var(--#{$prefix}dark-bg-subtle)
    -);
    -
    +
    $theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value");
    +
    +

    Background color opacities build on that with their own map that’s consumed by the utilities API:

    +
    $utilities-bg: map-merge(
    +  $utilities-colors,
    +  (
    +    "black": to-rgb($black),
    +    "white": to-rgb($white),
    +    "body": to-rgb($body-bg)
    +  )
    +);
    +$utilities-bg-colors: map-loop($utilities-bg, rgba-css-var, "$key", "bg");
    +
    +$utilities-bg-subtle: (
    +  "primary-subtle": var(--#{$prefix}primary-bg-subtle),
    +  "secondary-subtle": var(--#{$prefix}secondary-bg-subtle),
    +  "success-subtle": var(--#{$prefix}success-bg-subtle),
    +  "info-subtle": var(--#{$prefix}info-bg-subtle),
    +  "warning-subtle": var(--#{$prefix}warning-bg-subtle),
    +  "danger-subtle": var(--#{$prefix}danger-bg-subtle),
    +  "light-subtle": var(--#{$prefix}light-bg-subtle),
    +  "dark-subtle": var(--#{$prefix}dark-bg-subtle)
    +);
    +

    Color mode background colors are also available as a Sass map:

    -
    -
    - scss/_maps.scss -
    - -
    -
    $theme-colors-bg-subtle: (
    -  "primary": $primary-bg-subtle,
    -  "secondary": $secondary-bg-subtle,
    -  "success": $success-bg-subtle,
    -  "info": $info-bg-subtle,
    -  "warning": $warning-bg-subtle,
    -  "danger": $danger-bg-subtle,
    -  "light": $light-bg-subtle,
    -  "dark": $dark-bg-subtle,
    -);
    -
    -
    -
    - scss/_maps.scss -
    - -
    -
    $theme-colors-bg-subtle-dark: (
    -  "primary": $primary-bg-subtle-dark,
    -  "secondary": $secondary-bg-subtle-dark,
    -  "success": $success-bg-subtle-dark,
    -  "info": $info-bg-subtle-dark,
    -  "warning": $warning-bg-subtle-dark,
    -  "danger": $danger-bg-subtle-dark,
    -  "light": $light-bg-subtle-dark,
    -  "dark": $dark-bg-subtle-dark,
    -);
    -

    Sass mixins

    -

    No mixins are used to generate our background utilities, but we do have some additional mixins for other situations where you’d like to create your own gradients.

    -
    -
    @mixin gradient-bg($color: null) {
    -  background-color: $color;
    -
    -  @if $enable-gradients {
    -    background-image: var(--#{$prefix}gradient);
    -  }
    -}
    -
    -
    -
    // Horizontal gradient, from left to right
    -//
    -// Creates two color stops, start and end, by specifying a color and position for each color stop.
    -@mixin gradient-x($start-color: $gray-700, $end-color: $gray-800, $start-percent: 0%, $end-percent: 100%) {
    -  background-image: linear-gradient(to right, $start-color $start-percent, $end-color $end-percent);
    -}
    -
    -// Vertical gradient, from top to bottom
    -//
    -// Creates two color stops, start and end, by specifying a color and position for each color stop.
    -@mixin gradient-y($start-color: $gray-700, $end-color: $gray-800, $start-percent: null, $end-percent: null) {
    -  background-image: linear-gradient(to bottom, $start-color $start-percent, $end-color $end-percent);
    -}
    -
    -@mixin gradient-directional($start-color: $gray-700, $end-color: $gray-800, $deg: 45deg) {
    -  background-image: linear-gradient($deg, $start-color, $end-color);
    -}
    -
    -@mixin gradient-x-three-colors($start-color: $blue, $mid-color: $purple, $color-stop: 50%, $end-color: $red) {
    -  background-image: linear-gradient(to right, $start-color, $mid-color $color-stop, $end-color);
    -}
    -
    -@mixin gradient-y-three-colors($start-color: $blue, $mid-color: $purple, $color-stop: 50%, $end-color: $red) {
    -  background-image: linear-gradient($start-color, $mid-color $color-stop, $end-color);
    -}
    -
    -@mixin gradient-radial($inner-color: $gray-700, $outer-color: $gray-800) {
    -  background-image: radial-gradient(circle, $inner-color, $outer-color);
    -}
    -
    -@mixin gradient-striped($color: rgba($white, .15), $angle: 45deg) {
    -  background-image: linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
    -}
    -
    -

    Sass utilities API

    -

    Background utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "background-color": (
    -  property: background-color,
    -  class: bg,
    -  local-vars: (
    -    "bg-opacity": 1
    -  ),
    -  values: map-merge(
    -    $utilities-bg-colors,
    -    (
    -      "transparent": transparent,
    -      "body-secondary": rgba(var(--#{$prefix}secondary-bg-rgb), var(--#{$prefix}bg-opacity)),
    -      "body-tertiary": rgba(var(--#{$prefix}tertiary-bg-rgb), var(--#{$prefix}bg-opacity)),
    -    )
    -  )
    -),
    -"bg-opacity": (
    -  css-var: true,
    -  class: bg-opacity,
    -  values: (
    -    10: .1,
    -    25: .25,
    -    50: .5,
    -    75: .75,
    -    100: 1
    -  )
    -),
    -"subtle-background-color": (
    -  property: background-color,
    -  class: bg,
    -  values: $utilities-bg-subtle
    -),
    +
    $theme-colors-bg-subtle: (
    +  "primary": $primary-bg-subtle,
    +  "secondary": $secondary-bg-subtle,
    +  "success": $success-bg-subtle,
    +  "info": $info-bg-subtle,
    +  "warning": $warning-bg-subtle,
    +  "danger": $danger-bg-subtle,
    +  "light": $light-bg-subtle,
    +  "dark": $dark-bg-subtle,
    +);
    +
    +
    $theme-colors-bg-subtle-dark: (
    +  "primary": $primary-bg-subtle-dark,
    +  "secondary": $secondary-bg-subtle-dark,
    +  "success": $success-bg-subtle-dark,
    +  "info": $info-bg-subtle-dark,
    +  "warning": $warning-bg-subtle-dark,
    +  "danger": $danger-bg-subtle-dark,
    +  "light": $light-bg-subtle-dark,
    +  "dark": $dark-bg-subtle-dark,
    +);
    +
    +

    Sass mixins

    +

    No mixins are used to generate our background utilities, but we do have some additional mixins for other situations where you’d like to create your own gradients.

    +
    @mixin gradient-bg($color: null) {
    +  background-color: $color;
     
    -      
    -
    -
    + @if $enable-gradients { + background-image: var(--#{$prefix}gradient); + } +} + +
    // Horizontal gradient, from left to right
    +//
    +// Creates two color stops, start and end, by specifying a color and position for each color stop.
    +@mixin gradient-x($start-color: $gray-700, $end-color: $gray-800, $start-percent: 0%, $end-percent: 100%) {
    +  background-image: linear-gradient(to right, $start-color $start-percent, $end-color $end-percent);
    +}
     
    +// Vertical gradient, from top to bottom
    +//
    +// Creates two color stops, start and end, by specifying a color and position for each color stop.
    +@mixin gradient-y($start-color: $gray-700, $end-color: $gray-800, $start-percent: null, $end-percent: null) {
    +  background-image: linear-gradient(to bottom, $start-color $start-percent, $end-color $end-percent);
    +}
     
    -    
    +@mixin gradient-directional($start-color: $gray-700, $end-color: $gray-800, $deg: 45deg) {
    +  background-image: linear-gradient($deg, $start-color, $end-color);
    +}
     
    -    
    +@mixin gradient-x-three-colors($start-color: $blue, $mid-color: $purple, $color-stop: 50%, $end-color: $red) {
    +  background-image: linear-gradient(to right, $start-color, $mid-color $color-stop, $end-color);
    +}
     
    -
    -
    -
    +@mixin gradient-y-three-colors($start-color: $blue, $mid-color: $purple, $color-stop: 50%, $end-color: $red) {
    +  background-image: linear-gradient($start-color, $mid-color $color-stop, $end-color);
    +}
     
    -    
    -  
    +@mixin gradient-radial($inner-color: $gray-700, $outer-color: $gray-800) {
    +  background-image: radial-gradient(circle, $inner-color, $outer-color);
    +}
     
    -  
    -
    +@mixin gradient-striped($color: rgba($white, .15), $angle: 45deg) {
    +  background-image: linear-gradient($angle, $color 25%, transparent 25%, transparent 50%, $color 50%, $color 75%, transparent 75%, transparent);
    +}
    +
    +

    Sass utilities API

    +

    Background utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "background-color": (
    +  property: background-color,
    +  class: bg,
    +  local-vars: (
    +    "bg-opacity": 1
    +  ),
    +  values: map-merge(
    +    $utilities-bg-colors,
    +    (
    +      "transparent": transparent,
    +      "body-secondary": rgba(var(--#{$prefix}secondary-bg-rgb), var(--#{$prefix}bg-opacity)),
    +      "body-tertiary": rgba(var(--#{$prefix}tertiary-bg-rgb), var(--#{$prefix}bg-opacity)),
    +    )
    +  )
    +),
    +"bg-opacity": (
    +  css-var: true,
    +  class: bg-opacity,
    +  values: (
    +    10: .1,
    +    25: .25,
    +    50: .5,
    +    75: .75,
    +    100: 1
    +  )
    +),
    +"subtle-background-color": (
    +  property: background-color,
    +  class: bg,
    +  values: $utilities-bg-subtle
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/borders/index.html b/docs/5.3/utilities/borders/index.html index a482507268..16f6d99fc3 100644 --- a/docs/5.3/utilities/borders/index.html +++ b/docs/5.3/utilities/borders/index.html @@ -1,655 +1,54 @@ - - - - - - - - - - - - - - - - -Borders · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Borders

    -
    -

    Use border utilities to quickly style the border and border-radius of an element. Great for images, buttons, or any other element.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Border

    -

    Use border utilities to add or remove an element’s borders. Choose from all borders or one at a time.

    -

    Additive

    + Borders · Bootstrap v5.3

    Use border utilities to quickly style the border and border-radius of an element. Great for images, buttons, or any other element.

    +

    Border

    +

    Use border utilities to add or remove an element’s borders. Choose from all borders or one at a time.

    +

    Additive

    Add borders to custom elements:

    -
    -
    - - +
    - - -
    - html -
    - - -
    -
    <span class="border"></span>
    -<span class="border-top"></span>
    -<span class="border-end"></span>
    -<span class="border-bottom"></span>
    -<span class="border-start"></span>
    -
    - -

    Subtractive

    +
    html
    <span class="border"></span>
    +<span class="border-top"></span>
    +<span class="border-end"></span>
    +<span class="border-bottom"></span>
    +<span class="border-start"></span>
    +

    Subtractive

    Or remove borders:

    -
    -
    - - +
    - - -
    - html -
    - - -
    -
    <span class="border border-0"></span>
    -<span class="border border-top-0"></span>
    -<span class="border border-end-0"></span>
    -<span class="border border-bottom-0"></span>
    -<span class="border border-start-0"></span>
    -
    - -

    Color

    -
    -Border utilities like .border-* that generated from our original $theme-colors Sass map don’t yet respond to color modes, however, any .border-*-subtle utility will. This will be resolved in v6. -
    - +
    html
    <span class="border border-0"></span>
    +<span class="border border-top-0"></span>
    +<span class="border border-end-0"></span>
    +<span class="border border-bottom-0"></span>
    +<span class="border border-start-0"></span>
    +

    Color

    +

    Border utilities like .border-* that generated from our original $theme-colors Sass map don’t yet respond to color modes, however, any .border-*-subtle utility will. This will be resolved in v6.

    Change the border color using utilities built on our theme colors.

    -
    -
    - - - +
    @@ -666,43 +65,26 @@ Border utilities like .border-* that generated from our original - - -
    - html -
    - - -
    -
    <span class="border border-primary"></span>
    -<span class="border border-primary-subtle"></span>
    -<span class="border border-secondary"></span>
    -<span class="border border-secondary-subtle"></span>
    -<span class="border border-success"></span>
    -<span class="border border-success-subtle"></span>
    -<span class="border border-danger"></span>
    -<span class="border border-danger-subtle"></span>
    -<span class="border border-warning"></span>
    -<span class="border border-warning-subtle"></span>
    -<span class="border border-info"></span>
    -<span class="border border-info-subtle"></span>
    -<span class="border border-light"></span>
    -<span class="border border-light-subtle"></span>
    -<span class="border border-dark"></span>
    -<span class="border border-dark-subtle"></span>
    -<span class="border border-black"></span>
    -<span class="border border-white"></span>
    -
    - +
    html
    <span class="border border-primary"></span>
    +<span class="border border-primary-subtle"></span>
    +<span class="border border-secondary"></span>
    +<span class="border border-secondary-subtle"></span>
    +<span class="border border-success"></span>
    +<span class="border border-success-subtle"></span>
    +<span class="border border-danger"></span>
    +<span class="border border-danger-subtle"></span>
    +<span class="border border-warning"></span>
    +<span class="border border-warning-subtle"></span>
    +<span class="border border-info"></span>
    +<span class="border border-info-subtle"></span>
    +<span class="border border-light"></span>
    +<span class="border border-light-subtle"></span>
    +<span class="border border-dark"></span>
    +<span class="border border-dark-subtle"></span>
    +<span class="border border-black"></span>
    +<span class="border border-white"></span>

    Or modify the default border-color of a component:

    -
    -
    - -
    +
    @@ -713,644 +95,378 @@ Border utilities like .border-* that generated from our original Changing border color and width -
    +
    html
    <div class="mb-4">
    +  <label for="exampleFormControlInput1" class="form-label">Email address</label>
    +  <input type="email" class="form-control border-success" id="exampleFormControlInput1" placeholder="name@example.com">
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="mb-4">
    -  <label for="exampleFormControlInput1" class="form-label">Email address</label>
    -  <input type="email" class="form-control border-success" id="exampleFormControlInput1" placeholder="name@example.com">
    -</div>
    -
    -<div class="h4 pb-2 mb-4 text-danger border-bottom border-danger">
    -  Dangerous heading
    -</div>
    -
    -<div class="p-3 bg-info bg-opacity-10 border border-info border-start-0 rounded-end">
    -  Changing border color and width
    -</div>
    -
    +<div class="h4 pb-2 mb-4 text-danger border-bottom border-danger"> + Dangerous heading +</div> -

    Opacity

    +<div class="p-3 bg-info bg-opacity-10 border border-info border-start-0 rounded-end"> + Changing border color and width +</div>
    +

    Opacity

    Added in v5.2.0 -

    Bootstrap border-{color} utilities are generated with Sass using CSS variables. This allows for real-time color changes without compilation and dynamic alpha transparency changes.

    -

    How it works

    +

    How it works

    Consider our default .border-success utility.

    -
    .border-success {
    -  --bs-border-opacity: 1;
    -  border-color: rgba(var(--bs-success-rgb), var(--bs-border-opacity)) !important;
    -}
    -

    We use an RGB version of our --bs-success (with the value of 25, 135, 84) CSS variable and attached a second CSS variable, --bs-border-opacity, for the alpha transparency (with a default value 1 thanks to a local CSS variable). That means anytime you use .border-success now, your computed color value is rgba(25, 135, 84, 1). The local CSS variable inside each .border-* class avoids inheritance issues so nested instances of the utilities don’t automatically have a modified alpha transparency.

    -

    Example

    +
    .border-success {
    +  --bs-border-opacity: 1;
    +  border-color: rgba(var(--bs-success-rgb), var(--bs-border-opacity)) !important;
    +}
    +
    +

    We use an RGB version of our --bs-success (with the value of 25, 135, 84) CSS variable and attached a second CSS variable, --bs-border-opacity, for the alpha transparency (with a default value 1 thanks to a local CSS variable). That means anytime you use .border-success now, your computed color value is rgba(25, 135, 84, 1). The local CSS variable inside each .border-* class avoids inheritance issues so nested instances of the utilities don’t automatically have a modified alpha transparency.

    +

    Example

    To change that opacity, override --bs-border-opacity via custom styles or inline styles.

    -
    -
    - -
    This is default success border
    -
    This is 50% opacity success border
    - -
    - html -
    - - -
    -
    <div class="border border-success p-2 mb-2">This is default success border</div>
    -<div class="border border-success p-2" style="--bs-border-opacity: .5;">This is 50% opacity success border</div>
    -
    - +
    This is default success border
    +
    This is 50% opacity success border
    html
    <div class="border border-success p-2 mb-2">This is default success border</div>
    +<div class="border border-success p-2" style="--bs-border-opacity: .5;">This is 50% opacity success border</div>

    Or, choose from any of the .border-opacity utilities:

    -
    -
    - -
    This is default success border
    +
    This is default success border
    This is 75% opacity success border
    This is 50% opacity success border
    This is 25% opacity success border
    -
    This is 10% opacity success border
    - -
    - html -
    - - -
    -
    <div class="border border-success p-2 mb-2">This is default success border</div>
    -<div class="border border-success p-2 mb-2 border-opacity-75">This is 75% opacity success border</div>
    -<div class="border border-success p-2 mb-2 border-opacity-50">This is 50% opacity success border</div>
    -<div class="border border-success p-2 mb-2 border-opacity-25">This is 25% opacity success border</div>
    -<div class="border border-success p-2 border-opacity-10">This is 10% opacity success border</div>
    -
    - -

    Width

    -
    -
    - - +
    This is 10% opacity success border
    html
    <div class="border border-success p-2 mb-2">This is default success border</div>
    +<div class="border border-success p-2 mb-2 border-opacity-75">This is 75% opacity success border</div>
    +<div class="border border-success p-2 mb-2 border-opacity-50">This is 50% opacity success border</div>
    +<div class="border border-success p-2 mb-2 border-opacity-25">This is 25% opacity success border</div>
    +<div class="border border-success p-2 border-opacity-10">This is 10% opacity success border</div>
    +

    Width

    +
    - - -
    - html -
    - - -
    -
    <span class="border border-1"></span>
    -<span class="border border-2"></span>
    -<span class="border border-3"></span>
    -<span class="border border-4"></span>
    -<span class="border border-5"></span>
    -
    - -

    Radius

    +
    html
    <span class="border border-1"></span>
    +<span class="border border-2"></span>
    +<span class="border border-3"></span>
    +<span class="border border-4"></span>
    +<span class="border border-5"></span>
    +

    Radius

    Add classes to an element to easily round its corners.

    -
    -
    - -Example rounded image75x75 -Example top rounded image75x75 -Example right rounded image75x75 -Example bottom rounded image75x75 -Example left rounded image75x75 - -
    - html -
    - - -
    -
    <img src="..." class="rounded" alt="...">
    -<img src="..." class="rounded-top" alt="...">
    -<img src="..." class="rounded-end" alt="...">
    -<img src="..." class="rounded-bottom" alt="...">
    -<img src="..." class="rounded-start" alt="...">
    -
    - -

    Sizes

    +
    Example rounded image75x75 +Example top rounded image75x75 +Example right rounded image75x75 +Example bottom rounded image75x75 +Example left rounded image75x75
    html
    <img src="..." class="rounded" alt="...">
    +<img src="..." class="rounded-top" alt="...">
    +<img src="..." class="rounded-end" alt="...">
    +<img src="..." class="rounded-bottom" alt="...">
    +<img src="..." class="rounded-start" alt="...">
    +

    Sizes

    Use the scaling classes for larger or smaller rounded corners. Sizes range from 0 to 5 including circle and pill, and can be configured by modifying the utilities API.

    -
    -
    - -Example non-rounded image75x75 -Example small rounded image75x75 -Example default rounded image75x75 -Example large rounded image75x75 -Example larger rounded image75x75 -Example extra large rounded image75x75 -Completely round image75x75 -Rounded pill image150x75 - -
    - html -
    - - -
    -
    <img src="..." class="rounded-0" alt="...">
    -<img src="..." class="rounded-1" alt="...">
    -<img src="..." class="rounded-2" alt="...">
    -<img src="..." class="rounded-3" alt="...">
    -<img src="..." class="rounded-4" alt="...">
    -<img src="..." class="rounded-5" alt="...">
    -<img src="..." class="rounded-circle" alt="...">
    -<img src="..." class="rounded-pill" alt="...">
    -
    - -
    -
    - -Example small rounded image75x75 -Example default left rounded image75x75 -Example right completely round image75x75 -Example left rounded pill image75x75 -Example extra large bottom rounded image75x75 - -
    - html -
    - - -
    -
    <img src="..." class="rounded-bottom-1" alt="...">
    -<img src="..." class="rounded-start-2" alt="...">
    -<img src="..." class="rounded-end-circle" alt="...">
    -<img src="..." class="rounded-start-pill" alt="...">
    -<img src="..." class="rounded-5 rounded-top-0" alt="...">
    -
    - -

    CSS

    -

    Variables

    +
    Example non-rounded image75x75 +Example small rounded image75x75 +Example default rounded image75x75 +Example large rounded image75x75 +Example larger rounded image75x75 +Example extra large rounded image75x75 +Completely round image75x75 +Rounded pill image150x75
    html
    <img src="..." class="rounded-0" alt="...">
    +<img src="..." class="rounded-1" alt="...">
    +<img src="..." class="rounded-2" alt="...">
    +<img src="..." class="rounded-3" alt="...">
    +<img src="..." class="rounded-4" alt="...">
    +<img src="..." class="rounded-5" alt="...">
    +<img src="..." class="rounded-circle" alt="...">
    +<img src="..." class="rounded-pill" alt="...">
    +
    Example small rounded image75x75 +Example default left rounded image75x75 +Example right completely round image75x75 +Example left rounded pill image75x75 +Example extra large bottom rounded image75x75
    html
    <img src="..." class="rounded-bottom-1" alt="...">
    +<img src="..." class="rounded-start-2" alt="...">
    +<img src="..." class="rounded-end-circle" alt="...">
    +<img src="..." class="rounded-start-pill" alt="...">
    +<img src="..." class="rounded-5 rounded-top-0" alt="...">
    +

    CSS

    +

    Variables

    Added in v5.2.0 +
    --#{$prefix}border-width: #{$border-width};
    +--#{$prefix}border-style: #{$border-style};
    +--#{$prefix}border-color: #{$border-color};
    +--#{$prefix}border-color-translucent: #{$border-color-translucent};
     
    -
    -
    - scss/_root.scss -
    - -
    -
    --#{$prefix}border-width: #{$border-width};
    ---#{$prefix}border-style: #{$border-style};
    ---#{$prefix}border-color: #{$border-color};
    ---#{$prefix}border-color-translucent: #{$border-color-translucent};
    -
    ---#{$prefix}border-radius: #{$border-radius};
    ---#{$prefix}border-radius-sm: #{$border-radius-sm};
    ---#{$prefix}border-radius-lg: #{$border-radius-lg};
    ---#{$prefix}border-radius-xl: #{$border-radius-xl};
    ---#{$prefix}border-radius-xxl: #{$border-radius-xxl};
    ---#{$prefix}border-radius-2xl: var(--#{$prefix}border-radius-xxl); // Deprecated in v5.3.0 for consistency
    ---#{$prefix}border-radius-pill: #{$border-radius-pill};
    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $border-width:                1px;
    -$border-widths: (
    -  1: 1px,
    -  2: 2px,
    -  3: 3px,
    -  4: 4px,
    -  5: 5px
    -);
    -$border-style:                solid;
    -$border-color:                $gray-300;
    -$border-color-translucent:    rgba($black, .175);
    -
    -
    -
    - scss/_variables.scss -
    - -
    -
    $border-radius:               .375rem;
    -$border-radius-sm:            .25rem;
    -$border-radius-lg:            .5rem;
    -$border-radius-xl:            1rem;
    -$border-radius-xxl:           2rem;
    -$border-radius-pill:          50rem;
    -
    +--#{$prefix}border-radius: #{$border-radius}; +--#{$prefix}border-radius-sm: #{$border-radius-sm}; +--#{$prefix}border-radius-lg: #{$border-radius-lg}; +--#{$prefix}border-radius-xl: #{$border-radius-xl}; +--#{$prefix}border-radius-xxl: #{$border-radius-xxl}; +--#{$prefix}border-radius-2xl: var(--#{$prefix}border-radius-xxl); // Deprecated in v5.3.0 for consistency +--#{$prefix}border-radius-pill: #{$border-radius-pill}; +
    +

    Sass variables

    +
    $border-width:                1px;
    +$border-widths: (
    +  1: 1px,
    +  2: 2px,
    +  3: 3px,
    +  4: 4px,
    +  5: 5px
    +);
    +$border-style:                solid;
    +$border-color:                $gray-300;
    +$border-color-translucent:    rgba($black, .175);
    +
    +
    $border-radius:               .375rem;
    +$border-radius-sm:            .25rem;
    +$border-radius-lg:            .5rem;
    +$border-radius-xl:            1rem;
    +$border-radius-xxl:           2rem;
    +$border-radius-pill:          50rem;
    +

    Variables for setting border-color in .border-*-subtle utilities in light and dark mode:

    -
    -
    - scss/_variables.scss -
    - -
    -
    $primary-border-subtle:   tint-color($primary, 60%);
    -$secondary-border-subtle: tint-color($secondary, 60%);
    -$success-border-subtle:   tint-color($success, 60%);
    -$info-border-subtle:      tint-color($info, 60%);
    -$warning-border-subtle:   tint-color($warning, 60%);
    -$danger-border-subtle:    tint-color($danger, 60%);
    -$light-border-subtle:     $gray-200;
    -$dark-border-subtle:      $gray-500;
    -
    -
    -
    $primary-border-subtle-dark:        shade-color($primary, 40%);
    -$secondary-border-subtle-dark:      shade-color($secondary, 40%);
    -$success-border-subtle-dark:        shade-color($success, 40%);
    -$info-border-subtle-dark:           shade-color($info, 40%);
    -$warning-border-subtle-dark:        shade-color($warning, 40%);
    -$danger-border-subtle-dark:         shade-color($danger, 40%);
    -$light-border-subtle-dark:          $gray-700;
    -$dark-border-subtle-dark:           $gray-800;
    -
    -

    Sass maps

    +
    $primary-border-subtle:   tint-color($primary, 60%);
    +$secondary-border-subtle: tint-color($secondary, 60%);
    +$success-border-subtle:   tint-color($success, 60%);
    +$info-border-subtle:      tint-color($info, 60%);
    +$warning-border-subtle:   tint-color($warning, 60%);
    +$danger-border-subtle:    tint-color($danger, 60%);
    +$light-border-subtle:     $gray-200;
    +$dark-border-subtle:      $gray-500;
    +
    +
    $primary-border-subtle-dark:        shade-color($primary, 40%);
    +$secondary-border-subtle-dark:      shade-color($secondary, 40%);
    +$success-border-subtle-dark:        shade-color($success, 40%);
    +$info-border-subtle-dark:           shade-color($info, 40%);
    +$warning-border-subtle-dark:        shade-color($warning, 40%);
    +$danger-border-subtle-dark:         shade-color($danger, 40%);
    +$light-border-subtle-dark:          $gray-700;
    +$dark-border-subtle-dark:           $gray-800;
    +
    +

    Sass maps

    Color mode adaptive border colors are also available as a Sass map:

    -
    -
    - scss/_maps.scss -
    - -
    -
    $theme-colors-border-subtle: (
    -  "primary": $primary-border-subtle,
    -  "secondary": $secondary-border-subtle,
    -  "success": $success-border-subtle,
    -  "info": $info-border-subtle,
    -  "warning": $warning-border-subtle,
    -  "danger": $danger-border-subtle,
    -  "light": $light-border-subtle,
    -  "dark": $dark-border-subtle,
    -);
    -
    -
    -
    - scss/_maps.scss -
    - -
    -
    $theme-colors-border-subtle-dark: (
    -  "primary": $primary-border-subtle-dark,
    -  "secondary": $secondary-border-subtle-dark,
    -  "success": $success-border-subtle-dark,
    -  "info": $info-border-subtle-dark,
    -  "warning": $warning-border-subtle-dark,
    -  "danger": $danger-border-subtle-dark,
    -  "light": $light-border-subtle-dark,
    -  "dark": $dark-border-subtle-dark,
    -);
    -

    Sass mixins

    -
    -
    @mixin border-radius($radius: $border-radius, $fallback-border-radius: false) {
    -  @if $enable-rounded {
    -    border-radius: valid-radius($radius);
    -  }
    -  @else if $fallback-border-radius != false {
    -    border-radius: $fallback-border-radius;
    -  }
    -}
    -
    -@mixin border-top-radius($radius: $border-radius) {
    -  @if $enable-rounded {
    -    border-top-left-radius: valid-radius($radius);
    -    border-top-right-radius: valid-radius($radius);
    -  }
    -}
    -
    -@mixin border-end-radius($radius: $border-radius) {
    -  @if $enable-rounded {
    -    border-top-right-radius: valid-radius($radius);
    -    border-bottom-right-radius: valid-radius($radius);
    -  }
    -}
    -
    -@mixin border-bottom-radius($radius: $border-radius) {
    -  @if $enable-rounded {
    -    border-bottom-right-radius: valid-radius($radius);
    -    border-bottom-left-radius: valid-radius($radius);
    -  }
    -}
    -
    -@mixin border-start-radius($radius: $border-radius) {
    -  @if $enable-rounded {
    -    border-top-left-radius: valid-radius($radius);
    -    border-bottom-left-radius: valid-radius($radius);
    -  }
    -}
    -
    -@mixin border-top-start-radius($radius: $border-radius) {
    -  @if $enable-rounded {
    -    border-top-left-radius: valid-radius($radius);
    -  }
    -}
    -
    -@mixin border-top-end-radius($radius: $border-radius) {
    -  @if $enable-rounded {
    -    border-top-right-radius: valid-radius($radius);
    -  }
    -}
    -
    -@mixin border-bottom-end-radius($radius: $border-radius) {
    -  @if $enable-rounded {
    -    border-bottom-right-radius: valid-radius($radius);
    -  }
    -}
    -
    -@mixin border-bottom-start-radius($radius: $border-radius) {
    -  @if $enable-rounded {
    -    border-bottom-left-radius: valid-radius($radius);
    -  }
    -}
    -
    -

    Sass utilities API

    -

    Border utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "border": (
    -  property: border,
    -  values: (
    -    null: var(--#{$prefix}border-width) var(--#{$prefix}border-style) var(--#{$prefix}border-color),
    -    0: 0,
    -  )
    -),
    -"border-top": (
    -  property: border-top,
    -  values: (
    -    null: var(--#{$prefix}border-width) var(--#{$prefix}border-style) var(--#{$prefix}border-color),
    -    0: 0,
    -  )
    -),
    -"border-end": (
    -  property: border-right,
    -  class: border-end,
    -  values: (
    -    null: var(--#{$prefix}border-width) var(--#{$prefix}border-style) var(--#{$prefix}border-color),
    -    0: 0,
    -  )
    -),
    -"border-bottom": (
    -  property: border-bottom,
    -  values: (
    -    null: var(--#{$prefix}border-width) var(--#{$prefix}border-style) var(--#{$prefix}border-color),
    -    0: 0,
    -  )
    -),
    -"border-start": (
    -  property: border-left,
    -  class: border-start,
    -  values: (
    -    null: var(--#{$prefix}border-width) var(--#{$prefix}border-style) var(--#{$prefix}border-color),
    -    0: 0,
    -  )
    -),
    -"border-color": (
    -  property: border-color,
    -  class: border,
    -  local-vars: (
    -    "border-opacity": 1
    -  ),
    -  values: $utilities-border-colors
    -),
    -"subtle-border-color": (
    -  property: border-color,
    -  class: border,
    -  values: $utilities-border-subtle
    -),
    -"border-width": (
    -  property: border-width,
    -  class: border,
    -  values: $border-widths
    -),
    -"border-opacity": (
    -  css-var: true,
    -  class: border-opacity,
    -  values: (
    -    10: .1,
    -    25: .25,
    -    50: .5,
    -    75: .75,
    -    100: 1
    -  )
    -),
    -
    -
    - scss/_utilities.scss -
    - -
    -
    "rounded": (
    -  property: border-radius,
    -  class: rounded,
    -  values: (
    -    null: var(--#{$prefix}border-radius),
    -    0: 0,
    -    1: var(--#{$prefix}border-radius-sm),
    -    2: var(--#{$prefix}border-radius),
    -    3: var(--#{$prefix}border-radius-lg),
    -    4: var(--#{$prefix}border-radius-xl),
    -    5: var(--#{$prefix}border-radius-xxl),
    -    circle: 50%,
    -    pill: var(--#{$prefix}border-radius-pill)
    -  )
    -),
    -"rounded-top": (
    -  property: border-top-left-radius border-top-right-radius,
    -  class: rounded-top,
    -  values: (
    -    null: var(--#{$prefix}border-radius),
    -    0: 0,
    -    1: var(--#{$prefix}border-radius-sm),
    -    2: var(--#{$prefix}border-radius),
    -    3: var(--#{$prefix}border-radius-lg),
    -    4: var(--#{$prefix}border-radius-xl),
    -    5: var(--#{$prefix}border-radius-xxl),
    -    circle: 50%,
    -    pill: var(--#{$prefix}border-radius-pill)
    -  )
    -),
    -"rounded-end": (
    -  property: border-top-right-radius border-bottom-right-radius,
    -  class: rounded-end,
    -  values: (
    -    null: var(--#{$prefix}border-radius),
    -    0: 0,
    -    1: var(--#{$prefix}border-radius-sm),
    -    2: var(--#{$prefix}border-radius),
    -    3: var(--#{$prefix}border-radius-lg),
    -    4: var(--#{$prefix}border-radius-xl),
    -    5: var(--#{$prefix}border-radius-xxl),
    -    circle: 50%,
    -    pill: var(--#{$prefix}border-radius-pill)
    -  )
    -),
    -"rounded-bottom": (
    -  property: border-bottom-right-radius border-bottom-left-radius,
    -  class: rounded-bottom,
    -  values: (
    -    null: var(--#{$prefix}border-radius),
    -    0: 0,
    -    1: var(--#{$prefix}border-radius-sm),
    -    2: var(--#{$prefix}border-radius),
    -    3: var(--#{$prefix}border-radius-lg),
    -    4: var(--#{$prefix}border-radius-xl),
    -    5: var(--#{$prefix}border-radius-xxl),
    -    circle: 50%,
    -    pill: var(--#{$prefix}border-radius-pill)
    -  )
    -),
    -"rounded-start": (
    -  property: border-bottom-left-radius border-top-left-radius,
    -  class: rounded-start,
    -  values: (
    -    null: var(--#{$prefix}border-radius),
    -    0: 0,
    -    1: var(--#{$prefix}border-radius-sm),
    -    2: var(--#{$prefix}border-radius),
    -    3: var(--#{$prefix}border-radius-lg),
    -    4: var(--#{$prefix}border-radius-xl),
    -    5: var(--#{$prefix}border-radius-xxl),
    -    circle: 50%,
    -    pill: var(--#{$prefix}border-radius-pill)
    -  )
    -),
    +
    $theme-colors-border-subtle: (
    +  "primary": $primary-border-subtle,
    +  "secondary": $secondary-border-subtle,
    +  "success": $success-border-subtle,
    +  "info": $info-border-subtle,
    +  "warning": $warning-border-subtle,
    +  "danger": $danger-border-subtle,
    +  "light": $light-border-subtle,
    +  "dark": $dark-border-subtle,
    +);
    +
    +
    $theme-colors-border-subtle-dark: (
    +  "primary": $primary-border-subtle-dark,
    +  "secondary": $secondary-border-subtle-dark,
    +  "success": $success-border-subtle-dark,
    +  "info": $info-border-subtle-dark,
    +  "warning": $warning-border-subtle-dark,
    +  "danger": $danger-border-subtle-dark,
    +  "light": $light-border-subtle-dark,
    +  "dark": $dark-border-subtle-dark,
    +);
    +
    +

    Sass mixins

    +
    @mixin border-radius($radius: $border-radius, $fallback-border-radius: false) {
    +  @if $enable-rounded {
    +    border-radius: valid-radius($radius);
    +  }
    +  @else if $fallback-border-radius != false {
    +    border-radius: $fallback-border-radius;
    +  }
    +}
     
    -      
    -
    -
    +@mixin border-top-radius($radius: $border-radius) { + @if $enable-rounded { + border-top-left-radius: valid-radius($radius); + border-top-right-radius: valid-radius($radius); + } +} +@mixin border-end-radius($radius: $border-radius) { + @if $enable-rounded { + border-top-right-radius: valid-radius($radius); + border-bottom-right-radius: valid-radius($radius); + } +} - +@mixin border-bottom-radius($radius: $border-radius) { + @if $enable-rounded { + border-bottom-right-radius: valid-radius($radius); + border-bottom-left-radius: valid-radius($radius); + } +} - +@mixin border-start-radius($radius: $border-radius) { + @if $enable-rounded { + border-top-left-radius: valid-radius($radius); + border-bottom-left-radius: valid-radius($radius); + } +} - - - +@mixin border-top-start-radius($radius: $border-radius) { + @if $enable-rounded { + border-top-left-radius: valid-radius($radius); + } +} - - +@mixin border-top-end-radius($radius: $border-radius) { + @if $enable-rounded { + border-top-right-radius: valid-radius($radius); + } +} - - +@mixin border-bottom-end-radius($radius: $border-radius) { + @if $enable-rounded { + border-bottom-right-radius: valid-radius($radius); + } +} + +@mixin border-bottom-start-radius($radius: $border-radius) { + @if $enable-rounded { + border-bottom-left-radius: valid-radius($radius); + } +} +
    +

    Sass utilities API

    +

    Border utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "border": (
    +  property: border,
    +  values: (
    +    null: var(--#{$prefix}border-width) var(--#{$prefix}border-style) var(--#{$prefix}border-color),
    +    0: 0,
    +  )
    +),
    +"border-top": (
    +  property: border-top,
    +  values: (
    +    null: var(--#{$prefix}border-width) var(--#{$prefix}border-style) var(--#{$prefix}border-color),
    +    0: 0,
    +  )
    +),
    +"border-end": (
    +  property: border-right,
    +  class: border-end,
    +  values: (
    +    null: var(--#{$prefix}border-width) var(--#{$prefix}border-style) var(--#{$prefix}border-color),
    +    0: 0,
    +  )
    +),
    +"border-bottom": (
    +  property: border-bottom,
    +  values: (
    +    null: var(--#{$prefix}border-width) var(--#{$prefix}border-style) var(--#{$prefix}border-color),
    +    0: 0,
    +  )
    +),
    +"border-start": (
    +  property: border-left,
    +  class: border-start,
    +  values: (
    +    null: var(--#{$prefix}border-width) var(--#{$prefix}border-style) var(--#{$prefix}border-color),
    +    0: 0,
    +  )
    +),
    +"border-color": (
    +  property: border-color,
    +  class: border,
    +  local-vars: (
    +    "border-opacity": 1
    +  ),
    +  values: $utilities-border-colors
    +),
    +"subtle-border-color": (
    +  property: border-color,
    +  class: border,
    +  values: $utilities-border-subtle
    +),
    +"border-width": (
    +  property: border-width,
    +  class: border,
    +  values: $border-widths
    +),
    +"border-opacity": (
    +  css-var: true,
    +  class: border-opacity,
    +  values: (
    +    10: .1,
    +    25: .25,
    +    50: .5,
    +    75: .75,
    +    100: 1
    +  )
    +),
    +
    +
    "rounded": (
    +  property: border-radius,
    +  class: rounded,
    +  values: (
    +    null: var(--#{$prefix}border-radius),
    +    0: 0,
    +    1: var(--#{$prefix}border-radius-sm),
    +    2: var(--#{$prefix}border-radius),
    +    3: var(--#{$prefix}border-radius-lg),
    +    4: var(--#{$prefix}border-radius-xl),
    +    5: var(--#{$prefix}border-radius-xxl),
    +    circle: 50%,
    +    pill: var(--#{$prefix}border-radius-pill)
    +  )
    +),
    +"rounded-top": (
    +  property: border-top-left-radius border-top-right-radius,
    +  class: rounded-top,
    +  values: (
    +    null: var(--#{$prefix}border-radius),
    +    0: 0,
    +    1: var(--#{$prefix}border-radius-sm),
    +    2: var(--#{$prefix}border-radius),
    +    3: var(--#{$prefix}border-radius-lg),
    +    4: var(--#{$prefix}border-radius-xl),
    +    5: var(--#{$prefix}border-radius-xxl),
    +    circle: 50%,
    +    pill: var(--#{$prefix}border-radius-pill)
    +  )
    +),
    +"rounded-end": (
    +  property: border-top-right-radius border-bottom-right-radius,
    +  class: rounded-end,
    +  values: (
    +    null: var(--#{$prefix}border-radius),
    +    0: 0,
    +    1: var(--#{$prefix}border-radius-sm),
    +    2: var(--#{$prefix}border-radius),
    +    3: var(--#{$prefix}border-radius-lg),
    +    4: var(--#{$prefix}border-radius-xl),
    +    5: var(--#{$prefix}border-radius-xxl),
    +    circle: 50%,
    +    pill: var(--#{$prefix}border-radius-pill)
    +  )
    +),
    +"rounded-bottom": (
    +  property: border-bottom-right-radius border-bottom-left-radius,
    +  class: rounded-bottom,
    +  values: (
    +    null: var(--#{$prefix}border-radius),
    +    0: 0,
    +    1: var(--#{$prefix}border-radius-sm),
    +    2: var(--#{$prefix}border-radius),
    +    3: var(--#{$prefix}border-radius-lg),
    +    4: var(--#{$prefix}border-radius-xl),
    +    5: var(--#{$prefix}border-radius-xxl),
    +    circle: 50%,
    +    pill: var(--#{$prefix}border-radius-pill)
    +  )
    +),
    +"rounded-start": (
    +  property: border-bottom-left-radius border-top-left-radius,
    +  class: rounded-start,
    +  values: (
    +    null: var(--#{$prefix}border-radius),
    +    0: 0,
    +    1: var(--#{$prefix}border-radius-sm),
    +    2: var(--#{$prefix}border-radius),
    +    3: var(--#{$prefix}border-radius-lg),
    +    4: var(--#{$prefix}border-radius-xl),
    +    5: var(--#{$prefix}border-radius-xxl),
    +    circle: 50%,
    +    pill: var(--#{$prefix}border-radius-pill)
    +  )
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/colors/index.html b/docs/5.3/utilities/colors/index.html index a1d8992dca..f0600459fd 100644 --- a/docs/5.3/utilities/colors/index.html +++ b/docs/5.3/utilities/colors/index.html @@ -1,588 +1,31 @@ - - - - - - - - - - - - - - - - -Colors · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Colors

    -
    -

    Convey meaning through color with a handful of color utility classes. Includes support for styling links with hover states, too.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -
    -Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class. -
    - -

    Colors

    -

    Colorize text with color utilities. If you want to colorize links, you can use the .link-* helper classes which have :hover and :focus states.

    -
    -Color utilities like .text-* that generated from our original $theme-colors Sass map don’t yet respond to color modes, however, any .text-*-emphasis utility will. This will be resolved in v6. -
    - -
    -
    - - -

    .text-primary

    + Colors · Bootstrap v5.3

    Convey meaning through color with a handful of color utility classes. Includes support for styling links with hover states, too.

    +

    Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class.

    +

    Colors

    +

    Colorize text with color utilities. If you want to colorize links, you can use the .link-* helper classes which have :hover and :focus states.

    +

    Color utilities like .text-* that generated from our original $theme-colors Sass map don’t yet respond to color modes, however, any .text-*-emphasis utility will. This will be resolved in v6.

    +

    .text-primary

    .text-primary-emphasis

    .text-secondary

    .text-secondary-emphasis

    @@ -607,468 +50,239 @@ Color utilities like .text-* that generated from our original .text-black

    .text-white

    .text-black-50

    -

    .text-white-50

    +

    .text-white-50

    html
    <p class="text-primary">.text-primary</p>
    +<p class="text-primary-emphasis">.text-primary-emphasis</p>
    +<p class="text-secondary">.text-secondary</p>
    +<p class="text-secondary-emphasis">.text-secondary-emphasis</p>
    +<p class="text-success">.text-success</p>
    +<p class="text-success-emphasis">.text-success-emphasis</p>
    +<p class="text-danger">.text-danger</p>
    +<p class="text-danger-emphasis">.text-danger-emphasis</p>
    +<p class="text-warning bg-dark">.text-warning</p>
    +<p class="text-warning-emphasis">.text-warning-emphasis</p>
    +<p class="text-info bg-dark">.text-info</p>
    +<p class="text-info-emphasis">.text-info-emphasis</p>
    +<p class="text-light bg-dark">.text-light</p>
    +<p class="text-light-emphasis">.text-light-emphasis</p>
    +<p class="text-dark bg-white">.text-dark</p>
    +<p class="text-dark-emphasis">.text-dark-emphasis</p>
     
    -  
    - html -
    - - -
    -
    <p class="text-primary">.text-primary</p>
    -<p class="text-primary-emphasis">.text-primary-emphasis</p>
    -<p class="text-secondary">.text-secondary</p>
    -<p class="text-secondary-emphasis">.text-secondary-emphasis</p>
    -<p class="text-success">.text-success</p>
    -<p class="text-success-emphasis">.text-success-emphasis</p>
    -<p class="text-danger">.text-danger</p>
    -<p class="text-danger-emphasis">.text-danger-emphasis</p>
    -<p class="text-warning bg-dark">.text-warning</p>
    -<p class="text-warning-emphasis">.text-warning-emphasis</p>
    -<p class="text-info bg-dark">.text-info</p>
    -<p class="text-info-emphasis">.text-info-emphasis</p>
    -<p class="text-light bg-dark">.text-light</p>
    -<p class="text-light-emphasis">.text-light-emphasis</p>
    -<p class="text-dark bg-white">.text-dark</p>
    -<p class="text-dark-emphasis">.text-dark-emphasis</p>
    -
    -<p class="text-body">.text-body</p>
    -<p class="text-body-emphasis">.text-body-emphasis</p>
    -<p class="text-body-secondary">.text-body-secondary</p>
    -<p class="text-body-tertiary">.text-body-tertiary</p>
    -
    -<p class="text-black bg-white">.text-black</p>
    -<p class="text-white bg-dark">.text-white</p>
    -<p class="text-black-50 bg-white">.text-black-50</p>
    -<p class="text-white-50 bg-dark">.text-white-50</p>
    -
    +<p class="text-body">.text-body</p> +<p class="text-body-emphasis">.text-body-emphasis</p> +<p class="text-body-secondary">.text-body-secondary</p> +<p class="text-body-tertiary">.text-body-tertiary</p> -
    -Deprecation: With the addition of .text-opacity-* utilities and CSS variables for text utilities, .text-black-50 and .text-white-50 are deprecated as of v5.1.0. They’ll be removed in v6.0.0. -
    - -
    -Deprecation: With the addition of the expanded theme colors and variables, the .text-muted utility has been deprecated as of v5.3.0. Its default value has also been reassigned to the new --bs-secondary-color CSS variable to better support color modes. It will be removed in v6.0.0. -
    - -

    Opacity

    +<p class="text-black bg-white">.text-black</p> +<p class="text-white bg-dark">.text-white</p> +<p class="text-black-50 bg-white">.text-black-50</p> +<p class="text-white-50 bg-dark">.text-white-50</p>
    +

    Deprecation: With the addition of .text-opacity-* utilities and CSS variables for text utilities, .text-black-50 and .text-white-50 are deprecated as of v5.1.0. They’ll be removed in v6.0.0.

    +

    Deprecation: With the addition of the expanded theme colors and variables, the .text-muted utility has been deprecated as of v5.3.0. Its default value has also been reassigned to the new --bs-secondary-color CSS variable to better support color modes. It will be removed in v6.0.0.

    +

    Opacity

    Added in v5.1.0 -

    As of v5.1.0, text color utilities are generated with Sass using CSS variables. This allows for real-time color changes without compilation and dynamic alpha transparency changes.

    -

    How it works

    +

    How it works

    Consider our default .text-primary utility.

    -
    .text-primary {
    -  --bs-text-opacity: 1;
    -  color: rgba(var(--bs-primary-rgb), var(--bs-text-opacity)) !important;
    -}
    -

    We use an RGB version of our --bs-primary (with the value of 13, 110, 253) CSS variable and attached a second CSS variable, --bs-text-opacity, for the alpha transparency (with a default value 1 thanks to a local CSS variable). That means anytime you use .text-primary now, your computed color value is rgba(13, 110, 253, 1). The local CSS variable inside each .text-* class avoids inheritance issues so nested instances of the utilities don’t automatically have a modified alpha transparency.

    -

    Example

    +
    .text-primary {
    +  --bs-text-opacity: 1;
    +  color: rgba(var(--bs-primary-rgb), var(--bs-text-opacity)) !important;
    +}
    +
    +

    We use an RGB version of our --bs-primary (with the value of 13, 110, 253) CSS variable and attached a second CSS variable, --bs-text-opacity, for the alpha transparency (with a default value 1 thanks to a local CSS variable). That means anytime you use .text-primary now, your computed color value is rgba(13, 110, 253, 1). The local CSS variable inside each .text-* class avoids inheritance issues so nested instances of the utilities don’t automatically have a modified alpha transparency.

    +

    Example

    To change that opacity, override --bs-text-opacity via custom styles or inline styles.

    -
    -
    - -
    This is default primary text
    -
    This is 50% opacity primary text
    - -
    - html -
    - - -
    -
    <div class="text-primary">This is default primary text</div>
    -<div class="text-primary" style="--bs-text-opacity: .5;">This is 50% opacity primary text</div>
    -
    - +
    This is default primary text
    +
    This is 50% opacity primary text
    html
    <div class="text-primary">This is default primary text</div>
    +<div class="text-primary" style="--bs-text-opacity: .5;">This is 50% opacity primary text</div>

    Or, choose from any of the .text-opacity utilities:

    -
    -
    - -
    This is default primary text
    +
    This is default primary text
    This is 75% opacity primary text
    This is 50% opacity primary text
    -
    This is 25% opacity primary text
    - -
    - html -
    - - -
    -
    <div class="text-primary">This is default primary text</div>
    -<div class="text-primary text-opacity-75">This is 75% opacity primary text</div>
    -<div class="text-primary text-opacity-50">This is 50% opacity primary text</div>
    -<div class="text-primary text-opacity-25">This is 25% opacity primary text</div>
    -
    - -

    Specificity

    -

    Sometimes contextual classes cannot be applied due to the specificity of another selector. In some cases, a sufficient workaround is to wrap your element’s content in a <div> or more semantic element with the desired class.

    -

    CSS

    -

    In addition to the following Sass functionality, consider reading about our included CSS custom properties (aka CSS variables) for colors and more.

    -

    Sass variables

    +
    This is 25% opacity primary text
    html
    <div class="text-primary">This is default primary text</div>
    +<div class="text-primary text-opacity-75">This is 75% opacity primary text</div>
    +<div class="text-primary text-opacity-50">This is 50% opacity primary text</div>
    +<div class="text-primary text-opacity-25">This is 25% opacity primary text</div>
    +

    Specificity

    +

    Sometimes contextual classes cannot be applied due to the specificity of another selector. In some cases, a sufficient workaround is to wrap your element’s content in a <div> or more semantic element with the desired class.

    +

    CSS

    +

    In addition to the following Sass functionality, consider reading about our included CSS custom properties (aka CSS variables) for colors and more.

    +

    Sass variables

    Most color utilities are generated by our theme colors, reassigned from our generic color palette variables.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $blue:    #0d6efd;
    -$indigo:  #6610f2;
    -$purple:  #6f42c1;
    -$pink:    #d63384;
    -$red:     #dc3545;
    -$orange:  #fd7e14;
    -$yellow:  #ffc107;
    -$green:   #198754;
    -$teal:    #20c997;
    -$cyan:    #0dcaf0;
    -
    -
    -
    - scss/_variables.scss -
    - -
    -
    $primary:       $blue;
    -$secondary:     $gray-600;
    -$success:       $green;
    -$info:          $cyan;
    -$warning:       $yellow;
    -$danger:        $red;
    -$light:         $gray-100;
    -$dark:          $gray-900;
    -
    +
    $blue:    #0d6efd;
    +$indigo:  #6610f2;
    +$purple:  #6f42c1;
    +$pink:    #d63384;
    +$red:     #dc3545;
    +$orange:  #fd7e14;
    +$yellow:  #ffc107;
    +$green:   #198754;
    +$teal:    #20c997;
    +$cyan:    #0dcaf0;
    +
    +
    $primary:       $blue;
    +$secondary:     $gray-600;
    +$success:       $green;
    +$info:          $cyan;
    +$warning:       $yellow;
    +$danger:        $red;
    +$light:         $gray-100;
    +$dark:          $gray-900;
    +

    Grayscale colors are also available, but only a subset are used to generate any utilities.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $white:    #fff;
    -$gray-100: #f8f9fa;
    -$gray-200: #e9ecef;
    -$gray-300: #dee2e6;
    -$gray-400: #ced4da;
    -$gray-500: #adb5bd;
    -$gray-600: #6c757d;
    -$gray-700: #495057;
    -$gray-800: #343a40;
    -$gray-900: #212529;
    -$black:    #000;
    -
    -
    -
    - scss/_maps.scss -
    - -
    -
    $theme-colors-text: (
    -  "primary": $primary-text-emphasis,
    -  "secondary": $secondary-text-emphasis,
    -  "success": $success-text-emphasis,
    -  "info": $info-text-emphasis,
    -  "warning": $warning-text-emphasis,
    -  "danger": $danger-text-emphasis,
    -  "light": $light-text-emphasis,
    -  "dark": $dark-text-emphasis,
    -);
    -
    +
    $white:    #fff;
    +$gray-100: #f8f9fa;
    +$gray-200: #e9ecef;
    +$gray-300: #dee2e6;
    +$gray-400: #ced4da;
    +$gray-500: #adb5bd;
    +$gray-600: #6c757d;
    +$gray-700: #495057;
    +$gray-800: #343a40;
    +$gray-900: #212529;
    +$black:    #000;
    +
    +
    $theme-colors-text: (
    +  "primary": $primary-text-emphasis,
    +  "secondary": $secondary-text-emphasis,
    +  "success": $success-text-emphasis,
    +  "info": $info-text-emphasis,
    +  "warning": $warning-text-emphasis,
    +  "danger": $danger-text-emphasis,
    +  "light": $light-text-emphasis,
    +  "dark": $dark-text-emphasis,
    +);
    +

    Variables for setting colors in .text-*-emphasis utilities in light and dark mode:

    -
    -
    - scss/_variables.scss -
    - -
    -
    $primary-text-emphasis:   shade-color($primary, 60%);
    -$secondary-text-emphasis: shade-color($secondary, 60%);
    -$success-text-emphasis:   shade-color($success, 60%);
    -$info-text-emphasis:      shade-color($info, 60%);
    -$warning-text-emphasis:   shade-color($warning, 60%);
    -$danger-text-emphasis:    shade-color($danger, 60%);
    -$light-text-emphasis:     $gray-700;
    -$dark-text-emphasis:      $gray-700;
    -
    -
    -
    $primary-text-emphasis-dark:        tint-color($primary, 40%);
    -$secondary-text-emphasis-dark:      tint-color($secondary, 40%);
    -$success-text-emphasis-dark:        tint-color($success, 40%);
    -$info-text-emphasis-dark:           tint-color($info, 40%);
    -$warning-text-emphasis-dark:        tint-color($warning, 40%);
    -$danger-text-emphasis-dark:         tint-color($danger, 40%);
    -$light-text-emphasis-dark:          $gray-100;
    -$dark-text-emphasis-dark:           $gray-300;
    -
    -

    Sass maps

    +
    $primary-text-emphasis:   shade-color($primary, 60%);
    +$secondary-text-emphasis: shade-color($secondary, 60%);
    +$success-text-emphasis:   shade-color($success, 60%);
    +$info-text-emphasis:      shade-color($info, 60%);
    +$warning-text-emphasis:   shade-color($warning, 60%);
    +$danger-text-emphasis:    shade-color($danger, 60%);
    +$light-text-emphasis:     $gray-700;
    +$dark-text-emphasis:      $gray-700;
    +
    +
    $primary-text-emphasis-dark:        tint-color($primary, 40%);
    +$secondary-text-emphasis-dark:      tint-color($secondary, 40%);
    +$success-text-emphasis-dark:        tint-color($success, 40%);
    +$info-text-emphasis-dark:           tint-color($info, 40%);
    +$warning-text-emphasis-dark:        tint-color($warning, 40%);
    +$danger-text-emphasis-dark:         tint-color($danger, 40%);
    +$light-text-emphasis-dark:          $gray-100;
    +$dark-text-emphasis-dark:           $gray-300;
    +
    +

    Sass maps

    Theme colors are then put into a Sass map so we can loop over them to generate our utilities, component modifiers, and more.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $theme-colors: (
    -  "primary":    $primary,
    -  "secondary":  $secondary,
    -  "success":    $success,
    -  "info":       $info,
    -  "warning":    $warning,
    -  "danger":     $danger,
    -  "light":      $light,
    -  "dark":       $dark
    -);
    -
    +
    $theme-colors: (
    +  "primary":    $primary,
    +  "secondary":  $secondary,
    +  "success":    $success,
    +  "info":       $info,
    +  "warning":    $warning,
    +  "danger":     $danger,
    +  "light":      $light,
    +  "dark":       $dark
    +);
    +

    Grayscale colors are also available as a Sass map. This map is not used to generate any utilities.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $grays: (
    -  "100": $gray-100,
    -  "200": $gray-200,
    -  "300": $gray-300,
    -  "400": $gray-400,
    -  "500": $gray-500,
    -  "600": $gray-600,
    -  "700": $gray-700,
    -  "800": $gray-800,
    -  "900": $gray-900
    -);
    -
    +
    $grays: (
    +  "100": $gray-100,
    +  "200": $gray-200,
    +  "300": $gray-300,
    +  "400": $gray-400,
    +  "500": $gray-500,
    +  "600": $gray-600,
    +  "700": $gray-700,
    +  "800": $gray-800,
    +  "900": $gray-900
    +);
    +

    RGB colors are generated from a separate Sass map:

    -
    -
    - scss/_maps.scss -
    - -
    -
    $theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value");
    -
    -

    Color opacities build on that with their own map that’s consumed by the utilities API:

    -
    -
    - scss/_maps.scss -
    - -
    -
    $utilities-text: map-merge(
    -  $utilities-colors,
    -  (
    -    "black": to-rgb($black),
    -    "white": to-rgb($white),
    -    "body": to-rgb($body-color)
    -  )
    -);
    -$utilities-text-colors: map-loop($utilities-text, rgba-css-var, "$key", "text");
    -
    -$utilities-text-emphasis-colors: (
    -  "primary-emphasis": var(--#{$prefix}primary-text-emphasis),
    -  "secondary-emphasis": var(--#{$prefix}secondary-text-emphasis),
    -  "success-emphasis": var(--#{$prefix}success-text-emphasis),
    -  "info-emphasis": var(--#{$prefix}info-text-emphasis),
    -  "warning-emphasis": var(--#{$prefix}warning-text-emphasis),
    -  "danger-emphasis": var(--#{$prefix}danger-text-emphasis),
    -  "light-emphasis": var(--#{$prefix}light-text-emphasis),
    -  "dark-emphasis": var(--#{$prefix}dark-text-emphasis)
    -);
    -
    +
    $theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value");
    +
    +

    Color opacities build on that with their own map that’s consumed by the utilities API:

    +
    $utilities-text: map-merge(
    +  $utilities-colors,
    +  (
    +    "black": to-rgb($black),
    +    "white": to-rgb($white),
    +    "body": to-rgb($body-color)
    +  )
    +);
    +$utilities-text-colors: map-loop($utilities-text, rgba-css-var, "$key", "text");
    +
    +$utilities-text-emphasis-colors: (
    +  "primary-emphasis": var(--#{$prefix}primary-text-emphasis),
    +  "secondary-emphasis": var(--#{$prefix}secondary-text-emphasis),
    +  "success-emphasis": var(--#{$prefix}success-text-emphasis),
    +  "info-emphasis": var(--#{$prefix}info-text-emphasis),
    +  "warning-emphasis": var(--#{$prefix}warning-text-emphasis),
    +  "danger-emphasis": var(--#{$prefix}danger-text-emphasis),
    +  "light-emphasis": var(--#{$prefix}light-text-emphasis),
    +  "dark-emphasis": var(--#{$prefix}dark-text-emphasis)
    +);
    +

    Color mode adaptive text colors are also available as a Sass map:

    -
    -
    - scss/_maps.scss -
    - -
    -
    $theme-colors-text: (
    -  "primary": $primary-text-emphasis,
    -  "secondary": $secondary-text-emphasis,
    -  "success": $success-text-emphasis,
    -  "info": $info-text-emphasis,
    -  "warning": $warning-text-emphasis,
    -  "danger": $danger-text-emphasis,
    -  "light": $light-text-emphasis,
    -  "dark": $dark-text-emphasis,
    -);
    -
    -
    -
    - scss/_maps.scss -
    - -
    -
    $theme-colors-text-dark: (
    -  "primary": $primary-text-emphasis-dark,
    -  "secondary": $secondary-text-emphasis-dark,
    -  "success": $success-text-emphasis-dark,
    -  "info": $info-text-emphasis-dark,
    -  "warning": $warning-text-emphasis-dark,
    -  "danger": $danger-text-emphasis-dark,
    -  "light": $light-text-emphasis-dark,
    -  "dark": $dark-text-emphasis-dark,
    -);
    -

    Sass utilities API

    -

    Color utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "color": (
    -  property: color,
    -  class: text,
    -  local-vars: (
    -    "text-opacity": 1
    -  ),
    -  values: map-merge(
    -    $utilities-text-colors,
    -    (
    -      "muted": var(--#{$prefix}secondary-color), // deprecated
    -      "black-50": rgba($black, .5), // deprecated
    -      "white-50": rgba($white, .5), // deprecated
    -      "body-secondary": var(--#{$prefix}secondary-color),
    -      "body-tertiary": var(--#{$prefix}tertiary-color),
    -      "body-emphasis": var(--#{$prefix}emphasis-color),
    -      "reset": inherit,
    -    )
    -  )
    -),
    -"text-opacity": (
    -  css-var: true,
    -  class: text-opacity,
    -  values: (
    -    25: .25,
    -    50: .5,
    -    75: .75,
    -    100: 1
    -  )
    -),
    -"text-color": (
    -  property: color,
    -  class: text,
    -  values: $utilities-text-emphasis-colors
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    $theme-colors-text: (
    +  "primary": $primary-text-emphasis,
    +  "secondary": $secondary-text-emphasis,
    +  "success": $success-text-emphasis,
    +  "info": $info-text-emphasis,
    +  "warning": $warning-text-emphasis,
    +  "danger": $danger-text-emphasis,
    +  "light": $light-text-emphasis,
    +  "dark": $dark-text-emphasis,
    +);
    +
    +
    $theme-colors-text-dark: (
    +  "primary": $primary-text-emphasis-dark,
    +  "secondary": $secondary-text-emphasis-dark,
    +  "success": $success-text-emphasis-dark,
    +  "info": $info-text-emphasis-dark,
    +  "warning": $warning-text-emphasis-dark,
    +  "danger": $danger-text-emphasis-dark,
    +  "light": $light-text-emphasis-dark,
    +  "dark": $dark-text-emphasis-dark,
    +);
    +
    +

    Sass utilities API

    +

    Color utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "color": (
    +  property: color,
    +  class: text,
    +  local-vars: (
    +    "text-opacity": 1
    +  ),
    +  values: map-merge(
    +    $utilities-text-colors,
    +    (
    +      "muted": var(--#{$prefix}secondary-color), // deprecated
    +      "black-50": rgba($black, .5), // deprecated
    +      "white-50": rgba($white, .5), // deprecated
    +      "body-secondary": var(--#{$prefix}secondary-color),
    +      "body-tertiary": var(--#{$prefix}tertiary-color),
    +      "body-emphasis": var(--#{$prefix}emphasis-color),
    +      "reset": inherit,
    +    )
    +  )
    +),
    +"text-opacity": (
    +  css-var: true,
    +  class: text-opacity,
    +  values: (
    +    25: .25,
    +    50: .5,
    +    75: .75,
    +    100: 1
    +  )
    +),
    +"text-color": (
    +  property: color,
    +  class: text,
    +  values: $utilities-text-emphasis-colors
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/display/index.html b/docs/5.3/utilities/display/index.html index e3378fb4b0..c1a6bafcca 100644 --- a/docs/5.3/utilities/display/index.html +++ b/docs/5.3/utilities/display/index.html @@ -1,572 +1,30 @@ - - - - - - - - - - - - - - - - -Display property · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Display property

    -
    -

    Quickly and responsively toggle the display value of components and more with our display utilities. Includes support for some of the more common values, as well as some extras for controlling display when printing.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    How it works

    + Display property · Bootstrap v5.3

    Display property

    Quickly and responsively toggle the display value of components and more with our display utilities. Includes support for some of the more common values, as well as some extras for controlling display when printing.

    +

    How it works

    Change the value of the display property with our responsive display utility classes. We purposely support only a subset of all possible values for display. Classes can be combined for various effects as you need.

    -

    Notation

    -

    Display utility classes that apply to all breakpoints, from xs to xxl, have no breakpoint abbreviation in them. This is because those classes are applied from min-width: 0; and up, and thus are not bound by a media query. The remaining breakpoints, however, do include a breakpoint abbreviation.

    +

    Notation

    +

    Display utility classes that apply to all breakpoints, from xs to xxl, have no breakpoint abbreviation in them. This is because those classes are applied from min-width: 0; and up, and thus are not bound by a media query. The remaining breakpoints, however, do include a breakpoint abbreviation.

    As such, the classes are named using the format:

    • .d-{value} for xs
    • @@ -588,139 +46,87 @@

    The display values can be altered by changing the display values defined in $utilities and recompiling the SCSS.

    The media queries affect screen widths with the given breakpoint or larger. For example, .d-lg-none sets display: none; on lg, xl, and xxl screens.

    -

    Examples

    -
    -
    - -
    d-inline
    -
    d-inline
    - -
    - html -
    - - -
    -
    <div class="d-inline p-2 text-bg-primary">d-inline</div>
    -<div class="d-inline p-2 text-bg-dark">d-inline</div>
    -
    - -
    -
    - -d-block -d-block - -
    - html -
    - - -
    -
    <span class="d-block p-2 text-bg-primary">d-block</span>
    -<span class="d-block p-2 text-bg-dark">d-block</span>
    -
    - -

    Hiding elements

    +

    Examples

    +
    d-inline
    +
    d-inline
    html
    <div class="d-inline p-2 text-bg-primary">d-inline</div>
    +<div class="d-inline p-2 text-bg-dark">d-inline</div>
    +
    d-block +d-block
    html
    <span class="d-block p-2 text-bg-primary">d-block</span>
    +<span class="d-block p-2 text-bg-dark">d-block</span>
    +

    Hiding elements

    For faster mobile-friendly development, use responsive display classes for showing and hiding elements by device. Avoid creating entirely different versions of the same site, instead hide elements responsively for each screen size.

    To hide elements simply use the .d-none class or one of the .d-{sm,md,lg,xl,xxl}-none classes for any responsive screen variation.

    To show an element only on a given interval of screen sizes you can combine one .d-*-none class with a .d-*-* class, for example .d-none .d-md-block .d-xl-none will hide the element for all screen sizes except on medium and large devices.

    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Screen sizeClass
    Hidden on all.d-none
    Hidden only on xs.d-none .d-sm-block
    Hidden only on sm.d-sm-none .d-md-block
    Hidden only on md.d-md-none .d-lg-block
    Hidden only on lg.d-lg-none .d-xl-block
    Hidden only on xl.d-xl-none .d-xxl-block
    Hidden only on xxl.d-xxl-none
    Visible on all.d-block
    Visible only on xs.d-block .d-sm-none
    Visible only on sm.d-none .d-sm-block .d-md-none
    Visible only on md.d-none .d-md-block .d-lg-none
    Visible only on lg.d-none .d-lg-block .d-xl-none
    Visible only on xl.d-none .d-xl-block .d-xxl-none
    Visible only on xxl.d-none .d-xxl-block
    +
    -
    -
    - -
    hide on lg and wider screens
    -
    hide on screens smaller than lg
    -
    - html -
    - - -
    -
    <div class="d-lg-none">hide on lg and wider screens</div>
    -<div class="d-none d-lg-block">hide on screens smaller than lg</div>
    -
    -

    Display in print

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Screen sizeClass
    Hidden on all.d-none
    Hidden only on xs.d-none .d-sm-block
    Hidden only on sm.d-sm-none .d-md-block
    Hidden only on md.d-md-none .d-lg-block
    Hidden only on lg.d-lg-none .d-xl-block
    Hidden only on xl.d-xl-none .d-xxl-block
    Hidden only on xxl.d-xxl-none
    Visible on all.d-block
    Visible only on xs.d-block .d-sm-none
    Visible only on sm.d-none .d-sm-block .d-md-none
    Visible only on md.d-none .d-md-block .d-lg-none
    Visible only on lg.d-none .d-lg-block .d-xl-none
    Visible only on xl.d-none .d-xl-block .d-xxl-none
    Visible only on xxl.d-none .d-xxl-block
    +
    hide on lg and wider screens
    +
    hide on screens smaller than lg
    html
    <div class="d-lg-none">hide on lg and wider screens</div>
    +<div class="d-none d-lg-block">hide on screens smaller than lg</div>
    +

    Display in print

    Change the display value of elements when printing with our print display utility classes. Includes support for the same display values as our responsive .d-* utilities.

    • .d-print-none
    • @@ -736,120 +142,23 @@
    • .d-print-inline-flex

    The print and display classes can be combined.

    -
    -
    - -
    Screen Only (Hide on print only)
    +
    Screen Only (Hide on print only)
    Print Only (Hide on screen only)
    -
    Hide up to large on screen, but always show on print
    - -
    - html -
    - - -
    -
    <div class="d-print-none">Screen Only (Hide on print only)</div>
    -<div class="d-none d-print-block">Print Only (Hide on screen only)</div>
    -<div class="d-none d-lg-block d-print-block">Hide up to large on screen, but always show on print</div>
    -
    - -

    CSS

    -

    Sass utilities API

    -

    Display utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "display": (
    -  responsive: true,
    -  print: true,
    -  property: display,
    -  class: d,
    -  values: inline inline-block block grid inline-grid table table-row table-cell flex inline-flex none
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    Hide up to large on screen, but always show on print
    html
    <div class="d-print-none">Screen Only (Hide on print only)</div>
    +<div class="d-none d-print-block">Print Only (Hide on screen only)</div>
    +<div class="d-none d-lg-block d-print-block">Hide up to large on screen, but always show on print</div>
    +

    CSS

    +

    Sass utilities API

    +

    Display utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "display": (
    +  responsive: true,
    +  print: true,
    +  property: display,
    +  class: d,
    +  values: inline inline-block block grid inline-grid table table-row table-cell flex inline-flex none
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/flex/index.html b/docs/5.3/utilities/flex/index.html index 191bf92660..c590c451a5 100644 --- a/docs/5.3/utilities/flex/index.html +++ b/docs/5.3/utilities/flex/index.html @@ -1,640 +1,36 @@ - - - - - - - - - - - - - - - - -Flex · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    - -

    Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive flexbox utilities. For more complex implementations, custom CSS may be necessary.

    - - -
    - - - - - -
    - - -

    Enable flex behaviors

    + Flex · Bootstrap v5.3

    Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with a full suite of responsive flexbox utilities. For more complex implementations, custom CSS may be necessary.

    +

    Enable flex behaviors

    Apply display utilities to create a flexbox container and transform direct children elements into flex items. Flex containers and items are able to be modified further with additional flex properties.

    -
    -
    - -
    I'm a flexbox container!
    - -
    - html -
    - - -
    -
    <div class="d-flex p-2">I'm a flexbox container!</div>
    -
    - -
    -
    - -
    I'm an inline flexbox container!
    - -
    - html -
    - - -
    -
    <div class="d-inline-flex p-2">I'm an inline flexbox container!</div>
    -
    - +
    I'm a flexbox container!
    html
    <div class="d-flex p-2">I'm a flexbox container!</div>
    +
    I'm an inline flexbox container!
    html
    <div class="d-inline-flex p-2">I'm an inline flexbox container!</div>

    Responsive variations also exist for .d-flex and .d-inline-flex.

    -
      -
    • .d-flex
    • -
    • .d-inline-flex
    • -
    • .d-sm-flex
    • -
    • .d-sm-inline-flex
    • -
    • .d-md-flex
    • -
    • .d-md-inline-flex
    • -
    • .d-lg-flex
    • -
    • .d-lg-inline-flex
    • -
    • .d-xl-flex
    • -
    • .d-xl-inline-flex
    • -
    • .d-xxl-flex
    • -
    • .d-xxl-inline-flex
    • -
    - -

    Direction

    +
    • .d-flex
    • .d-inline-flex
    • .d-sm-flex
    • .d-sm-inline-flex
    • .d-md-flex
    • .d-md-inline-flex
    • .d-lg-flex
    • .d-lg-inline-flex
    • .d-xl-flex
    • .d-xl-inline-flex
    • .d-xxl-flex
    • .d-xxl-inline-flex
    +

    Direction

    Set the direction of flex items in a flex container with direction utilities. In most cases you can omit the horizontal class here as the browser default is row. However, you may encounter situations where you needed to explicitly set this value (like responsive layouts).

    Use .flex-row to set a horizontal direction (the browser default), or .flex-row-reverse to start the horizontal direction from the opposite side.

    -
    -
    - -
    +
    Flex item 1
    Flex item 2
    Flex item 3
    @@ -643,35 +39,18 @@
    Flex item 1
    Flex item 2
    Flex item 3
    -
    - -
    - html -
    - - -
    -
    <div class="d-flex flex-row mb-3">
    -  <div class="p-2">Flex item 1</div>
    -  <div class="p-2">Flex item 2</div>
    -  <div class="p-2">Flex item 3</div>
    -</div>
    -<div class="d-flex flex-row-reverse">
    -  <div class="p-2">Flex item 1</div>
    -  <div class="p-2">Flex item 2</div>
    -  <div class="p-2">Flex item 3</div>
    -</div>
    -
    - +
    html
    <div class="d-flex flex-row mb-3">
    +  <div class="p-2">Flex item 1</div>
    +  <div class="p-2">Flex item 2</div>
    +  <div class="p-2">Flex item 3</div>
    +</div>
    +<div class="d-flex flex-row-reverse">
    +  <div class="p-2">Flex item 1</div>
    +  <div class="p-2">Flex item 2</div>
    +  <div class="p-2">Flex item 3</div>
    +</div>

    Use .flex-column to set a vertical direction, or .flex-column-reverse to start the vertical direction from the opposite side.

    -
    -
    - -
    +
    Flex item 1
    Flex item 2
    Flex item 3
    @@ -680,387 +59,89 @@
    Flex item 1
    Flex item 2
    Flex item 3
    -
    - -
    - html -
    - - -
    -
    <div class="d-flex flex-column mb-3">
    -  <div class="p-2">Flex item 1</div>
    -  <div class="p-2">Flex item 2</div>
    -  <div class="p-2">Flex item 3</div>
    -</div>
    -<div class="d-flex flex-column-reverse">
    -  <div class="p-2">Flex item 1</div>
    -  <div class="p-2">Flex item 2</div>
    -  <div class="p-2">Flex item 3</div>
    -</div>
    -
    - +
    html
    <div class="d-flex flex-column mb-3">
    +  <div class="p-2">Flex item 1</div>
    +  <div class="p-2">Flex item 2</div>
    +  <div class="p-2">Flex item 3</div>
    +</div>
    +<div class="d-flex flex-column-reverse">
    +  <div class="p-2">Flex item 1</div>
    +  <div class="p-2">Flex item 2</div>
    +  <div class="p-2">Flex item 3</div>
    +</div>

    Responsive variations also exist for flex-direction.

    -
      -
    • .flex-row
    • -
    • .flex-row-reverse
    • -
    • .flex-column
    • -
    • .flex-column-reverse
    • -
    • .flex-sm-row
    • -
    • .flex-sm-row-reverse
    • -
    • .flex-sm-column
    • -
    • .flex-sm-column-reverse
    • -
    • .flex-md-row
    • -
    • .flex-md-row-reverse
    • -
    • .flex-md-column
    • -
    • .flex-md-column-reverse
    • -
    • .flex-lg-row
    • -
    • .flex-lg-row-reverse
    • -
    • .flex-lg-column
    • -
    • .flex-lg-column-reverse
    • -
    • .flex-xl-row
    • -
    • .flex-xl-row-reverse
    • -
    • .flex-xl-column
    • -
    • .flex-xl-column-reverse
    • -
    • .flex-xxl-row
    • -
    • .flex-xxl-row-reverse
    • -
    • .flex-xxl-column
    • -
    • .flex-xxl-column-reverse
    • -
    - -

    Justify content

    +
    • .flex-row
    • .flex-row-reverse
    • .flex-column
    • .flex-column-reverse
    • .flex-sm-row
    • .flex-sm-row-reverse
    • .flex-sm-column
    • .flex-sm-column-reverse
    • .flex-md-row
    • .flex-md-row-reverse
    • .flex-md-column
    • .flex-md-column-reverse
    • .flex-lg-row
    • .flex-lg-row-reverse
    • .flex-lg-column
    • .flex-lg-column-reverse
    • .flex-xl-row
    • .flex-xl-row-reverse
    • .flex-xl-column
    • .flex-xl-column-reverse
    • .flex-xxl-row
    • .flex-xxl-row-reverse
    • .flex-xxl-column
    • .flex-xxl-column-reverse
    +

    Justify content

    Use justify-content utilities on flexbox containers to change the alignment of flex items on the main axis (the x-axis to start, y-axis if flex-direction: column). Choose from start (browser default), end, center, between, around, or evenly.

    -
    -
    -
    Justify
    -
    Content
    -
    Start
    -
    -
    -
    Justify
    -
    Content
    -
    End
    -
    -
    -
    Justify
    -
    Content
    -
    Center
    -
    -
    -
    Justify
    -
    Content
    -
    Between
    -
    -
    -
    Justify
    -
    Content
    -
    Around
    -
    -
    -
    Justify
    -
    Content
    -
    Evenly
    -
    -
    -
    <div class="d-flex justify-content-start">...</div>
    -<div class="d-flex justify-content-end">...</div>
    -<div class="d-flex justify-content-center">...</div>
    -<div class="d-flex justify-content-between">...</div>
    -<div class="d-flex justify-content-around">...</div>
    -<div class="d-flex justify-content-evenly">...</div>
    -

    Responsive variations also exist for justify-content.

    -
      -
    • .justify-content-start
    • -
    • .justify-content-end
    • -
    • .justify-content-center
    • -
    • .justify-content-between
    • -
    • .justify-content-around
    • -
    • .justify-content-evenly
    • -
    • .justify-content-sm-start
    • -
    • .justify-content-sm-end
    • -
    • .justify-content-sm-center
    • -
    • .justify-content-sm-between
    • -
    • .justify-content-sm-around
    • -
    • .justify-content-sm-evenly
    • -
    • .justify-content-md-start
    • -
    • .justify-content-md-end
    • -
    • .justify-content-md-center
    • -
    • .justify-content-md-between
    • -
    • .justify-content-md-around
    • -
    • .justify-content-md-evenly
    • -
    • .justify-content-lg-start
    • -
    • .justify-content-lg-end
    • -
    • .justify-content-lg-center
    • -
    • .justify-content-lg-between
    • -
    • .justify-content-lg-around
    • -
    • .justify-content-lg-evenly
    • -
    • .justify-content-xl-start
    • -
    • .justify-content-xl-end
    • -
    • .justify-content-xl-center
    • -
    • .justify-content-xl-between
    • -
    • .justify-content-xl-around
    • -
    • .justify-content-xl-evenly
    • -
    • .justify-content-xxl-start
    • -
    • .justify-content-xxl-end
    • -
    • .justify-content-xxl-center
    • -
    • .justify-content-xxl-between
    • -
    • .justify-content-xxl-around
    • -
    • .justify-content-xxl-evenly
    • -
    - -

    Align items

    +
    Justify
    Content
    Start
    Justify
    Content
    End
    Justify
    Content
    Center
    Justify
    Content
    Between
    Justify
    Content
    Around
    Justify
    Content
    Evenly
    +
    <div class="d-flex justify-content-start">...</div>
    +<div class="d-flex justify-content-end">...</div>
    +<div class="d-flex justify-content-center">...</div>
    +<div class="d-flex justify-content-between">...</div>
    +<div class="d-flex justify-content-around">...</div>
    +<div class="d-flex justify-content-evenly">...</div>
    +
    +

    Responsive variations also exist for justify-content.

    +
    • .justify-content-start
    • .justify-content-end
    • .justify-content-center
    • .justify-content-between
    • .justify-content-around
    • .justify-content-evenly
    • .justify-content-sm-start
    • .justify-content-sm-end
    • .justify-content-sm-center
    • .justify-content-sm-between
    • .justify-content-sm-around
    • .justify-content-sm-evenly
    • .justify-content-md-start
    • .justify-content-md-end
    • .justify-content-md-center
    • .justify-content-md-between
    • .justify-content-md-around
    • .justify-content-md-evenly
    • .justify-content-lg-start
    • .justify-content-lg-end
    • .justify-content-lg-center
    • .justify-content-lg-between
    • .justify-content-lg-around
    • .justify-content-lg-evenly
    • .justify-content-xl-start
    • .justify-content-xl-end
    • .justify-content-xl-center
    • .justify-content-xl-between
    • .justify-content-xl-around
    • .justify-content-xl-evenly
    • .justify-content-xxl-start
    • .justify-content-xxl-end
    • .justify-content-xxl-center
    • .justify-content-xxl-between
    • .justify-content-xxl-around
    • .justify-content-xxl-evenly
    +

    Align items

    Use align-items utilities on flexbox containers to change the alignment of flex items on the cross axis (the y-axis to start, x-axis if flex-direction: column). Choose from start, end, center, baseline, or stretch (browser default).

    -
    -
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    -
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    -
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    -
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    -
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    -
    -
    <div class="d-flex align-items-start">...</div>
    -<div class="d-flex align-items-end">...</div>
    -<div class="d-flex align-items-center">...</div>
    -<div class="d-flex align-items-baseline">...</div>
    -<div class="d-flex align-items-stretch">...</div>
    -

    Responsive variations also exist for align-items.

    -
      -
    • .align-items-start
    • -
    • .align-items-end
    • -
    • .align-items-center
    • -
    • .align-items-baseline
    • -
    • .align-items-stretch
    • -
    • .align-items-sm-start
    • -
    • .align-items-sm-end
    • -
    • .align-items-sm-center
    • -
    • .align-items-sm-baseline
    • -
    • .align-items-sm-stretch
    • -
    • .align-items-md-start
    • -
    • .align-items-md-end
    • -
    • .align-items-md-center
    • -
    • .align-items-md-baseline
    • -
    • .align-items-md-stretch
    • -
    • .align-items-lg-start
    • -
    • .align-items-lg-end
    • -
    • .align-items-lg-center
    • -
    • .align-items-lg-baseline
    • -
    • .align-items-lg-stretch
    • -
    • .align-items-xl-start
    • -
    • .align-items-xl-end
    • -
    • .align-items-xl-center
    • -
    • .align-items-xl-baseline
    • -
    • .align-items-xl-stretch
    • -
    • .align-items-xxl-start
    • -
    • .align-items-xxl-end
    • -
    • .align-items-xxl-center
    • -
    • .align-items-xxl-baseline
    • -
    • .align-items-xxl-stretch
    • -
    - -

    Align self

    +
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    +
    <div class="d-flex align-items-start">...</div>
    +<div class="d-flex align-items-end">...</div>
    +<div class="d-flex align-items-center">...</div>
    +<div class="d-flex align-items-baseline">...</div>
    +<div class="d-flex align-items-stretch">...</div>
    +
    +

    Responsive variations also exist for align-items.

    +
    • .align-items-start
    • .align-items-end
    • .align-items-center
    • .align-items-baseline
    • .align-items-stretch
    • .align-items-sm-start
    • .align-items-sm-end
    • .align-items-sm-center
    • .align-items-sm-baseline
    • .align-items-sm-stretch
    • .align-items-md-start
    • .align-items-md-end
    • .align-items-md-center
    • .align-items-md-baseline
    • .align-items-md-stretch
    • .align-items-lg-start
    • .align-items-lg-end
    • .align-items-lg-center
    • .align-items-lg-baseline
    • .align-items-lg-stretch
    • .align-items-xl-start
    • .align-items-xl-end
    • .align-items-xl-center
    • .align-items-xl-baseline
    • .align-items-xl-stretch
    • .align-items-xxl-start
    • .align-items-xxl-end
    • .align-items-xxl-center
    • .align-items-xxl-baseline
    • .align-items-xxl-stretch
    +

    Align self

    Use align-self utilities on flexbox items to individually change their alignment on the cross axis (the y-axis to start, x-axis if flex-direction: column). Choose from the same options as align-items: start, end, center, baseline, or stretch (browser default).

    -
    -
    -
    Flex item
    -
    Aligned flex item
    -
    Flex item
    -
    -
    -
    Flex item
    -
    Aligned flex item
    -
    Flex item
    -
    -
    -
    Flex item
    -
    Aligned flex item
    -
    Flex item
    -
    -
    -
    Flex item
    -
    Aligned flex item
    -
    Flex item
    -
    -
    -
    Flex item
    -
    Aligned flex item
    -
    Flex item
    -
    -
    -
    <div class="align-self-start">Aligned flex item</div>
    -<div class="align-self-end">Aligned flex item</div>
    -<div class="align-self-center">Aligned flex item</div>
    -<div class="align-self-baseline">Aligned flex item</div>
    -<div class="align-self-stretch">Aligned flex item</div>
    -

    Responsive variations also exist for align-self.

    -
      -
    • .align-self-start
    • -
    • .align-self-end
    • -
    • .align-self-center
    • -
    • .align-self-baseline
    • -
    • .align-self-stretch
    • -
    • .align-self-sm-start
    • -
    • .align-self-sm-end
    • -
    • .align-self-sm-center
    • -
    • .align-self-sm-baseline
    • -
    • .align-self-sm-stretch
    • -
    • .align-self-md-start
    • -
    • .align-self-md-end
    • -
    • .align-self-md-center
    • -
    • .align-self-md-baseline
    • -
    • .align-self-md-stretch
    • -
    • .align-self-lg-start
    • -
    • .align-self-lg-end
    • -
    • .align-self-lg-center
    • -
    • .align-self-lg-baseline
    • -
    • .align-self-lg-stretch
    • -
    • .align-self-xl-start
    • -
    • .align-self-xl-end
    • -
    • .align-self-xl-center
    • -
    • .align-self-xl-baseline
    • -
    • .align-self-xl-stretch
    • -
    • .align-self-xxl-start
    • -
    • .align-self-xxl-end
    • -
    • .align-self-xxl-center
    • -
    • .align-self-xxl-baseline
    • -
    • .align-self-xxl-stretch
    • -
    - -

    Fill

    +
    Flex item
    Aligned flex item
    Flex item
    Flex item
    Aligned flex item
    Flex item
    Flex item
    Aligned flex item
    Flex item
    Flex item
    Aligned flex item
    Flex item
    Flex item
    Aligned flex item
    Flex item
    +
    <div class="align-self-start">Aligned flex item</div>
    +<div class="align-self-end">Aligned flex item</div>
    +<div class="align-self-center">Aligned flex item</div>
    +<div class="align-self-baseline">Aligned flex item</div>
    +<div class="align-self-stretch">Aligned flex item</div>
    +
    +

    Responsive variations also exist for align-self.

    +
    • .align-self-start
    • .align-self-end
    • .align-self-center
    • .align-self-baseline
    • .align-self-stretch
    • .align-self-sm-start
    • .align-self-sm-end
    • .align-self-sm-center
    • .align-self-sm-baseline
    • .align-self-sm-stretch
    • .align-self-md-start
    • .align-self-md-end
    • .align-self-md-center
    • .align-self-md-baseline
    • .align-self-md-stretch
    • .align-self-lg-start
    • .align-self-lg-end
    • .align-self-lg-center
    • .align-self-lg-baseline
    • .align-self-lg-stretch
    • .align-self-xl-start
    • .align-self-xl-end
    • .align-self-xl-center
    • .align-self-xl-baseline
    • .align-self-xl-stretch
    • .align-self-xxl-start
    • .align-self-xxl-end
    • .align-self-xxl-center
    • .align-self-xxl-baseline
    • .align-self-xxl-stretch
    +

    Fill

    Use the .flex-fill class on a series of sibling elements to force them into widths equal to their content (or equal widths if their content does not surpass their border-boxes) while taking up all available horizontal space.

    -
    -
    - -
    +
    Flex item with a lot of content
    Flex item
    Flex item
    -
    - -
    - html -
    - - -
    -
    <div class="d-flex">
    -  <div class="p-2 flex-fill">Flex item with a lot of content</div>
    -  <div class="p-2 flex-fill">Flex item</div>
    -  <div class="p-2 flex-fill">Flex item</div>
    -</div>
    -
    - +
    html
    <div class="d-flex">
    +  <div class="p-2 flex-fill">Flex item with a lot of content</div>
    +  <div class="p-2 flex-fill">Flex item</div>
    +  <div class="p-2 flex-fill">Flex item</div>
    +</div>

    Responsive variations also exist for flex-fill.

    -
      -
    • .flex-fill
    • -
    • .flex-sm-fill
    • -
    • .flex-md-fill
    • -
    • .flex-lg-fill
    • -
    • .flex-xl-fill
    • -
    • .flex-xxl-fill
    • -
    - -

    Grow and shrink

    -

    Use .flex-grow-* utilities to toggle a flex item’s ability to grow to fill available space. In the example below, the .flex-grow-1 elements uses all available space it can, while allowing the remaining two flex items their necessary space.

    -
    -
    - -
    +
    • .flex-fill
    • .flex-sm-fill
    • .flex-md-fill
    • .flex-lg-fill
    • .flex-xl-fill
    • .flex-xxl-fill
    +

    Grow and shrink

    +

    Use .flex-grow-* utilities to toggle a flex item’s ability to grow to fill available space. In the example below, the .flex-grow-1 elements uses all available space it can, while allowing the remaining two flex items their necessary space.

    +
    Flex item
    Flex item
    Third flex item
    -
    - -
    - html -
    - - -
    -
    <div class="d-flex">
    -  <div class="p-2 flex-grow-1">Flex item</div>
    -  <div class="p-2">Flex item</div>
    -  <div class="p-2">Third flex item</div>
    -</div>
    -
    - -

    Use .flex-shrink-* utilities to toggle a flex item’s ability to shrink if necessary. In the example below, the second flex item with .flex-shrink-1 is forced to wrap its contents to a new line, “shrinking” to allow more space for the previous flex item with .w-100.

    -
    -
    - -
    +
    html
    <div class="d-flex">
    +  <div class="p-2 flex-grow-1">Flex item</div>
    +  <div class="p-2">Flex item</div>
    +  <div class="p-2">Third flex item</div>
    +</div>
    +

    Use .flex-shrink-* utilities to toggle a flex item’s ability to shrink if necessary. In the example below, the second flex item with .flex-shrink-1 is forced to wrap its contents to a new line, “shrinking” to allow more space for the previous flex item with .w-100.

    +
    Flex item
    Flex item
    -
    - -
    - html -
    - - -
    -
    <div class="d-flex">
    -  <div class="p-2 w-100">Flex item</div>
    -  <div class="p-2 flex-shrink-1">Flex item</div>
    -</div>
    -
    - +
    html
    <div class="d-flex">
    +  <div class="p-2 w-100">Flex item</div>
    +  <div class="p-2 flex-shrink-1">Flex item</div>
    +</div>

    Responsive variations also exist for flex-grow and flex-shrink.

    -
      -
    • .flex-{grow|shrink}-0
    • -
    • .flex-{grow|shrink}-1
    • -
    • .flex-sm-{grow|shrink}-0
    • -
    • .flex-sm-{grow|shrink}-1
    • -
    • .flex-md-{grow|shrink}-0
    • -
    • .flex-md-{grow|shrink}-1
    • -
    • .flex-lg-{grow|shrink}-0
    • -
    • .flex-lg-{grow|shrink}-1
    • -
    • .flex-xl-{grow|shrink}-0
    • -
    • .flex-xl-{grow|shrink}-1
    • -
    • .flex-xxl-{grow|shrink}-0
    • -
    • .flex-xxl-{grow|shrink}-1
    • -
    - -

    Auto margins

    +
    • .flex-{grow|shrink}-0
    • .flex-{grow|shrink}-1
    • .flex-sm-{grow|shrink}-0
    • .flex-sm-{grow|shrink}-1
    • .flex-md-{grow|shrink}-0
    • .flex-md-{grow|shrink}-1
    • .flex-lg-{grow|shrink}-0
    • .flex-lg-{grow|shrink}-1
    • .flex-xl-{grow|shrink}-0
    • .flex-xl-{grow|shrink}-1
    • .flex-xxl-{grow|shrink}-0
    • .flex-xxl-{grow|shrink}-1
    +

    Auto margins

    Flexbox can do some pretty awesome things when you mix flex alignments with auto margins. Shown below are three examples of controlling flex items via auto margins: default (no auto margin), pushing two items to the right (.me-auto), and pushing two items to the left (.ms-auto).

    -
    -
    - -
    +
    Flex item
    Flex item
    Flex item
    @@ -1076,43 +157,26 @@
    Flex item
    Flex item
    Flex item
    -
    +
    html
    <div class="d-flex mb-3">
    +  <div class="p-2">Flex item</div>
    +  <div class="p-2">Flex item</div>
    +  <div class="p-2">Flex item</div>
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="d-flex mb-3">
    -  <div class="p-2">Flex item</div>
    -  <div class="p-2">Flex item</div>
    -  <div class="p-2">Flex item</div>
    -</div>
    -
    -<div class="d-flex mb-3">
    -  <div class="me-auto p-2">Flex item</div>
    -  <div class="p-2">Flex item</div>
    -  <div class="p-2">Flex item</div>
    -</div>
    -
    -<div class="d-flex mb-3">
    -  <div class="p-2">Flex item</div>
    -  <div class="p-2">Flex item</div>
    -  <div class="ms-auto p-2">Flex item</div>
    -</div>
    -
    +<div class="d-flex mb-3"> + <div class="me-auto p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> +</div> -

    With align-items

    +<div class="d-flex mb-3"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="ms-auto p-2">Flex item</div> +</div>
    +

    With align-items

    Vertically move one flex item to the top or bottom of a container by mixing align-items, flex-direction: column, and margin-top: auto or margin-bottom: auto.

    -
    -
    - -
    +
    Flex item
    Flex item
    Flex item
    @@ -1122,606 +186,210 @@
    Flex item
    Flex item
    Flex item
    -
    +
    html
    <div class="d-flex align-items-start flex-column mb-3" style="height: 200px;">
    +  <div class="mb-auto p-2">Flex item</div>
    +  <div class="p-2">Flex item</div>
    +  <div class="p-2">Flex item</div>
    +</div>
     
    -  
    - html -
    - - -
    -
    <div class="d-flex align-items-start flex-column mb-3" style="height: 200px;">
    -  <div class="mb-auto p-2">Flex item</div>
    -  <div class="p-2">Flex item</div>
    -  <div class="p-2">Flex item</div>
    -</div>
    -
    -<div class="d-flex align-items-end flex-column mb-3" style="height: 200px;">
    -  <div class="p-2">Flex item</div>
    -  <div class="p-2">Flex item</div>
    -  <div class="mt-auto p-2">Flex item</div>
    -</div>
    -
    - -

    Wrap

    +<div class="d-flex align-items-end flex-column mb-3" style="height: 200px;"> + <div class="p-2">Flex item</div> + <div class="p-2">Flex item</div> + <div class="mt-auto p-2">Flex item</div> +</div>
    +

    Wrap

    Change how flex items wrap in a flex container. Choose from no wrapping at all (the browser default) with .flex-nowrap, wrapping with .flex-wrap, or reverse wrapping with .flex-wrap-reverse.

    -
    -
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    -
    -
    <div class="d-flex flex-nowrap">
    -  ...
    -</div>
    -
    -
    -
    Flex item 1
    -
    Flex item 2
    -
    Flex item 3
    -
    Flex item 4
    -
    Flex item 5
    -
    Flex item 6
    -
    Flex item 7
    -
    Flex item 8
    -
    Flex item 9
    -
    Flex item 10
    -
    Flex item 11
    -
    Flex item 12
    -
    Flex item 13
    -
    Flex item 14
    -
    -
    -
    <div class="d-flex flex-wrap">
    -  ...
    -</div>
    -
    -
    -
    Flex item 1
    -
    Flex item 2
    -
    Flex item 3
    -
    Flex item 4
    -
    Flex item 5
    -
    Flex item 6
    -
    Flex item 7
    -
    Flex item 8
    -
    Flex item 9
    -
    Flex item 10
    -
    Flex item 11
    -
    Flex item 12
    -
    Flex item 13
    -
    Flex item 14
    -
    -
    -
    <div class="d-flex flex-wrap-reverse">
    -  ...
    -</div>
    -

    Responsive variations also exist for flex-wrap.

    -
      -
    • .flex-nowrap
    • -
    • .flex-wrap
    • -
    • .flex-wrap-reverse
    • -
    • .flex-sm-nowrap
    • -
    • .flex-sm-wrap
    • -
    • .flex-sm-wrap-reverse
    • -
    • .flex-md-nowrap
    • -
    • .flex-md-wrap
    • -
    • .flex-md-wrap-reverse
    • -
    • .flex-lg-nowrap
    • -
    • .flex-lg-wrap
    • -
    • .flex-lg-wrap-reverse
    • -
    • .flex-xl-nowrap
    • -
    • .flex-xl-wrap
    • -
    • .flex-xl-wrap-reverse
    • -
    • .flex-xxl-nowrap
    • -
    • .flex-xxl-wrap
    • -
    • .flex-xxl-wrap-reverse
    • -
    - -

    Order

    +
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    +
    <div class="d-flex flex-nowrap">
    +  ...
    +</div>
    +
    +
    Flex item 1
    Flex item 2
    Flex item 3
    Flex item 4
    Flex item 5
    Flex item 6
    Flex item 7
    Flex item 8
    Flex item 9
    Flex item 10
    Flex item 11
    Flex item 12
    Flex item 13
    Flex item 14
    +
    <div class="d-flex flex-wrap">
    +  ...
    +</div>
    +
    +
    Flex item 1
    Flex item 2
    Flex item 3
    Flex item 4
    Flex item 5
    Flex item 6
    Flex item 7
    Flex item 8
    Flex item 9
    Flex item 10
    Flex item 11
    Flex item 12
    Flex item 13
    Flex item 14
    +
    <div class="d-flex flex-wrap-reverse">
    +  ...
    +</div>
    +
    +

    Responsive variations also exist for flex-wrap.

    +
    • .flex-nowrap
    • .flex-wrap
    • .flex-wrap-reverse
    • .flex-sm-nowrap
    • .flex-sm-wrap
    • .flex-sm-wrap-reverse
    • .flex-md-nowrap
    • .flex-md-wrap
    • .flex-md-wrap-reverse
    • .flex-lg-nowrap
    • .flex-lg-wrap
    • .flex-lg-wrap-reverse
    • .flex-xl-nowrap
    • .flex-xl-wrap
    • .flex-xl-wrap-reverse
    • .flex-xxl-nowrap
    • .flex-xxl-wrap
    • .flex-xxl-wrap-reverse
    +

    Order

    Change the visual order of specific flex items with a handful of order utilities. We only provide options for making an item first or last, as well as a reset to use the DOM order. As order takes any integer value from 0 to 5, add custom CSS for any additional values needed.

    -
    -
    - -
    +
    First flex item
    Second flex item
    Third flex item
    -
    - -
    - html -
    - - -
    -
    <div class="d-flex flex-nowrap">
    -  <div class="order-3 p-2">First flex item</div>
    -  <div class="order-2 p-2">Second flex item</div>
    -  <div class="order-1 p-2">Third flex item</div>
    -</div>
    -
    - +
    html
    <div class="d-flex flex-nowrap">
    +  <div class="order-3 p-2">First flex item</div>
    +  <div class="order-2 p-2">Second flex item</div>
    +  <div class="order-1 p-2">Third flex item</div>
    +</div>

    Responsive variations also exist for order.

    -
      -
    • .order-0
    • -
    • .order-1
    • -
    • .order-2
    • -
    • .order-3
    • -
    • .order-4
    • -
    • .order-5
    • -
    • .order-sm-0
    • -
    • .order-sm-1
    • -
    • .order-sm-2
    • -
    • .order-sm-3
    • -
    • .order-sm-4
    • -
    • .order-sm-5
    • -
    • .order-md-0
    • -
    • .order-md-1
    • -
    • .order-md-2
    • -
    • .order-md-3
    • -
    • .order-md-4
    • -
    • .order-md-5
    • -
    • .order-lg-0
    • -
    • .order-lg-1
    • -
    • .order-lg-2
    • -
    • .order-lg-3
    • -
    • .order-lg-4
    • -
    • .order-lg-5
    • -
    • .order-xl-0
    • -
    • .order-xl-1
    • -
    • .order-xl-2
    • -
    • .order-xl-3
    • -
    • .order-xl-4
    • -
    • .order-xl-5
    • -
    • .order-xxl-0
    • -
    • .order-xxl-1
    • -
    • .order-xxl-2
    • -
    • .order-xxl-3
    • -
    • .order-xxl-4
    • -
    • .order-xxl-5
    • -
    - +
    • .order-0
    • .order-1
    • .order-2
    • .order-3
    • .order-4
    • .order-5
    • .order-sm-0
    • .order-sm-1
    • .order-sm-2
    • .order-sm-3
    • .order-sm-4
    • .order-sm-5
    • .order-md-0
    • .order-md-1
    • .order-md-2
    • .order-md-3
    • .order-md-4
    • .order-md-5
    • .order-lg-0
    • .order-lg-1
    • .order-lg-2
    • .order-lg-3
    • .order-lg-4
    • .order-lg-5
    • .order-xl-0
    • .order-xl-1
    • .order-xl-2
    • .order-xl-3
    • .order-xl-4
    • .order-xl-5
    • .order-xxl-0
    • .order-xxl-1
    • .order-xxl-2
    • .order-xxl-3
    • .order-xxl-4
    • .order-xxl-5

    Additionally there are also responsive .order-first and .order-last classes that change the order of an element by applying order: -1 and order: 6, respectively.

    -
      -
    • .order-first
    • -
    • .order-last
    • -
    • .order-sm-first
    • -
    • .order-sm-last
    • -
    • .order-md-first
    • -
    • .order-md-last
    • -
    • .order-lg-first
    • -
    • .order-lg-last
    • -
    • .order-xl-first
    • -
    • .order-xl-last
    • -
    • .order-xxl-first
    • -
    • .order-xxl-last
    • -
    - -

    Align content

    -

    Use align-content utilities on flexbox containers to align flex items together on the cross axis. Choose from start (browser default), end, center, between, around, or stretch. To demonstrate these utilities, we’ve enforced flex-wrap: wrap and increased the number of flex items.

    +
    • .order-first
    • .order-last
    • .order-sm-first
    • .order-sm-last
    • .order-md-first
    • .order-md-last
    • .order-lg-first
    • .order-lg-last
    • .order-xl-first
    • .order-xl-last
    • .order-xxl-first
    • .order-xxl-last
    +

    Align content

    +

    Use align-content utilities on flexbox containers to align flex items together on the cross axis. Choose from start (browser default), end, center, between, around, or stretch. To demonstrate these utilities, we’ve enforced flex-wrap: wrap and increased the number of flex items.

    Heads up! This property has no effect on single rows of flex items.

    -
    -
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    -
    -
    <div class="d-flex align-content-start flex-wrap">
    -  ...
    -</div>
    -
    -
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    -
    -
    <div class="d-flex align-content-end flex-wrap">...</div>
    -
    -
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    -
    -
    <div class="d-flex align-content-center flex-wrap">...</div>
    -
    -
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    -
    -
    <div class="d-flex align-content-between flex-wrap">...</div>
    -
    -
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    -
    -
    <div class="d-flex align-content-around flex-wrap">...</div>
    -
    -
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    Flex item
    -
    -
    -
    <div class="d-flex align-content-stretch flex-wrap">...</div>
    -

    Responsive variations also exist for align-content.

    -
      -
    • .align-content-start
    • -
    • .align-content-end
    • -
    • .align-content-center
    • -
    • .align-content-between
    • -
    • .align-content-around
    • -
    • .align-content-stretch
    • -
    • .align-content-sm-start
    • -
    • .align-content-sm-end
    • -
    • .align-content-sm-center
    • -
    • .align-content-sm-between
    • -
    • .align-content-sm-around
    • -
    • .align-content-sm-stretch
    • -
    • .align-content-md-start
    • -
    • .align-content-md-end
    • -
    • .align-content-md-center
    • -
    • .align-content-md-between
    • -
    • .align-content-md-around
    • -
    • .align-content-md-stretch
    • -
    • .align-content-lg-start
    • -
    • .align-content-lg-end
    • -
    • .align-content-lg-center
    • -
    • .align-content-lg-between
    • -
    • .align-content-lg-around
    • -
    • .align-content-lg-stretch
    • -
    • .align-content-xl-start
    • -
    • .align-content-xl-end
    • -
    • .align-content-xl-center
    • -
    • .align-content-xl-between
    • -
    • .align-content-xl-around
    • -
    • .align-content-xl-stretch
    • -
    • .align-content-xxl-start
    • -
    • .align-content-xxl-end
    • -
    • .align-content-xxl-center
    • -
    • .align-content-xxl-between
    • -
    • .align-content-xxl-around
    • -
    • .align-content-xxl-stretch
    • -
    - -

    Media object

    +
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    +
    <div class="d-flex align-content-start flex-wrap">
    +  ...
    +</div>
    +
    +
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    +
    <div class="d-flex align-content-end flex-wrap">...</div>
    +
    +
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    +
    <div class="d-flex align-content-center flex-wrap">...</div>
    +
    +
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    +
    <div class="d-flex align-content-between flex-wrap">...</div>
    +
    +
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    +
    <div class="d-flex align-content-around flex-wrap">...</div>
    +
    +
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    Flex item
    +
    <div class="d-flex align-content-stretch flex-wrap">...</div>
    +
    +

    Responsive variations also exist for align-content.

    +
    • .align-content-start
    • .align-content-end
    • .align-content-center
    • .align-content-between
    • .align-content-around
    • .align-content-stretch
    • .align-content-sm-start
    • .align-content-sm-end
    • .align-content-sm-center
    • .align-content-sm-between
    • .align-content-sm-around
    • .align-content-sm-stretch
    • .align-content-md-start
    • .align-content-md-end
    • .align-content-md-center
    • .align-content-md-between
    • .align-content-md-around
    • .align-content-md-stretch
    • .align-content-lg-start
    • .align-content-lg-end
    • .align-content-lg-center
    • .align-content-lg-between
    • .align-content-lg-around
    • .align-content-lg-stretch
    • .align-content-xl-start
    • .align-content-xl-end
    • .align-content-xl-center
    • .align-content-xl-between
    • .align-content-xl-around
    • .align-content-xl-stretch
    • .align-content-xxl-start
    • .align-content-xxl-end
    • .align-content-xxl-center
    • .align-content-xxl-between
    • .align-content-xxl-around
    • .align-content-xxl-stretch
    +

    Media object

    Looking to replicate the media object component from Bootstrap 4? Recreate it in no time with a few flex utilities that allow even more flexibility and customization than before.

    -
    -
    - -
    +
    - PlaceholderImage + PlaceholderImage
    This is some content from a media component. You can replace this with any content and adjust it as needed.
    -
    - -
    - html -
    - - -
    -
    <div class="d-flex">
    -  <div class="flex-shrink-0">
    -    <img src="..." alt="...">
    -  </div>
    -  <div class="flex-grow-1 ms-3">
    -    This is some content from a media component. You can replace this with any content and adjust it as needed.
    -  </div>
    -</div>
    -
    - +
    html
    <div class="d-flex">
    +  <div class="flex-shrink-0">
    +    <img src="..." alt="...">
    +  </div>
    +  <div class="flex-grow-1 ms-3">
    +    This is some content from a media component. You can replace this with any content and adjust it as needed.
    +  </div>
    +</div>

    And say you want to vertically center the content next to the image:

    -
    -
    - -
    +
    - PlaceholderImage + PlaceholderImage
    This is some content from a media component. You can replace this with any content and adjust it as needed.
    -
    - -
    - html -
    - - -
    -
    <div class="d-flex align-items-center">
    -  <div class="flex-shrink-0">
    -    <img src="..." alt="...">
    -  </div>
    -  <div class="flex-grow-1 ms-3">
    -    This is some content from a media component. You can replace this with any content and adjust it as needed.
    -  </div>
    -</div>
    -
    - -

    CSS

    -

    Sass utilities API

    -

    Flexbox utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "flex": (
    -  responsive: true,
    -  property: flex,
    -  values: (fill: 1 1 auto)
    -),
    -"flex-direction": (
    -  responsive: true,
    -  property: flex-direction,
    -  class: flex,
    -  values: row column row-reverse column-reverse
    -),
    -"flex-grow": (
    -  responsive: true,
    -  property: flex-grow,
    -  class: flex,
    -  values: (
    -    grow-0: 0,
    -    grow-1: 1,
    -  )
    -),
    -"flex-shrink": (
    -  responsive: true,
    -  property: flex-shrink,
    -  class: flex,
    -  values: (
    -    shrink-0: 0,
    -    shrink-1: 1,
    -  )
    -),
    -"flex-wrap": (
    -  responsive: true,
    -  property: flex-wrap,
    -  class: flex,
    -  values: wrap nowrap wrap-reverse
    -),
    -"justify-content": (
    -  responsive: true,
    -  property: justify-content,
    -  values: (
    -    start: flex-start,
    -    end: flex-end,
    -    center: center,
    -    between: space-between,
    -    around: space-around,
    -    evenly: space-evenly,
    -  )
    -),
    -"align-items": (
    -  responsive: true,
    -  property: align-items,
    -  values: (
    -    start: flex-start,
    -    end: flex-end,
    -    center: center,
    -    baseline: baseline,
    -    stretch: stretch,
    -  )
    -),
    -"align-content": (
    -  responsive: true,
    -  property: align-content,
    -  values: (
    -    start: flex-start,
    -    end: flex-end,
    -    center: center,
    -    between: space-between,
    -    around: space-around,
    -    stretch: stretch,
    -  )
    -),
    -"align-self": (
    -  responsive: true,
    -  property: align-self,
    -  values: (
    -    auto: auto,
    -    start: flex-start,
    -    end: flex-end,
    -    center: center,
    -    baseline: baseline,
    -    stretch: stretch,
    -  )
    -),
    -"order": (
    -  responsive: true,
    -  property: order,
    -  values: (
    -    first: -1,
    -    0: 0,
    -    1: 1,
    -    2: 2,
    -    3: 3,
    -    4: 4,
    -    5: 5,
    -    last: 6,
    -  ),
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    html
    <div class="d-flex align-items-center">
    +  <div class="flex-shrink-0">
    +    <img src="..." alt="...">
    +  </div>
    +  <div class="flex-grow-1 ms-3">
    +    This is some content from a media component. You can replace this with any content and adjust it as needed.
    +  </div>
    +</div>
    +

    CSS

    +

    Sass utilities API

    +

    Flexbox utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "flex": (
    +  responsive: true,
    +  property: flex,
    +  values: (fill: 1 1 auto)
    +),
    +"flex-direction": (
    +  responsive: true,
    +  property: flex-direction,
    +  class: flex,
    +  values: row column row-reverse column-reverse
    +),
    +"flex-grow": (
    +  responsive: true,
    +  property: flex-grow,
    +  class: flex,
    +  values: (
    +    grow-0: 0,
    +    grow-1: 1,
    +  )
    +),
    +"flex-shrink": (
    +  responsive: true,
    +  property: flex-shrink,
    +  class: flex,
    +  values: (
    +    shrink-0: 0,
    +    shrink-1: 1,
    +  )
    +),
    +"flex-wrap": (
    +  responsive: true,
    +  property: flex-wrap,
    +  class: flex,
    +  values: wrap nowrap wrap-reverse
    +),
    +"justify-content": (
    +  responsive: true,
    +  property: justify-content,
    +  values: (
    +    start: flex-start,
    +    end: flex-end,
    +    center: center,
    +    between: space-between,
    +    around: space-around,
    +    evenly: space-evenly,
    +  )
    +),
    +"align-items": (
    +  responsive: true,
    +  property: align-items,
    +  values: (
    +    start: flex-start,
    +    end: flex-end,
    +    center: center,
    +    baseline: baseline,
    +    stretch: stretch,
    +  )
    +),
    +"align-content": (
    +  responsive: true,
    +  property: align-content,
    +  values: (
    +    start: flex-start,
    +    end: flex-end,
    +    center: center,
    +    between: space-between,
    +    around: space-around,
    +    stretch: stretch,
    +  )
    +),
    +"align-self": (
    +  responsive: true,
    +  property: align-self,
    +  values: (
    +    auto: auto,
    +    start: flex-start,
    +    end: flex-end,
    +    center: center,
    +    baseline: baseline,
    +    stretch: stretch,
    +  )
    +),
    +"order": (
    +  responsive: true,
    +  property: order,
    +  values: (
    +    first: -1,
    +    0: 0,
    +    1: 1,
    +    2: 2,
    +    3: 3,
    +    4: 4,
    +    5: 5,
    +    last: 6,
    +  ),
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/float/index.html b/docs/5.3/utilities/float/index.html index 1b711de213..cfbe175008 100644 --- a/docs/5.3/utilities/float/index.html +++ b/docs/5.3/utilities/float/index.html @@ -1,734 +1,61 @@ - - - - - - - - - - - - - - - - -Float · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Float

    -
    -

    Toggle floats on any element, across any breakpoint, using our responsive float utilities.

    - - -
    - - -
    - - On this page -
    -
    - -
    -
    - - -
    - - -

    Overview

    + Float · Bootstrap v5.3

    Toggle floats on any element, across any breakpoint, using our responsive float utilities.

    +
    On this page

    Overview

    These utility classes float an element to the left or right, or disable floating, based on the current viewport size using the CSS float property. !important is included to avoid specificity issues. These use the same viewport breakpoints as our grid system. Please be aware float utilities have no effect on flex items.

    -
    -
    - -
    Float start on all viewport sizes

    +
    Float start on all viewport sizes

    Float end on all viewport sizes

    -
    Don't float on all viewport sizes
    - -
    - html -
    - - -
    -
    <div class="float-start">Float start on all viewport sizes</div><br>
    -<div class="float-end">Float end on all viewport sizes</div><br>
    -<div class="float-none">Don't float on all viewport sizes</div>
    -
    - -

    Use the clearfix helper on a parent element to clear floats.

    -

    Responsive

    +
    Don’t float on all viewport sizes
    html
    <div class="float-start">Float start on all viewport sizes</div><br>
    +<div class="float-end">Float end on all viewport sizes</div><br>
    +<div class="float-none">Don’t float on all viewport sizes</div>
    +

    Use the clearfix helper on a parent element to clear floats.

    +

    Responsive

    Responsive variations also exist for each float value.

    -
    -
    - -
    Float end on viewports sized SM (small) or wider

    +
    Float end on viewports sized SM (small) or wider

    Float end on viewports sized MD (medium) or wider

    Float end on viewports sized LG (large) or wider

    Float end on viewports sized XL (extra large) or wider

    -
    Float end on viewports sized XXL (extra extra large) or wider

    - -
    - html -
    - - -
    -
    <div class="float-sm-end">Float end on viewports sized SM (small) or wider</div><br>
    -<div class="float-md-end">Float end on viewports sized MD (medium) or wider</div><br>
    -<div class="float-lg-end">Float end on viewports sized LG (large) or wider</div><br>
    -<div class="float-xl-end">Float end on viewports sized XL (extra large) or wider</div><br>
    -<div class="float-xxl-end">Float end on viewports sized XXL (extra extra large) or wider</div><br>
    -
    - +
    Float end on viewports sized XXL (extra extra large) or wider

    html
    <div class="float-sm-end">Float end on viewports sized SM (small) or wider</div><br>
    +<div class="float-md-end">Float end on viewports sized MD (medium) or wider</div><br>
    +<div class="float-lg-end">Float end on viewports sized LG (large) or wider</div><br>
    +<div class="float-xl-end">Float end on viewports sized XL (extra large) or wider</div><br>
    +<div class="float-xxl-end">Float end on viewports sized XXL (extra extra large) or wider</div><br>

    Here are all the support classes:

    -
      -
    • .float-start
    • -
    • .float-end
    • -
    • .float-none
    • -
    • .float-sm-start
    • -
    • .float-sm-end
    • -
    • .float-sm-none
    • -
    • .float-md-start
    • -
    • .float-md-end
    • -
    • .float-md-none
    • -
    • .float-lg-start
    • -
    • .float-lg-end
    • -
    • .float-lg-none
    • -
    • .float-xl-start
    • -
    • .float-xl-end
    • -
    • .float-xl-none
    • -
    • .float-xxl-start
    • -
    • .float-xxl-end
    • -
    • .float-xxl-none
    • -
    - -

    CSS

    -

    Sass utilities API

    -

    Float utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "float": (
    -  responsive: true,
    -  property: float,
    -  values: (
    -    start: left,
    -    end: right,
    -    none: none,
    -  )
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    • .float-start
    • .float-end
    • .float-none
    • .float-sm-start
    • .float-sm-end
    • .float-sm-none
    • .float-md-start
    • .float-md-end
    • .float-md-none
    • .float-lg-start
    • .float-lg-end
    • .float-lg-none
    • .float-xl-start
    • .float-xl-end
    • .float-xl-none
    • .float-xxl-start
    • .float-xxl-end
    • .float-xxl-none
    +

    CSS

    +

    Sass utilities API

    +

    Float utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "float": (
    +  responsive: true,
    +  property: float,
    +  values: (
    +    start: left,
    +    end: right,
    +    none: none,
    +  )
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/index.html b/docs/5.3/utilities/index.html index 1cf1d97f53..887d1aa426 100644 --- a/docs/5.3/utilities/index.html +++ b/docs/5.3/utilities/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/utilities/api/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/5.3/utilities/interactions/index.html b/docs/5.3/utilities/interactions/index.html index dc8e5c8c21..be282b03cc 100644 --- a/docs/5.3/utilities/interactions/index.html +++ b/docs/5.3/utilities/interactions/index.html @@ -1,691 +1,58 @@ - - - - - - - - - - - - - - - - -Interactions · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Interactions

    -
    -

    Utility classes that change how users interact with contents of a website.

    - - -
    - - - -
    - - -

    Text selection

    + Interactions · Bootstrap v5.3

    Interactions

    Utility classes that change how users interact with contents of a website.

    +

    Text selection

    Change the way in which the content is selected when the user interacts with it.

    -
    -
    - -

    This paragraph will be entirely selected when clicked by the user.

    +

    This paragraph will be entirely selected when clicked by the user.

    This paragraph has default select behavior.

    -

    This paragraph will not be selectable when clicked by the user.

    - -
    - html -
    - - -
    -
    <p class="user-select-all">This paragraph will be entirely selected when clicked by the user.</p>
    -<p class="user-select-auto">This paragraph has default select behavior.</p>
    -<p class="user-select-none">This paragraph will not be selectable when clicked by the user.</p>
    -
    - -

    Pointer events

    +

    This paragraph will not be selectable when clicked by the user.

    html
    <p class="user-select-all">This paragraph will be entirely selected when clicked by the user.</p>
    +<p class="user-select-auto">This paragraph has default select behavior.</p>
    +<p class="user-select-none">This paragraph will not be selectable when clicked by the user.</p>
    +

    Pointer events

    Bootstrap provides .pe-none and .pe-auto classes to prevent or add element interactions.

    -
    -
    - -

    This link can not be clicked.

    +

    This link can not be clicked.

    This link can be clicked (this is default behavior).

    -

    This link can not be clicked because the pointer-events property is inherited from its parent. However, this link has a pe-auto class and can be clicked.

    - -
    - html -
    - - -
    -
    <p><a href="#" class="pe-none" tabindex="-1" aria-disabled="true">This link</a> can not be clicked.</p>
    -<p><a href="#" class="pe-auto">This link</a> can be clicked (this is default behavior).</p>
    -<p class="pe-none"><a href="#" tabindex="-1" aria-disabled="true">This link</a> can not be clicked because the <code>pointer-events</code> property is inherited from its parent. However, <a href="#" class="pe-auto">this link</a> has a <code>pe-auto</code> class and can be clicked.</p>
    -
    - +

    This link can not be clicked because the pointer-events property is inherited from its parent. However, this link has a pe-auto class and can be clicked.

    html
    <p><a href="#" class="pe-none" tabindex="-1" aria-disabled="true">This link</a> can not be clicked.</p>
    +<p><a href="#" class="pe-auto">This link</a> can be clicked (this is default behavior).</p>
    +<p class="pe-none"><a href="#" tabindex="-1" aria-disabled="true">This link</a> can not be clicked because the <code>pointer-events</code> property is inherited from its parent. However, <a href="#" class="pe-auto">this link</a> has a <code>pe-auto</code> class and can be clicked.</p>

    The .pe-none class (and the pointer-events CSS property it sets) only prevents interactions with a pointer (mouse, stylus, touch). Links and controls with .pe-none are, by default, still focusable and actionable for keyboard users. To ensure that they are completely neutralized even for keyboard users, you may need to add further attributes such as tabindex="-1" (to prevent them from receiving keyboard focus) and aria-disabled="true" (to convey the fact they are effectively disabled to assistive technologies), and possibly use JavaScript to completely prevent them from being actionable.

    If possible, the simpler solution is:

    • For form controls, add the disabled HTML attribute.
    • For links, remove the href attribute, making it a non-interactive anchor or placeholder link.
    -

    CSS

    -

    Sass utilities API

    -

    Interaction utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "user-select": (
    -  property: user-select,
    -  values: all auto none
    -),
    -"pointer-events": (
    -  property: pointer-events,
    -  class: pe,
    -  values: none auto,
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +

    CSS

    +

    Sass utilities API

    +

    Interaction utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "user-select": (
    +  property: user-select,
    +  values: all auto none
    +),
    +"pointer-events": (
    +  property: pointer-events,
    +  class: pe,
    +  values: none auto,
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/link/index.html b/docs/5.3/utilities/link/index.html index dfb93c2f44..75a359f922 100644 --- a/docs/5.3/utilities/link/index.html +++ b/docs/5.3/utilities/link/index.html @@ -1,751 +1,92 @@ - - - - - - - - - - - - - - - - -Link · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    -
    Added in v5.3 - View on GitHub - -
    -

    Link

    -
    -

    Link utilities are used to stylize your anchors to adjust their color, opacity, underline offset, underline color, and more.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - - -

    Change the alpha opacity of the link rgba() color value with utilities. Please be aware that changes to a color’s opacity can lead to links with insufficient contrast.

    -
    -
    - -

    Link opacity 10

    + Link · Bootstrap v5.3
    +Added in v5.3 +View on GitHub +

    Link

    Link utilities are used to stylize your anchors to adjust their color, opacity, underline offset, underline color, and more.

    +
    +

    Change the alpha opacity of the link rgba() color value with utilities. Please be aware that changes to a color’s opacity can lead to links with insufficient contrast.

    +
    - html -
    - - -
    -
    <p><a class="link-opacity-10" href="#">Link opacity 10</a></p>
    -<p><a class="link-opacity-25" href="#">Link opacity 25</a></p>
    -<p><a class="link-opacity-50" href="#">Link opacity 50</a></p>
    -<p><a class="link-opacity-75" href="#">Link opacity 75</a></p>
    -<p><a class="link-opacity-100" href="#">Link opacity 100</a></p>
    -
    - +

    Link opacity 100

    html
    <p><a class="link-opacity-10" href="#">Link opacity 10</a></p>
    +<p><a class="link-opacity-25" href="#">Link opacity 25</a></p>
    +<p><a class="link-opacity-50" href="#">Link opacity 50</a></p>
    +<p><a class="link-opacity-75" href="#">Link opacity 75</a></p>
    +<p><a class="link-opacity-100" href="#">Link opacity 100</a></p>

    You can even change the opacity level on hover.

    -
    -
    - -

    Link hover opacity 10

    +
    - html -
    - - -
    -
    <p><a class="link-opacity-10-hover" href="#">Link hover opacity 10</a></p>
    -<p><a class="link-opacity-25-hover" href="#">Link hover opacity 25</a></p>
    -<p><a class="link-opacity-50-hover" href="#">Link hover opacity 50</a></p>
    -<p><a class="link-opacity-75-hover" href="#">Link hover opacity 75</a></p>
    -<p><a class="link-opacity-100-hover" href="#">Link hover opacity 100</a></p>
    -
    - - -

    Underline color

    -

    Change the underline’s color independent of the link text color.

    -
    -
    html
    <p><a class="link-opacity-10-hover" href="#">Link hover opacity 10</a></p>
    +<p><a class="link-opacity-25-hover" href="#">Link hover opacity 25</a></p>
    +<p><a class="link-opacity-50-hover" href="#">Link hover opacity 50</a></p>
    +<p><a class="link-opacity-75-hover" href="#">Link hover opacity 75</a></p>
    +<p><a class="link-opacity-100-hover" href="#">Link hover opacity 100</a></p>
    + +

    Underline color

    +

    Change the underline’s color independent of the link text color.

    +
    - html -
    - - -
    -
    <p><a href="#" class="link-underline-primary">Primary underline</a></p>
    -<p><a href="#" class="link-underline-secondary">Secondary underline</a></p>
    -<p><a href="#" class="link-underline-success">Success underline</a></p>
    -<p><a href="#" class="link-underline-danger">Danger underline</a></p>
    -<p><a href="#" class="link-underline-warning">Warning underline</a></p>
    -<p><a href="#" class="link-underline-info">Info underline</a></p>
    -<p><a href="#" class="link-underline-light">Light underline</a></p>
    -<p><a href="#" class="link-underline-dark">Dark underline</a></p>
    -
    - -

    Underline offset

    -

    Change the underline’s distance from your text. Offset is set in em units to automatically scale with the element’s current font-size.

    -
    -
    html
    <p><a href="#" class="link-underline-primary">Primary underline</a></p>
    +<p><a href="#" class="link-underline-secondary">Secondary underline</a></p>
    +<p><a href="#" class="link-underline-success">Success underline</a></p>
    +<p><a href="#" class="link-underline-danger">Danger underline</a></p>
    +<p><a href="#" class="link-underline-warning">Warning underline</a></p>
    +<p><a href="#" class="link-underline-info">Info underline</a></p>
    +<p><a href="#" class="link-underline-light">Light underline</a></p>
    +<p><a href="#" class="link-underline-dark">Dark underline</a></p>
    +

    Underline offset

    +

    Change the underline’s distance from your text. Offset is set in em units to automatically scale with the element’s current font-size.

    +
    - html -
    - - -
    -
    <p><a href="#">Default link</a></p>
    -<p><a class="link-offset-1" href="#">Offset 1 link</a></p>
    -<p><a class="link-offset-2" href="#">Offset 2 link</a></p>
    -<p><a class="link-offset-3" href="#">Offset 3 link</a></p>
    -
    - -

    Underline opacity

    -

    Change the underline’s opacity. Requires adding .link-underline to first set an rgba() color we use to then modify the alpha opacity.

    -
    -
    html
    <p><a href="#">Default link</a></p>
    +<p><a class="link-offset-1" href="#">Offset 1 link</a></p>
    +<p><a class="link-offset-2" href="#">Offset 2 link</a></p>
    +<p><a class="link-offset-3" href="#">Offset 3 link</a></p>
    +

    Underline opacity

    +

    Change the underline’s opacity. Requires adding .link-underline to first set an rgba() color we use to then modify the alpha opacity.

    +
    - html -
    - - -
    -
    <p><a class="link-offset-2 link-underline link-underline-opacity-0" href="#">Underline opacity 0</a></p>
    -<p><a class="link-offset-2 link-underline link-underline-opacity-10" href="#">Underline opacity 10</a></p>
    -<p><a class="link-offset-2 link-underline link-underline-opacity-25" href="#">Underline opacity 25</a></p>
    -<p><a class="link-offset-2 link-underline link-underline-opacity-50" href="#">Underline opacity 50</a></p>
    -<p><a class="link-offset-2 link-underline link-underline-opacity-75" href="#">Underline opacity 75</a></p>
    -<p><a class="link-offset-2 link-underline link-underline-opacity-100" href="#">Underline opacity 100</a></p>
    -
    - -

    Hover variants

    +

    Underline opacity 100

    html
    <p><a class="link-offset-2 link-underline link-underline-opacity-0" href="#">Underline opacity 0</a></p>
    +<p><a class="link-offset-2 link-underline link-underline-opacity-10" href="#">Underline opacity 10</a></p>
    +<p><a class="link-offset-2 link-underline link-underline-opacity-25" href="#">Underline opacity 25</a></p>
    +<p><a class="link-offset-2 link-underline link-underline-opacity-50" href="#">Underline opacity 50</a></p>
    +<p><a class="link-offset-2 link-underline link-underline-opacity-75" href="#">Underline opacity 75</a></p>
    +<p><a class="link-offset-2 link-underline link-underline-opacity-100" href="#">Underline opacity 100</a></p>
    +

    Hover variants

    Just like the .link-opacity-*-hover utilities, .link-offset and .link-underline-opacity utilities include :hover variants by default. Mix and match to create unique link styles.

    -
    -
    - - +
    - html -
    - - -
    -
    <a class="link-offset-2 link-offset-3-hover link-underline link-underline-opacity-0 link-underline-opacity-75-hover" href="#">
    -  Underline opacity 0
    -</a>
    -
    - - +
    html
    <a class="link-offset-2 link-offset-3-hover link-underline link-underline-opacity-0 link-underline-opacity-75-hover" href="#">
    +  Underline opacity 0
    +</a>
    +

    Colored link helpers have been updated to pair with our link utilities. Use the new utilities to modify the link opacity, underline opacity, and underline offset.

    -
    -
    - - -

    Primary link

    +
    - html -
    - - -
    -
    <p><a href="#" class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Primary link</a></p>
    -<p><a href="#" class="link-secondary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Secondary link</a></p>
    -<p><a href="#" class="link-success link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Success link</a></p>
    -<p><a href="#" class="link-danger link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Danger link</a></p>
    -<p><a href="#" class="link-warning link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Warning link</a></p>
    -<p><a href="#" class="link-info link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Info link</a></p>
    -<p><a href="#" class="link-light link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Light link</a></p>
    -<p><a href="#" class="link-dark link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Dark link</a></p>
    -<p><a href="#" class="link-body-emphasis link-offset-2 link-underline-opacity-25 link-underline-opacity-75-hover">Emphasis link</a></p>
    -
    - -
    -Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class. -
    - -

    CSS

    -

    In addition to the following Sass functionality, consider reading about our included CSS custom properties (aka CSS variables) for colors and more.

    -

    Sass utilities API

    -

    Link utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "link-opacity": (
    -  css-var: true,
    -  class: link-opacity,
    -  state: hover,
    -  values: (
    -    10: .1,
    -    25: .25,
    -    50: .5,
    -    75: .75,
    -    100: 1
    -  )
    -),
    -"link-offset": (
    -  property: text-underline-offset,
    -  class: link-offset,
    -  state: hover,
    -  values: (
    -    1: .125em,
    -    2: .25em,
    -    3: .375em,
    -  )
    -),
    -"link-underline": (
    -  property: text-decoration-color,
    -  class: link-underline,
    -  local-vars: (
    -    "link-underline-opacity": 1
    -  ),
    -  values: map-merge(
    -    $utilities-links-underline,
    -    (
    -      null: rgba(var(--#{$prefix}link-color-rgb), var(--#{$prefix}link-underline-opacity, 1)),
    -    )
    -  )
    -),
    -"link-underline-opacity": (
    -  css-var: true,
    -  class: link-underline-opacity,
    -  state: hover,
    -  values: (
    -    0: 0,
    -    10: .1,
    -    25: .25,
    -    50: .5,
    -    75: .75,
    -    100: 1
    -  ),
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +

    Emphasis link

    html
    <p><a href="#" class="link-primary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Primary link</a></p>
    +<p><a href="#" class="link-secondary link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Secondary link</a></p>
    +<p><a href="#" class="link-success link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Success link</a></p>
    +<p><a href="#" class="link-danger link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Danger link</a></p>
    +<p><a href="#" class="link-warning link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Warning link</a></p>
    +<p><a href="#" class="link-info link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Info link</a></p>
    +<p><a href="#" class="link-light link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Light link</a></p>
    +<p><a href="#" class="link-dark link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">Dark link</a></p>
    +<p><a href="#" class="link-body-emphasis link-offset-2 link-underline-opacity-25 link-underline-opacity-75-hover">Emphasis link</a></p>
    +

    Accessibility tip: Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies like screen readers. Please ensure the meaning is obvious from the content itself (e.g., the visible text with a sufficient color contrast) or is included through alternative means, such as additional text hidden with the .visually-hidden class.

    +

    CSS

    +

    In addition to the following Sass functionality, consider reading about our included CSS custom properties (aka CSS variables) for colors and more.

    +

    Sass utilities API

    +

    Link utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "link-opacity": (
    +  css-var: true,
    +  class: link-opacity,
    +  state: hover,
    +  values: (
    +    10: .1,
    +    25: .25,
    +    50: .5,
    +    75: .75,
    +    100: 1
    +  )
    +),
    +"link-offset": (
    +  property: text-underline-offset,
    +  class: link-offset,
    +  state: hover,
    +  values: (
    +    1: .125em,
    +    2: .25em,
    +    3: .375em,
    +  )
    +),
    +"link-underline": (
    +  property: text-decoration-color,
    +  class: link-underline,
    +  local-vars: (
    +    "link-underline-opacity": 1
    +  ),
    +  values: map-merge(
    +    $utilities-links-underline,
    +    (
    +      null: rgba(var(--#{$prefix}link-color-rgb), var(--#{$prefix}link-underline-opacity, 1)),
    +    )
    +  )
    +),
    +"link-underline-opacity": (
    +  css-var: true,
    +  class: link-underline-opacity,
    +  state: hover,
    +  values: (
    +    0: 0,
    +    10: .1,
    +    25: .25,
    +    50: .5,
    +    75: .75,
    +    100: 1
    +  ),
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/object-fit/index.html b/docs/5.3/utilities/object-fit/index.html index ba73e2c20c..ba64ff8986 100644 --- a/docs/5.3/utilities/object-fit/index.html +++ b/docs/5.3/utilities/object-fit/index.html @@ -1,568 +1,22 @@ - - - - - - - - - - - - - - - - -Object fit · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    -
    Added in v5.3 - View on GitHub - -
    -

    Object fit

    -
    -

    Use the object fit utilities to modify how the content of a replaced element, such as an <img> or <video>, should be resized to fit its container.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    How it works

    + Object fit · Bootstrap v5.3
    +Added in v5.3 +View on GitHub +

    Object fit

    Use the object fit utilities to modify how the content of a replaced element, such as an <img> or <video>, should be resized to fit its container.

    +

    How it works

    Change the value of the object-fit property with our responsive object-fit utility classes. This property tells the content to fill the parent container in a variety of ways, such as preserving the aspect ratio or stretching to take up as much space as possible.

    Classes for the value of object-fit are named using the format .object-fit-{value}. Choose from the following values:

      @@ -572,165 +26,52 @@
    • scale (for scale-down)
    • none
    -

    Examples

    +

    Examples

    Add the object-fit-{value} class to the replaced element:

    -
    -
    - -Placeholder : Object fit contain -Placeholder : Object fit cover -Placeholder : Object fit fill -Placeholder : Object fit scale down -Placeholder : Object fit none - -
    - html -
    - - -
    -
    <img src="..." class="object-fit-contain border rounded" alt="...">
    -<img src="..." class="object-fit-cover border rounded" alt="...">
    -<img src="..." class="object-fit-fill border rounded" alt="...">
    -<img src="..." class="object-fit-scale border rounded" alt="...">
    -<img src="..." class="object-fit-none border rounded" alt="...">
    -
    - -

    Responsive

    +
    Placeholder: Object fit contain +Placeholder: Object fit cover +Placeholder: Object fit fill +Placeholder: Object fit scale down +Placeholder: Object fit none
    html
    <img src="..." class="object-fit-contain border rounded" alt="...">
    +<img src="..." class="object-fit-cover border rounded" alt="...">
    +<img src="..." class="object-fit-fill border rounded" alt="...">
    +<img src="..." class="object-fit-scale border rounded" alt="...">
    +<img src="..." class="object-fit-none border rounded" alt="...">
    +

    Responsive

    Responsive variations also exist for each object-fit value using the format .object-fit-{breakpoint}-{value}, for the following breakpoint abbreviations: sm, md, lg, xl, and xxl. Classes can be combined for various effects as you need.

    -
    -
    - -Placeholder : Contain on sm -Placeholder : Contain on md -Placeholder : Contain on lg -Placeholder : Contain on xl -Placeholder : Contain on xxl - -
    - html -
    - - -
    -
    <img src="..." class="object-fit-sm-contain border rounded" alt="...">
    -<img src="..." class="object-fit-md-contain border rounded" alt="...">
    -<img src="..." class="object-fit-lg-contain border rounded" alt="...">
    -<img src="..." class="object-fit-xl-contain border rounded" alt="...">
    -<img src="..." class="object-fit-xxl-contain border rounded" alt="...">
    -
    - -

    Video

    +
    Placeholder: Contain on sm +Placeholder: Contain on md +Placeholder: Contain on lg +Placeholder: Contain on xl +Placeholder: Contain on xxl
    html
    <img src="..." class="object-fit-sm-contain border rounded" alt="...">
    +<img src="..." class="object-fit-md-contain border rounded" alt="...">
    +<img src="..." class="object-fit-lg-contain border rounded" alt="...">
    +<img src="..." class="object-fit-xl-contain border rounded" alt="...">
    +<img src="..." class="object-fit-xxl-contain border rounded" alt="...">
    +

    Video

    The .object-fit-{value} and responsive .object-fit-{breakpoint}-{value} utilities also work on <video> elements.

    -
    <video src="..." class="object-fit-contain" autoplay></video>
    -<video src="..." class="object-fit-cover" autoplay></video>
    -<video src="..." class="object-fit-fill" autoplay></video>
    -<video src="..." class="object-fit-scale" autoplay></video>
    -<video src="..." class="object-fit-none" autoplay></video>
    -

    CSS

    -

    Sass utilities API

    -

    Object fit utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "object-fit": (
    -  responsive: true,
    -  property: object-fit,
    -  values: (
    -    contain: contain,
    -    cover: cover,
    -    fill: fill,
    -    scale: scale-down,
    -    none: none,
    -  )
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    <video src="..." class="object-fit-contain" autoplay></video>
    +<video src="..." class="object-fit-cover" autoplay></video>
    +<video src="..." class="object-fit-fill" autoplay></video>
    +<video src="..." class="object-fit-scale" autoplay></video>
    +<video src="..." class="object-fit-none" autoplay></video>
    +
    +

    CSS

    +

    Sass utilities API

    +

    Object fit utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "object-fit": (
    +  responsive: true,
    +  property: object-fit,
    +  values: (
    +    contain: contain,
    +    cover: cover,
    +    fill: fill,
    +    scale: scale-down,
    +    none: none,
    +  )
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/opacity/index.html b/docs/5.3/utilities/opacity/index.html index 02223111e3..5805812187 100644 --- a/docs/5.3/utilities/opacity/index.html +++ b/docs/5.3/utilities/opacity/index.html @@ -1,652 +1,47 @@ - - - - - - - - - - - - - - - - -Opacity · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    -
    Added in v5.1 - View on GitHub - -
    -

    Opacity

    -
    -

    Control the opacity of elements.

    - - -
    - - - -
    - - -

    The opacity property sets the opacity level for an element. The opacity level describes the transparency level, where 1 is not transparent at all, .5 is 50% visible, and 0 is completely transparent.

    + Opacity · Bootstrap v5.3
    +Added in v5.1 +View on GitHub +

    Opacity

    Control the opacity of elements.

    +

    The opacity property sets the opacity level for an element. The opacity level describes the transparency level, where 1 is not transparent at all, .5 is 50% visible, and 0 is completely transparent.

    Set the opacity of an element using .opacity-{value} utilities.

    -
    -
    100%
    -
    75%
    -
    50%
    -
    25%
    -
    0%
    -
    -
    <div class="opacity-100">...</div>
    -<div class="opacity-75">...</div>
    -<div class="opacity-50">...</div>
    -<div class="opacity-25">...</div>
    -<div class="opacity-0">...</div>
    -

    CSS

    -

    Sass utilities API

    -

    Opacity utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "opacity": (
    -  property: opacity,
    -  values: (
    -    0: 0,
    -    25: .25,
    -    50: .5,
    -    75: .75,
    -    100: 1,
    -  )
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    100%
    75%
    50%
    25%
    0%
    +
    <div class="opacity-100">...</div>
    +<div class="opacity-75">...</div>
    +<div class="opacity-50">...</div>
    +<div class="opacity-25">...</div>
    +<div class="opacity-0">...</div>
    +
    +

    CSS

    +

    Sass utilities API

    +

    Opacity utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "opacity": (
    +  property: opacity,
    +  values: (
    +    0: 0,
    +    25: .25,
    +    50: .5,
    +    75: .75,
    +    100: 1,
    +  )
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/overflow/index.html b/docs/5.3/utilities/overflow/index.html index 782c076c6c..fe2f1b0ce2 100644 --- a/docs/5.3/utilities/overflow/index.html +++ b/docs/5.3/utilities/overflow/index.html @@ -1,731 +1,68 @@ - - - - - - - - - - - - - - - - -Overflow · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Overflow

    -
    -

    Use these shorthand utilities for quickly configuring how content overflows an element.

    - - -
    - - -
    - - On this page -
    -
    - -
    -
    - - -
    - - -

    Overflow

    + Overflow · Bootstrap v5.3

    Use these shorthand utilities for quickly configuring how content overflows an element.

    +
    On this page

    Overflow

    Adjust the overflow property on the fly with four default values and classes. These classes are not responsive by default.

    -
    -
    - This is an example of using .overflow-auto on an element with set width and height dimensions. By design, this content will vertically scroll. -
    -
    - This is an example of using .overflow-hidden on an element with set width and height dimensions. -
    -
    - This is an example of using .overflow-visible on an element with set width and height dimensions. -
    -
    - This is an example of using .overflow-scroll on an element with set width and height dimensions. -
    -
    -
    <div class="overflow-auto">...</div>
    -<div class="overflow-hidden">...</div>
    -<div class="overflow-visible">...</div>
    -<div class="overflow-scroll">...</div>
    -

    overflow-x

    +

    This is an example of using .overflow-auto on an element with set width and height dimensions. By design, this content will vertically scroll.

    This is an example of using .overflow-hidden on an element with set width and height dimensions.

    This is an example of using .overflow-visible on an element with set width and height dimensions.

    This is an example of using .overflow-scroll on an element with set width and height dimensions.

    +
    <div class="overflow-auto">...</div>
    +<div class="overflow-hidden">...</div>
    +<div class="overflow-visible">...</div>
    +<div class="overflow-scroll">...</div>
    +
    +

    overflow-x

    Adjust the overflow-x property to affect the overflow of content horizontally.

    -
    -
    -
    .overflow-x-auto example on an element
    -
    with set width and height dimensions.
    -
    -
    -
    .overflow-x-hidden example
    -
    on an element with set width and height dimensions.
    -
    -
    -
    .overflow-x-visible example
    -
    on an element with set width and height dimensions.
    -
    -
    -
    .overflow-x-scroll example on an element
    -
    with set width and height dimensions.
    -
    -
    -
    <div class="overflow-x-auto">...</div>
    -<div class="overflow-x-hidden">...</div>
    -<div class="overflow-x-visible">...</div>
    -<div class="overflow-x-scroll">...</div>
    -

    overflow-y

    +
    .overflow-x-auto example on an element
    with set width and height dimensions.
    .overflow-x-hidden example
    on an element with set width and height dimensions.
    .overflow-x-visible example
    on an element with set width and height dimensions.
    .overflow-x-scroll example on an element
    with set width and height dimensions.
    +
    <div class="overflow-x-auto">...</div>
    +<div class="overflow-x-hidden">...</div>
    +<div class="overflow-x-visible">...</div>
    +<div class="overflow-x-scroll">...</div>
    +
    +

    overflow-y

    Adjust the overflow-y property to affect the overflow of content vertically.

    -
    -
    - .overflow-y-auto example on an element with set width and height dimensions. -
    -
    - .overflow-y-hidden example on an element with set width and height dimensions. -
    -
    - .overflow-y-visible example on an element with set width and height dimensions. -
    -
    - .overflow-y-scroll example on an element with set width and height dimensions. -
    -
    -
    <div class="overflow-y-auto">...</div>
    -<div class="overflow-y-hidden">...</div>
    -<div class="overflow-y-visible">...</div>
    -<div class="overflow-y-scroll">...</div>
    -

    Using Sass variables, you may customize the overflow utilities by changing the $overflows variable in _variables.scss.

    -

    CSS

    -

    Sass utilities API

    -

    Overflow utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "overflow": (
    -  property: overflow,
    -  values: auto hidden visible scroll,
    -),
    -"overflow-x": (
    -  property: overflow-x,
    -  values: auto hidden visible scroll,
    -),
    -"overflow-y": (
    -  property: overflow-y,
    -  values: auto hidden visible scroll,
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +

    .overflow-y-auto example on an element with set width and height dimensions.

    .overflow-y-hidden example on an element with set width and height dimensions.

    .overflow-y-visible example on an element with set width and height dimensions.

    .overflow-y-scroll example on an element with set width and height dimensions.

    +
    <div class="overflow-y-auto">...</div>
    +<div class="overflow-y-hidden">...</div>
    +<div class="overflow-y-visible">...</div>
    +<div class="overflow-y-scroll">...</div>
    +
    +

    Using Sass variables, you may customize the overflow utilities by changing the $overflows variable in _variables.scss.

    +

    CSS

    +

    Sass utilities API

    +

    Overflow utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "overflow": (
    +  property: overflow,
    +  values: auto hidden visible scroll,
    +),
    +"overflow-x": (
    +  property: overflow-x,
    +  values: auto hidden visible scroll,
    +),
    +"overflow-y": (
    +  property: overflow-y,
    +  values: auto hidden visible scroll,
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/position/index.html b/docs/5.3/utilities/position/index.html index 3a67022bec..64725fa87c 100644 --- a/docs/5.3/utilities/position/index.html +++ b/docs/5.3/utilities/position/index.html @@ -1,576 +1,35 @@ - - - - - - - - - - - - - - - - -Position · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Position

    -
    -

    Use these shorthand utilities for quickly configuring the position of an element.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Position values

    + Position · Bootstrap v5.3

    Use these shorthand utilities for quickly configuring the position of an element.

    +

    Position values

    Quick positioning classes are available, though they are not responsive.

    -
    <div class="position-static">...</div>
    -<div class="position-relative">...</div>
    -<div class="position-absolute">...</div>
    -<div class="position-fixed">...</div>
    -<div class="position-sticky">...</div>
    -

    Arrange elements

    +
    <div class="position-static">...</div>
    +<div class="position-relative">...</div>
    +<div class="position-absolute">...</div>
    +<div class="position-fixed">...</div>
    +<div class="position-sticky">...</div>
    +
    +

    Arrange elements

    Arrange elements easily with the edge positioning utilities. The format is {property}-{position}.

    Where property is one of:

      @@ -586,45 +45,25 @@
    • 100 - for 100% edge position

    (You can add more position values by adding entries to the $position-values Sass map variable.)

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="position-relative">
    -  <div class="position-absolute top-0 start-0"></div>
    -  <div class="position-absolute top-0 end-0"></div>
    -  <div class="position-absolute top-50 start-50"></div>
    -  <div class="position-absolute bottom-50 end-50"></div>
    -  <div class="position-absolute bottom-0 start-0"></div>
    -  <div class="position-absolute bottom-0 end-0"></div>
    -</div>
    -
    - -

    Center elements

    +
    html
    <div class="position-relative">
    +  <div class="position-absolute top-0 start-0"></div>
    +  <div class="position-absolute top-0 end-0"></div>
    +  <div class="position-absolute top-50 start-50"></div>
    +  <div class="position-absolute bottom-50 end-50"></div>
    +  <div class="position-absolute bottom-0 start-0"></div>
    +  <div class="position-absolute bottom-0 end-0"></div>
    +</div>
    +

    Center elements

    In addition, you can also center the elements with the transform utility class .translate-middle.

    This class applies the transformations translateX(-50%) and translateY(-50%) to the element which, in combination with the edge positioning utilities, allows you to absolute center an element.

    -
    -
    - -
    +
    @@ -634,36 +73,19 @@
    -
    - -
    - html -
    - - -
    -
    <div class="position-relative">
    -  <div class="position-absolute top-0 start-0 translate-middle"></div>
    -  <div class="position-absolute top-0 start-50 translate-middle"></div>
    -  <div class="position-absolute top-0 start-100 translate-middle"></div>
    -  <div class="position-absolute top-50 start-0 translate-middle"></div>
    -  <div class="position-absolute top-50 start-50 translate-middle"></div>
    -  <div class="position-absolute top-50 start-100 translate-middle"></div>
    -  <div class="position-absolute top-100 start-0 translate-middle"></div>
    -  <div class="position-absolute top-100 start-50 translate-middle"></div>
    -  <div class="position-absolute top-100 start-100 translate-middle"></div>
    -</div>
    -
    - +
    html
    <div class="position-relative">
    +  <div class="position-absolute top-0 start-0 translate-middle"></div>
    +  <div class="position-absolute top-0 start-50 translate-middle"></div>
    +  <div class="position-absolute top-0 start-100 translate-middle"></div>
    +  <div class="position-absolute top-50 start-0 translate-middle"></div>
    +  <div class="position-absolute top-50 start-50 translate-middle"></div>
    +  <div class="position-absolute top-50 start-100 translate-middle"></div>
    +  <div class="position-absolute top-100 start-0 translate-middle"></div>
    +  <div class="position-absolute top-100 start-50 translate-middle"></div>
    +  <div class="position-absolute top-100 start-100 translate-middle"></div>
    +</div>

    By adding .translate-middle-x or .translate-middle-y classes, elements can be positioned only in horizontal or vertical direction.

    -
    -
    - -
    +
    @@ -673,37 +95,20 @@
    -
    - -
    - html -
    - - -
    -
    <div class="position-relative">
    -  <div class="position-absolute top-0 start-0"></div>
    -  <div class="position-absolute top-0 start-50 translate-middle-x"></div>
    -  <div class="position-absolute top-0 end-0"></div>
    -  <div class="position-absolute top-50 start-0 translate-middle-y"></div>
    -  <div class="position-absolute top-50 start-50 translate-middle"></div>
    -  <div class="position-absolute top-50 end-0 translate-middle-y"></div>
    -  <div class="position-absolute bottom-0 start-0"></div>
    -  <div class="position-absolute bottom-0 start-50 translate-middle-x"></div>
    -  <div class="position-absolute bottom-0 end-0"></div>
    -</div>
    -
    - -

    Examples

    +
    html
    <div class="position-relative">
    +  <div class="position-absolute top-0 start-0"></div>
    +  <div class="position-absolute top-0 start-50 translate-middle-x"></div>
    +  <div class="position-absolute top-0 end-0"></div>
    +  <div class="position-absolute top-50 start-0 translate-middle-y"></div>
    +  <div class="position-absolute top-50 start-50 translate-middle"></div>
    +  <div class="position-absolute top-50 end-0 translate-middle-y"></div>
    +  <div class="position-absolute bottom-0 start-0"></div>
    +  <div class="position-absolute bottom-0 start-50 translate-middle-x"></div>
    +  <div class="position-absolute bottom-0 end-0"></div>
    +</div>
    +

    Examples

    Here are some real life examples of these classes:

    -
    -
    - - @@ -713,196 +118,77 @@ +
    html
    <button type="button" class="btn btn-primary position-relative">
    +  Mails <span class="position-absolute top-0 start-100 translate-middle badge rounded-pill text-bg-secondary">+99 <span class="visually-hidden">unread messages</span></span>
    +</button>
     
    -  
    - html -
    - - -
    -
    <button type="button" class="btn btn-primary position-relative">
    -  Mails <span class="position-absolute top-0 start-100 translate-middle badge rounded-pill text-bg-secondary">+99 <span class="visually-hidden">unread messages</span></span>
    -</button>
    -
    -<div class="position-relative py-2 px-4 text-bg-secondary border border-secondary rounded-pill">
    -  Marker <svg width="1em" height="1em" viewBox="0 0 16 16" class="position-absolute top-100 start-50 translate-middle mt-1" fill="var(--bs-secondary)" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"/></svg>
    -</div>
    -
    -<button type="button" class="btn btn-primary position-relative">
    -  Alerts <span class="position-absolute top-0 start-100 translate-middle badge border border-light rounded-circle bg-danger p-2"><span class="visually-hidden">unread messages</span></span>
    -</button>
    -
    +<div class="position-relative py-2 px-4 text-bg-secondary border border-secondary rounded-pill"> + Marker <svg width="1em" height="1em" viewBox="0 0 16 16" class="position-absolute top-100 start-50 translate-middle mt-1" fill="var(--bs-secondary)" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><path d="M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"/></svg> +</div> +<button type="button" class="btn btn-primary position-relative"> + Alerts <span class="position-absolute top-0 start-100 translate-middle badge border border-light rounded-circle bg-danger p-2"><span class="visually-hidden">unread messages</span></span> +</button>

    You can use these classes with existing components to create new ones. Remember that you can extend its functionality by adding entries to the $position-values variable.

    -
    -
    - -
    +
    -
    - -
    - html -
    - - -
    -
    <div class="position-relative m-4">
    -  <div class="progress" role="progressbar" aria-label="Progress" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100" style="height: 1px;">
    -    <div class="progress-bar" style="width: 50%"></div>
    -  </div>
    -  <button type="button" class="position-absolute top-0 start-0 translate-middle btn btn-sm btn-primary rounded-pill" style="width: 2rem; height:2rem;">1</button>
    -  <button type="button" class="position-absolute top-0 start-50 translate-middle btn btn-sm btn-primary rounded-pill" style="width: 2rem; height:2rem;">2</button>
    -  <button type="button" class="position-absolute top-0 start-100 translate-middle btn btn-sm btn-secondary rounded-pill" style="width: 2rem; height:2rem;">3</button>
    -</div>
    -
    - -

    CSS

    -

    Sass maps

    +
    html
    <div class="position-relative m-4">
    +  <div class="progress" role="progressbar" aria-label="Progress" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100" style="height: 1px;">
    +    <div class="progress-bar" style="width: 50%"></div>
    +  </div>
    +  <button type="button" class="position-absolute top-0 start-0 translate-middle btn btn-sm btn-primary rounded-pill" style="width: 2rem; height:2rem;">1</button>
    +  <button type="button" class="position-absolute top-0 start-50 translate-middle btn btn-sm btn-primary rounded-pill" style="width: 2rem; height:2rem;">2</button>
    +  <button type="button" class="position-absolute top-0 start-100 translate-middle btn btn-sm btn-secondary rounded-pill" style="width: 2rem; height:2rem;">3</button>
    +</div>
    +

    CSS

    +

    Sass maps

    Default position utility values are declared in a Sass map, then used to generate our utilities.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $position-values: (
    -  0: 0,
    -  50: 50%,
    -  100: 100%
    -);
    -
    -

    Sass utilities API

    -

    Position utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "position": (
    -  property: position,
    -  values: static relative absolute fixed sticky
    -),
    -"top": (
    -  property: top,
    -  values: $position-values
    -),
    -"bottom": (
    -  property: bottom,
    -  values: $position-values
    -),
    -"start": (
    -  property: left,
    -  class: start,
    -  values: $position-values
    -),
    -"end": (
    -  property: right,
    -  class: end,
    -  values: $position-values
    -),
    -"translate-middle": (
    -  property: transform,
    -  class: translate-middle,
    -  values: (
    -    null: translate(-50%, -50%),
    -    x: translateX(-50%),
    -    y: translateY(-50%),
    -  )
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    $position-values: (
    +  0: 0,
    +  50: 50%,
    +  100: 100%
    +);
    +
    +

    Sass utilities API

    +

    Position utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "position": (
    +  property: position,
    +  values: static relative absolute fixed sticky
    +),
    +"top": (
    +  property: top,
    +  values: $position-values
    +),
    +"bottom": (
    +  property: bottom,
    +  values: $position-values
    +),
    +"start": (
    +  property: left,
    +  class: start,
    +  values: $position-values
    +),
    +"end": (
    +  property: right,
    +  class: end,
    +  values: $position-values
    +),
    +"translate-middle": (
    +  property: transform,
    +  class: translate-middle,
    +  values: (
    +    null: translate(-50%, -50%),
    +    x: translateX(-50%),
    +    y: translateY(-50%),
    +  )
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/shadows/index.html b/docs/5.3/utilities/shadows/index.html index 6496ba30c9..05702c0151 100644 --- a/docs/5.3/utilities/shadows/index.html +++ b/docs/5.3/utilities/shadows/index.html @@ -1,700 +1,56 @@ - - - - - - - - - - - - - - - - -Shadows · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Shadows

    -
    -

    Add or remove shadows to elements with box-shadow utilities.

    - - -
    - - -
    - - On this page -
    -
    - -
    -
    - - -
    - - -

    Examples

    + Shadows · Bootstrap v5.3

    Add or remove shadows to elements with box-shadow utilities.

    +
    On this page

    Examples

    While shadows on components are disabled by default in Bootstrap and can be enabled via $enable-shadows, you can also quickly add or remove a shadow with our box-shadow utility classes. Includes support for .shadow-none and three default sizes (which have associated variables to match).

    -
    -
    - -
    No shadow
    +
    No shadow
    Small shadow
    Regular shadow
    -
    Larger shadow
    - -
    - html -
    - - -
    -
    <div class="shadow-none p-3 mb-5 bg-body-tertiary rounded">No shadow</div>
    -<div class="shadow-sm p-3 mb-5 bg-body-tertiary rounded">Small shadow</div>
    -<div class="shadow p-3 mb-5 bg-body-tertiary rounded">Regular shadow</div>
    -<div class="shadow-lg p-3 mb-5 bg-body-tertiary rounded">Larger shadow</div>
    -
    - -

    CSS

    -

    Sass variables

    -
    -
    - scss/_variables.scss -
    - -
    -
    $box-shadow:                  0 .5rem 1rem rgba($black, .15);
    -$box-shadow-sm:               0 .125rem .25rem rgba($black, .075);
    -$box-shadow-lg:               0 1rem 3rem rgba($black, .175);
    -$box-shadow-inset:            inset 0 1px 2px rgba($black, .075);
    -
    -

    Sass utilities API

    -

    Shadow utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "shadow": (
    -  property: box-shadow,
    -  class: shadow,
    -  values: (
    -    null: var(--#{$prefix}box-shadow),
    -    sm: var(--#{$prefix}box-shadow-sm),
    -    lg: var(--#{$prefix}box-shadow-lg),
    -    none: none,
    -  )
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    Larger shadow
    html
    <div class="shadow-none p-3 mb-5 bg-body-tertiary rounded">No shadow</div>
    +<div class="shadow-sm p-3 mb-5 bg-body-tertiary rounded">Small shadow</div>
    +<div class="shadow p-3 mb-5 bg-body-tertiary rounded">Regular shadow</div>
    +<div class="shadow-lg p-3 mb-5 bg-body-tertiary rounded">Larger shadow</div>
    +

    CSS

    +

    Sass variables

    +
    $box-shadow:                  0 .5rem 1rem rgba($black, .15);
    +$box-shadow-sm:               0 .125rem .25rem rgba($black, .075);
    +$box-shadow-lg:               0 1rem 3rem rgba($black, .175);
    +$box-shadow-inset:            inset 0 1px 2px rgba($black, .075);
    +
    +

    Sass utilities API

    +

    Shadow utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "shadow": (
    +  property: box-shadow,
    +  class: shadow,
    +  values: (
    +    null: var(--#{$prefix}box-shadow),
    +    sm: var(--#{$prefix}box-shadow-sm),
    +    lg: var(--#{$prefix}box-shadow-lg),
    +    none: none,
    +  )
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/sizing/index.html b/docs/5.3/utilities/sizing/index.html index c77e801cc6..f85623a62d 100644 --- a/docs/5.3/utilities/sizing/index.html +++ b/docs/5.3/utilities/sizing/index.html @@ -1,811 +1,125 @@ - - - - - - - - - - - - - - - - -Sizing · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Sizing

    -
    -

    Easily make an element as wide or as tall with our width and height utilities.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Relative to the parent

    + Sizing · Bootstrap v5.3

    Easily make an element as wide or as tall with our width and height utilities.

    +

    Relative to the parent

    Width and height utilities are generated from the utility API in _utilities.scss. Includes support for 25%, 50%, 75%, 100%, and auto by default. Modify those values as you need to generate different utilities here.

    -
    -
    - -
    Width 25%
    +
    Width 25%
    Width 50%
    Width 75%
    Width 100%
    -
    Width auto
    - -
    - html -
    - - -
    -
    <div class="w-25 p-3">Width 25%</div>
    -<div class="w-50 p-3">Width 50%</div>
    -<div class="w-75 p-3">Width 75%</div>
    -<div class="w-100 p-3">Width 100%</div>
    -<div class="w-auto p-3">Width auto</div>
    -
    - -
    -
    - -
    +
    Width auto
    html
    <div class="w-25 p-3">Width 25%</div>
    +<div class="w-50 p-3">Width 50%</div>
    +<div class="w-75 p-3">Width 75%</div>
    +<div class="w-100 p-3">Width 100%</div>
    +<div class="w-auto p-3">Width auto</div>
    +
    Height 25%
    Height 50%
    Height 75%
    Height 100%
    Height auto
    -
    - -
    - html -
    - - -
    -
    <div style="height: 100px;">
    -  <div class="h-25 d-inline-block" style="width: 120px;">Height 25%</div>
    -  <div class="h-50 d-inline-block" style="width: 120px;">Height 50%</div>
    -  <div class="h-75 d-inline-block" style="width: 120px;">Height 75%</div>
    -  <div class="h-100 d-inline-block" style="width: 120px;">Height 100%</div>
    -  <div class="h-auto d-inline-block" style="width: 120px;">Height auto</div>
    -</div>
    -
    - +
    html
    <div style="height: 100px;">
    +  <div class="h-25 d-inline-block" style="width: 120px;">Height 25%</div>
    +  <div class="h-50 d-inline-block" style="width: 120px;">Height 50%</div>
    +  <div class="h-75 d-inline-block" style="width: 120px;">Height 75%</div>
    +  <div class="h-100 d-inline-block" style="width: 120px;">Height 100%</div>
    +  <div class="h-auto d-inline-block" style="width: 120px;">Height auto</div>
    +</div>

    You can also use max-width: 100%; and max-height: 100%; utilities as needed.

    -
    -
    - -
    +
    Max-width 100%
    -
    - -
    - html -
    - - -
    -
    <div style="width: 50%; height: 100px;">
    -  <div class="mw-100" style="width: 200%;">Max-width 100%</div>
    -</div>
    -
    - -
    -
    - -
    +
    html
    <div style="width: 50%; height: 100px;">
    +  <div class="mw-100" style="width: 200%;">Max-width 100%</div>
    +</div>
    +
    Max-height 100%
    -
    - -
    - html -
    - - -
    -
    <div style="height: 100px;">
    -  <div class="mh-100" style="width: 100px; height: 200px;">Max-height 100%</div>
    -</div>
    -
    - -

    Relative to the viewport

    +
    html
    <div style="height: 100px;">
    +  <div class="mh-100" style="width: 100px; height: 200px;">Max-height 100%</div>
    +</div>
    +

    Relative to the viewport

    You can also use utilities to set the width and height relative to the viewport.

    -
    <div class="min-vw-100">Min-width 100vw</div>
    -<div class="min-vh-100">Min-height 100vh</div>
    -<div class="vw-100">Width 100vw</div>
    -<div class="vh-100">Height 100vh</div>
    -

    CSS

    -

    Sass utilities API

    -

    Sizing utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "width": (
    -  property: width,
    -  class: w,
    -  values: (
    -    25: 25%,
    -    50: 50%,
    -    75: 75%,
    -    100: 100%,
    -    auto: auto
    -  )
    -),
    -"max-width": (
    -  property: max-width,
    -  class: mw,
    -  values: (100: 100%)
    -),
    -"viewport-width": (
    -  property: width,
    -  class: vw,
    -  values: (100: 100vw)
    -),
    -"min-viewport-width": (
    -  property: min-width,
    -  class: min-vw,
    -  values: (100: 100vw)
    -),
    -"height": (
    -  property: height,
    -  class: h,
    -  values: (
    -    25: 25%,
    -    50: 50%,
    -    75: 75%,
    -    100: 100%,
    -    auto: auto
    -  )
    -),
    -"max-height": (
    -  property: max-height,
    -  class: mh,
    -  values: (100: 100%)
    -),
    -"viewport-height": (
    -  property: height,
    -  class: vh,
    -  values: (100: 100vh)
    -),
    -"min-viewport-height": (
    -  property: min-height,
    -  class: min-vh,
    -  values: (100: 100vh)
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    <div class="min-vw-100">Min-width 100vw</div>
    +<div class="min-vh-100">Min-height 100vh</div>
    +<div class="vw-100">Width 100vw</div>
    +<div class="vh-100">Height 100vh</div>
    +
    +

    CSS

    +

    Sass utilities API

    +

    Sizing utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "width": (
    +  property: width,
    +  class: w,
    +  values: (
    +    25: 25%,
    +    50: 50%,
    +    75: 75%,
    +    100: 100%,
    +    auto: auto
    +  )
    +),
    +"max-width": (
    +  property: max-width,
    +  class: mw,
    +  values: (100: 100%)
    +),
    +"viewport-width": (
    +  property: width,
    +  class: vw,
    +  values: (100: 100vw)
    +),
    +"min-viewport-width": (
    +  property: min-width,
    +  class: min-vw,
    +  values: (100: 100vw)
    +),
    +"height": (
    +  property: height,
    +  class: h,
    +  values: (
    +    25: 25%,
    +    50: 50%,
    +    75: 75%,
    +    100: 100%,
    +    auto: auto
    +  )
    +),
    +"max-height": (
    +  property: max-height,
    +  class: mh,
    +  values: (100: 100%)
    +),
    +"viewport-height": (
    +  property: height,
    +  class: vh,
    +  values: (100: 100vh)
    +),
    +"min-viewport-height": (
    +  property: min-height,
    +  class: min-vh,
    +  values: (100: 100vh)
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/spacing/index.html b/docs/5.3/utilities/spacing/index.html index 2b1cb5f845..60d8201828 100644 --- a/docs/5.3/utilities/spacing/index.html +++ b/docs/5.3/utilities/spacing/index.html @@ -1,585 +1,30 @@ - - - - - - - - - - - - - - - - -Spacing · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Spacing

    -
    -

    Bootstrap includes a wide range of shorthand responsive margin, padding, and gap utility classes to modify an element’s appearance.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Margin and padding

    + Spacing · Bootstrap v5.3

    Bootstrap includes a wide range of shorthand responsive margin, padding, and gap utility classes to modify an element’s appearance.

    +

    Margin and padding

    Assign responsive-friendly margin or padding values to an element or a subset of its sides with shorthand classes. Includes support for individual properties, all properties, and vertical and horizontal properties. Classes are built from a default Sass map ranging from .25rem to 3rem.

    -
    -Using the CSS Grid layout module? Consider using the gap utility instead. -
    - -

    Notation

    +

    Using the CSS Grid layout module? Consider using the gap utility instead.

    +

    Notation

    Spacing utilities that apply to all breakpoints, from xs to xxl, have no breakpoint abbreviation in them. This is because those classes are applied from min-width: 0 and up, and thus are not bound by a media query. The remaining breakpoints, however, do include a breakpoint abbreviation.

    The classes are named using the format {property}{sides}-{size} for xs and {property}{sides}-{breakpoint}-{size} for sm, md, lg, xl, and xxl.

    Where property is one of:

    @@ -608,383 +53,245 @@
  • auto - for classes that set the margin to auto
  • (You can add more sizes by adding entries to the $spacers Sass map variable.)

    -

    Examples

    +

    Examples

    Here are some representative examples of these classes:

    -
    .mt-0 {
    -  margin-top: 0 !important;
    -}
    -
    -.ms-1 {
    -  margin-left: ($spacer * .25) !important;
    -}
    -
    -.px-2 {
    -  padding-left: ($spacer * .5) !important;
    -  padding-right: ($spacer * .5) !important;
    -}
    -
    -.p-3 {
    -  padding: $spacer !important;
    -}
    -

    Horizontal centering

    +
    .mt-0 {
    +  margin-top: 0 !important;
    +}
    +
    +.ms-1 {
    +  margin-left: ($spacer * .25) !important;
    +}
    +
    +.px-2 {
    +  padding-left: ($spacer * .5) !important;
    +  padding-right: ($spacer * .5) !important;
    +}
    +
    +.p-3 {
    +  padding: $spacer !important;
    +}
    +
    +

    Horizontal centering

    Additionally, Bootstrap also includes an .mx-auto class for horizontally centering fixed-width block level content—that is, content that has display: block and a width set—by setting the horizontal margins to auto.

    -
    -
    - Centered element -
    -
    -
    <div class="mx-auto p-2" style="width: 200px;">
    -  Centered element
    -</div>
    -

    Negative margin

    +
    + Centered element +
    +
    <div class="mx-auto p-2" style="width: 200px;">
    +  Centered element
    +</div>
    +
    +

    Negative margin

    In CSS, margin properties can utilize negative values (padding cannot). These negative margins are disabled by default, but can be enabled in Sass by setting $enable-negative-margins: true.

    -

    The syntax is nearly the same as the default, positive margin utilities, but with the addition of n before the requested size. Here’s an example class that’s the opposite of .mt-1:

    -
    .mt-n1 {
    -  margin-top: -0.25rem !important;
    -}
    -

    Gap

    +

    The syntax is nearly the same as the default, positive margin utilities, but with the addition of n before the requested size. Here’s an example class that’s the opposite of .mt-1:

    +
    .mt-n1 {
    +  margin-top: -0.25rem !important;
    +}
    +
    +

    Gap

    When using display: grid or display: flex, you can make use of gap utilities on the parent element. This can save on having to add margin utilities to individual children of a grid or flex container. Gap utilities are responsive by default, and are generated via our utilities API, based on the $spacers Sass map.

    -
    -
    - -
    +
    Grid item 1
    Grid item 2
    Grid item 3
    Grid item 4
    -
    - -
    - html -
    - - -
    -
    <div style="grid-template-columns: 1fr 1fr;" class="d-grid gap-3">
    -  <div class="p-2">Grid item 1</div>
    -  <div class="p-2">Grid item 2</div>
    -  <div class="p-2">Grid item 3</div>
    -  <div class="p-2">Grid item 4</div>
    -</div>
    -
    - -

    Support includes responsive options for all of Bootstrap’s grid breakpoints, as well as six sizes from the $spacers map (05). There is no .gap-auto utility class as it’s effectively the same as .gap-0.

    -

    row-gap

    +
    html
    <div style="grid-template-columns: 1fr 1fr;" class="d-grid gap-3">
    +  <div class="p-2">Grid item 1</div>
    +  <div class="p-2">Grid item 2</div>
    +  <div class="p-2">Grid item 3</div>
    +  <div class="p-2">Grid item 4</div>
    +</div>
    +

    Support includes responsive options for all of Bootstrap’s grid breakpoints, as well as six sizes from the $spacers map (05). There is no .gap-auto utility class as it’s effectively the same as .gap-0.

    +

    row-gap

    row-gap sets the vertical space between children items in the specified container.

    -
    -
    - -
    +
    Grid item 1
    Grid item 2
    Grid item 3
    Grid item 4
    -
    - -
    - html -
    - - -
    -
    <div style="grid-template-columns: 1fr 1fr;" class="d-grid gap-0 row-gap-3">
    -  <div class="p-2">Grid item 1</div>
    -  <div class="p-2">Grid item 2</div>
    -  <div class="p-2">Grid item 3</div>
    -  <div class="p-2">Grid item 4</div>
    -</div>
    -
    - -

    column-gap

    +
    html
    <div style="grid-template-columns: 1fr 1fr;" class="d-grid gap-0 row-gap-3">
    +  <div class="p-2">Grid item 1</div>
    +  <div class="p-2">Grid item 2</div>
    +  <div class="p-2">Grid item 3</div>
    +  <div class="p-2">Grid item 4</div>
    +</div>
    +

    column-gap

    column-gap sets the horizontal space between children items in the specified container.

    -
    -
    - -
    +
    Grid item 1
    Grid item 2
    Grid item 3
    Grid item 4
    -
    - -
    - html -
    - - -
    -
    <div style="grid-template-columns: 1fr 1fr;" class="d-grid gap-0 column-gap-3">
    -  <div class="p-2">Grid item 1</div>
    -  <div class="p-2">Grid item 2</div>
    -  <div class="p-2">Grid item 3</div>
    -  <div class="p-2">Grid item 4</div>
    -</div>
    -
    - -

    CSS

    -

    Sass maps

    +
    html
    <div style="grid-template-columns: 1fr 1fr;" class="d-grid gap-0 column-gap-3">
    +  <div class="p-2">Grid item 1</div>
    +  <div class="p-2">Grid item 2</div>
    +  <div class="p-2">Grid item 3</div>
    +  <div class="p-2">Grid item 4</div>
    +</div>
    +

    CSS

    +

    Sass maps

    Spacing utilities are declared via Sass map and then generated with our utilities API.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $spacer: 1rem;
    -$spacers: (
    -  0: 0,
    -  1: $spacer * .25,
    -  2: $spacer * .5,
    -  3: $spacer,
    -  4: $spacer * 1.5,
    -  5: $spacer * 3,
    -);
    -
    -

    Sass utilities API

    -

    Spacing utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "margin": (
    -  responsive: true,
    -  property: margin,
    -  class: m,
    -  values: map-merge($spacers, (auto: auto))
    -),
    -"margin-x": (
    -  responsive: true,
    -  property: margin-right margin-left,
    -  class: mx,
    -  values: map-merge($spacers, (auto: auto))
    -),
    -"margin-y": (
    -  responsive: true,
    -  property: margin-top margin-bottom,
    -  class: my,
    -  values: map-merge($spacers, (auto: auto))
    -),
    -"margin-top": (
    -  responsive: true,
    -  property: margin-top,
    -  class: mt,
    -  values: map-merge($spacers, (auto: auto))
    -),
    -"margin-end": (
    -  responsive: true,
    -  property: margin-right,
    -  class: me,
    -  values: map-merge($spacers, (auto: auto))
    -),
    -"margin-bottom": (
    -  responsive: true,
    -  property: margin-bottom,
    -  class: mb,
    -  values: map-merge($spacers, (auto: auto))
    -),
    -"margin-start": (
    -  responsive: true,
    -  property: margin-left,
    -  class: ms,
    -  values: map-merge($spacers, (auto: auto))
    -),
    -// Negative margin utilities
    -"negative-margin": (
    -  responsive: true,
    -  property: margin,
    -  class: m,
    -  values: $negative-spacers
    -),
    -"negative-margin-x": (
    -  responsive: true,
    -  property: margin-right margin-left,
    -  class: mx,
    -  values: $negative-spacers
    -),
    -"negative-margin-y": (
    -  responsive: true,
    -  property: margin-top margin-bottom,
    -  class: my,
    -  values: $negative-spacers
    -),
    -"negative-margin-top": (
    -  responsive: true,
    -  property: margin-top,
    -  class: mt,
    -  values: $negative-spacers
    -),
    -"negative-margin-end": (
    -  responsive: true,
    -  property: margin-right,
    -  class: me,
    -  values: $negative-spacers
    -),
    -"negative-margin-bottom": (
    -  responsive: true,
    -  property: margin-bottom,
    -  class: mb,
    -  values: $negative-spacers
    -),
    -"negative-margin-start": (
    -  responsive: true,
    -  property: margin-left,
    -  class: ms,
    -  values: $negative-spacers
    -),
    -// Padding utilities
    -"padding": (
    -  responsive: true,
    -  property: padding,
    -  class: p,
    -  values: $spacers
    -),
    -"padding-x": (
    -  responsive: true,
    -  property: padding-right padding-left,
    -  class: px,
    -  values: $spacers
    -),
    -"padding-y": (
    -  responsive: true,
    -  property: padding-top padding-bottom,
    -  class: py,
    -  values: $spacers
    -),
    -"padding-top": (
    -  responsive: true,
    -  property: padding-top,
    -  class: pt,
    -  values: $spacers
    -),
    -"padding-end": (
    -  responsive: true,
    -  property: padding-right,
    -  class: pe,
    -  values: $spacers
    -),
    -"padding-bottom": (
    -  responsive: true,
    -  property: padding-bottom,
    -  class: pb,
    -  values: $spacers
    -),
    -"padding-start": (
    -  responsive: true,
    -  property: padding-left,
    -  class: ps,
    -  values: $spacers
    -),
    -// Gap utility
    -"gap": (
    -  responsive: true,
    -  property: gap,
    -  class: gap,
    -  values: $spacers
    -),
    -"row-gap": (
    -  responsive: true,
    -  property: row-gap,
    -  class: row-gap,
    -  values: $spacers
    -),
    -"column-gap": (
    -  responsive: true,
    -  property: column-gap,
    -  class: column-gap,
    -  values: $spacers
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    $spacer: 1rem;
    +$spacers: (
    +  0: 0,
    +  1: $spacer * .25,
    +  2: $spacer * .5,
    +  3: $spacer,
    +  4: $spacer * 1.5,
    +  5: $spacer * 3,
    +);
    +
    +

    Sass utilities API

    +

    Spacing utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "margin": (
    +  responsive: true,
    +  property: margin,
    +  class: m,
    +  values: map-merge($spacers, (auto: auto))
    +),
    +"margin-x": (
    +  responsive: true,
    +  property: margin-right margin-left,
    +  class: mx,
    +  values: map-merge($spacers, (auto: auto))
    +),
    +"margin-y": (
    +  responsive: true,
    +  property: margin-top margin-bottom,
    +  class: my,
    +  values: map-merge($spacers, (auto: auto))
    +),
    +"margin-top": (
    +  responsive: true,
    +  property: margin-top,
    +  class: mt,
    +  values: map-merge($spacers, (auto: auto))
    +),
    +"margin-end": (
    +  responsive: true,
    +  property: margin-right,
    +  class: me,
    +  values: map-merge($spacers, (auto: auto))
    +),
    +"margin-bottom": (
    +  responsive: true,
    +  property: margin-bottom,
    +  class: mb,
    +  values: map-merge($spacers, (auto: auto))
    +),
    +"margin-start": (
    +  responsive: true,
    +  property: margin-left,
    +  class: ms,
    +  values: map-merge($spacers, (auto: auto))
    +),
    +// Negative margin utilities
    +"negative-margin": (
    +  responsive: true,
    +  property: margin,
    +  class: m,
    +  values: $negative-spacers
    +),
    +"negative-margin-x": (
    +  responsive: true,
    +  property: margin-right margin-left,
    +  class: mx,
    +  values: $negative-spacers
    +),
    +"negative-margin-y": (
    +  responsive: true,
    +  property: margin-top margin-bottom,
    +  class: my,
    +  values: $negative-spacers
    +),
    +"negative-margin-top": (
    +  responsive: true,
    +  property: margin-top,
    +  class: mt,
    +  values: $negative-spacers
    +),
    +"negative-margin-end": (
    +  responsive: true,
    +  property: margin-right,
    +  class: me,
    +  values: $negative-spacers
    +),
    +"negative-margin-bottom": (
    +  responsive: true,
    +  property: margin-bottom,
    +  class: mb,
    +  values: $negative-spacers
    +),
    +"negative-margin-start": (
    +  responsive: true,
    +  property: margin-left,
    +  class: ms,
    +  values: $negative-spacers
    +),
    +// Padding utilities
    +"padding": (
    +  responsive: true,
    +  property: padding,
    +  class: p,
    +  values: $spacers
    +),
    +"padding-x": (
    +  responsive: true,
    +  property: padding-right padding-left,
    +  class: px,
    +  values: $spacers
    +),
    +"padding-y": (
    +  responsive: true,
    +  property: padding-top padding-bottom,
    +  class: py,
    +  values: $spacers
    +),
    +"padding-top": (
    +  responsive: true,
    +  property: padding-top,
    +  class: pt,
    +  values: $spacers
    +),
    +"padding-end": (
    +  responsive: true,
    +  property: padding-right,
    +  class: pe,
    +  values: $spacers
    +),
    +"padding-bottom": (
    +  responsive: true,
    +  property: padding-bottom,
    +  class: pb,
    +  values: $spacers
    +),
    +"padding-start": (
    +  responsive: true,
    +  property: padding-left,
    +  class: ps,
    +  values: $spacers
    +),
    +// Gap utility
    +"gap": (
    +  responsive: true,
    +  property: gap,
    +  class: gap,
    +  values: $spacers
    +),
    +"row-gap": (
    +  responsive: true,
    +  property: row-gap,
    +  class: row-gap,
    +  values: $spacers
    +),
    +"column-gap": (
    +  responsive: true,
    +  property: column-gap,
    +  class: column-gap,
    +  values: $spacers
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/text/index.html b/docs/5.3/utilities/text/index.html index 11adb11fd9..d0230f3d50 100644 --- a/docs/5.3/utilities/text/index.html +++ b/docs/5.3/utilities/text/index.html @@ -1,581 +1,29 @@ - - - - - - - - - - - - - - - - -Text · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    - -

    Documentation and examples for common text utilities to control alignment, wrapping, weight, and more.

    - - -
    - - - - - -
    - - -

    Text alignment

    + Text · Bootstrap v5.3

    Documentation and examples for common text utilities to control alignment, wrapping, weight, and more.

    +

    Text alignment

    Easily realign text to components with text alignment classes. For start, end, and center alignment, responsive classes are available that use the same viewport width breakpoints as the grid system.

    -
    -
    - -

    Start aligned text on all viewport sizes.

    +

    Start aligned text on all viewport sizes.

    Center aligned text on all viewport sizes.

    End aligned text on all viewport sizes.

    @@ -583,166 +31,58 @@

    End aligned text on viewports sized MD (medium) or wider.

    End aligned text on viewports sized LG (large) or wider.

    End aligned text on viewports sized XL (extra large) or wider.

    -

    End aligned text on viewports sized XXL (extra extra large) or wider.

    +

    End aligned text on viewports sized XXL (extra extra large) or wider.

    html
    <p class="text-start">Start aligned text on all viewport sizes.</p>
    +<p class="text-center">Center aligned text on all viewport sizes.</p>
    +<p class="text-end">End aligned text on all viewport sizes.</p>
     
    -  
    - html -
    - - -
    -
    <p class="text-start">Start aligned text on all viewport sizes.</p>
    -<p class="text-center">Center aligned text on all viewport sizes.</p>
    -<p class="text-end">End aligned text on all viewport sizes.</p>
    -
    -<p class="text-sm-end">End aligned text on viewports sized SM (small) or wider.</p>
    -<p class="text-md-end">End aligned text on viewports sized MD (medium) or wider.</p>
    -<p class="text-lg-end">End aligned text on viewports sized LG (large) or wider.</p>
    -<p class="text-xl-end">End aligned text on viewports sized XL (extra large) or wider.</p>
    -<p class="text-xxl-end">End aligned text on viewports sized XXL (extra extra large) or wider.</p>
    -
    - -
    -Note that we don’t provide utility classes for justified text. While, aesthetically, justified text might look more appealing, it does make word-spacing more random and therefore harder to read. -
    - -

    Text wrapping and overflow

    +<p class="text-sm-end">End aligned text on viewports sized SM (small) or wider.</p> +<p class="text-md-end">End aligned text on viewports sized MD (medium) or wider.</p> +<p class="text-lg-end">End aligned text on viewports sized LG (large) or wider.</p> +<p class="text-xl-end">End aligned text on viewports sized XL (extra large) or wider.</p> +<p class="text-xxl-end">End aligned text on viewports sized XXL (extra extra large) or wider.</p>
    +

    Note that we don’t provide utility classes for justified text. While, aesthetically, justified text might look more appealing, it does make word-spacing more random and therefore harder to read.

    +

    Text wrapping and overflow

    Wrap text with a .text-wrap class.

    -
    -
    - -
    +
    This text should wrap. -
    - -
    - html -
    - - -
    -
    <div class="badge text-bg-primary text-wrap" style="width: 6rem;">
    -  This text should wrap.
    -</div>
    -
    - +
    html
    <div class="badge text-bg-primary text-wrap" style="width: 6rem;">
    +  This text should wrap.
    +</div>

    Prevent text from wrapping with a .text-nowrap class.

    -
    -
    - -
    +
    This text should overflow the parent. -
    - -
    - html -
    - - -
    -
    <div class="text-nowrap bg-body-secondary border" style="width: 8rem;">
    -  This text should overflow the parent.
    -</div>
    -
    - -

    Word break

    -

    Prevent long strings of text from breaking your components’ layout by using .text-break to set word-wrap: break-word and word-break: break-word. We use word-wrap instead of the more common overflow-wrap for wider browser support, and add the deprecated word-break: break-word to avoid issues with flex containers.

    -
    -
    - -

    mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

    - -
    - html -
    - - -
    -
    <p class="text-break">mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm</p>
    -
    - -
    -Note that breaking words isn’t possible in Arabic, which is the most used RTL language. Therefore .text-break is removed from our RTL compiled CSS. -
    - -

    Text transform

    +
    html
    <div class="text-nowrap bg-body-secondary border" style="width: 8rem;">
    +  This text should overflow the parent.
    +</div>
    +

    Word break

    +

    Prevent long strings of text from breaking your components’ layout by using .text-break to set word-wrap: break-word and word-break: break-word. We use word-wrap instead of the more common overflow-wrap for wider browser support, and add the deprecated word-break: break-word to avoid issues with flex containers.

    +

    mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

    html
    <p class="text-break">mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm</p>
    +

    Note that breaking words isn’t possible in Arabic, which is the most used RTL language. Therefore .text-break is removed from our RTL compiled CSS.

    +

    Text transform

    Transform text in components with our text capitalization classes: text-lowercase, text-uppercase or text-capitalize.

    -
    -
    - -

    Lowercased text.

    +

    Lowercased text.

    Uppercased text.

    -

    CapiTaliZed text.

    - -
    - html -
    - - -
    -
    <p class="text-lowercase">Lowercased text.</p>
    -<p class="text-uppercase">Uppercased text.</p>
    -<p class="text-capitalize">CapiTaliZed text.</p>
    -
    - +

    CapiTaliZed text.

    html
    <p class="text-lowercase">Lowercased text.</p>
    +<p class="text-uppercase">Uppercased text.</p>
    +<p class="text-capitalize">CapiTaliZed text.</p>

    Note how .text-capitalize only changes the first letter of each word, leaving the case of any other letters unaffected.

    -

    Font size

    -

    Quickly change the font-size of text. While our heading classes (e.g., .h1.h6) apply font-size, font-weight, and line-height, these utilities only apply font-size. Sizing for these utilities matches HTML’s heading elements, so as the number increases, their size decreases.

    -
    -
    - -

    .fs-1 text

    +

    Font size

    +

    Quickly change the font-size of text. While our heading classes (e.g., .h1.h6) apply font-size, font-weight, and line-height, these utilities only apply font-size. Sizing for these utilities matches HTML’s heading elements, so as the number increases, their size decreases.

    +

    .fs-1 text

    .fs-2 text

    .fs-3 text

    .fs-4 text

    .fs-5 text

    -

    .fs-6 text

    - -
    - html -
    - - -
    -
    <p class="fs-1">.fs-1 text</p>
    -<p class="fs-2">.fs-2 text</p>
    -<p class="fs-3">.fs-3 text</p>
    -<p class="fs-4">.fs-4 text</p>
    -<p class="fs-5">.fs-5 text</p>
    -<p class="fs-6">.fs-6 text</p>
    -
    - +

    .fs-6 text

    html
    <p class="fs-1">.fs-1 text</p>
    +<p class="fs-2">.fs-2 text</p>
    +<p class="fs-3">.fs-3 text</p>
    +<p class="fs-4">.fs-4 text</p>
    +<p class="fs-5">.fs-5 text</p>
    +<p class="fs-6">.fs-6 text</p>

    Customize your available font-sizes by modifying the $font-sizes Sass map.

    -

    Font weight and italics

    +

    Font weight and italics

    Quickly change the font-weight or font-style of text with these utilities. font-style utilities are abbreviated as .fst-* and font-weight utilities are abbreviated as .fw-*.

    -
    -
    html
    <p class="fw-bold">Bold text.</p>
    +<p class="fw-bolder">Bolder weight text (relative to the parent element).</p>
    +<p class="fw-semibold">Semibold weight text.</p>
    +<p class="fw-medium">Medium weight text.</p>
    +<p class="fw-normal">Normal weight text.</p>
    +<p class="fw-light">Light weight text.</p>
    +<p class="fw-lighter">Lighter weight text (relative to the parent element).</p>
    +<p class="fst-italic">Italic text.</p>
    +<p class="fst-normal">Text with normal font style</p>
    +

    Line height

    Change the line height with .lh-* utilities.

    -
    -
    - -

    This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.

    +

    This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.

    This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.

    This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.

    -

    This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.

    - -
    - html -
    - - -
    -
    <p class="lh-1">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
    -<p class="lh-sm">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
    -<p class="lh-base">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
    -<p class="lh-lg">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
    -
    - -

    Monospace

    +

    This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.

    html
    <p class="lh-1">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
    +<p class="lh-sm">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
    +<p class="lh-base">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
    +<p class="lh-lg">This is a long paragraph written to show how the line-height of an element is affected by our utilities. Classes are applied to the element itself or sometimes the parent element. These classes can be customized as needed with our utility API.</p>
    +

    Monospace

    Change a selection to our monospace font stack with .font-monospace.

    -
    -
    - -

    This is in monospace

    - -
    - html -
    - - -
    -
    <p class="font-monospace">This is in monospace</p>
    -
    - -

    Reset color

    -

    Reset a text or link’s color with .text-reset, so that it inherits the color from its parent.

    -
    -
    - -

    +

    This is in monospace

    html
    <p class="font-monospace">This is in monospace</p>
    +

    Reset color

    +

    Reset a text or link’s color with .text-reset, so that it inherits the color from its parent.

    +

    Secondary body text with a reset link. -

    - -
    - html -
    - - -
    -
    <p class="text-body-secondary">
    -  Secondary body text with a <a href="#" class="text-reset">reset link</a>.
    -</p>
    -
    - -

    Text decoration

    +

    html
    <p class="text-body-secondary">
    +  Secondary body text with a <a href="#" class="text-reset">reset link</a>.
    +</p>
    +

    Text decoration

    Decorate text in components with text decoration classes.

    -
    -
    - -

    This text has a line underneath it.

    +

    This text has a line underneath it.

    This text has a line going through it.

    -This link has its text decoration removed - -
    - html -
    - - -
    -
    <p class="text-decoration-underline">This text has a line underneath it.</p>
    -<p class="text-decoration-line-through">This text has a line going through it.</p>
    -<a href="#" class="text-decoration-none">This link has its text decoration removed</a>
    -
    - -

    CSS

    -

    Sass variables

    +This link has its text decoration removed
    html
    <p class="text-decoration-underline">This text has a line underneath it.</p>
    +<p class="text-decoration-line-through">This text has a line going through it.</p>
    +<a href="#" class="text-decoration-none">This link has its text decoration removed</a>
    +

    CSS

    +

    Sass variables

    Default type and font related Sass variables:

    -
    -
    - scss/_variables.scss -
    - -
    -
    // stylelint-disable value-keyword-case
    -$font-family-sans-serif:      system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    -$font-family-monospace:       SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    -// stylelint-enable value-keyword-case
    -$font-family-base:            var(--#{$prefix}font-sans-serif);
    -$font-family-code:            var(--#{$prefix}font-monospace);
    -
    -// $font-size-root affects the value of `rem`, which is used for as well font sizes, paddings, and margins
    -// $font-size-base affects the font size of the body text
    -$font-size-root:              null;
    -$font-size-base:              1rem; // Assumes the browser default, typically `16px`
    -$font-size-sm:                $font-size-base * .875;
    -$font-size-lg:                $font-size-base * 1.25;
    -
    -$font-weight-lighter:         lighter;
    -$font-weight-light:           300;
    -$font-weight-normal:          400;
    -$font-weight-medium:          500;
    -$font-weight-semibold:        600;
    -$font-weight-bold:            700;
    -$font-weight-bolder:          bolder;
    -
    -$font-weight-base:            $font-weight-normal;
    -
    -$line-height-base:            1.5;
    -$line-height-sm:              1.25;
    -$line-height-lg:              2;
    -
    -$h1-font-size:                $font-size-base * 2.5;
    -$h2-font-size:                $font-size-base * 2;
    -$h3-font-size:                $font-size-base * 1.75;
    -$h4-font-size:                $font-size-base * 1.5;
    -$h5-font-size:                $font-size-base * 1.25;
    -$h6-font-size:                $font-size-base;
    -
    -

    Sass maps

    +
    // stylelint-disable value-keyword-case
    +$font-family-sans-serif:      system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    +$font-family-monospace:       SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    +// stylelint-enable value-keyword-case
    +$font-family-base:            var(--#{$prefix}font-sans-serif);
    +$font-family-code:            var(--#{$prefix}font-monospace);
    +
    +// $font-size-root affects the value of `rem`, which is used for as well font sizes, paddings, and margins
    +// $font-size-base affects the font size of the body text
    +$font-size-root:              null;
    +$font-size-base:              1rem; // Assumes the browser default, typically `16px`
    +$font-size-sm:                $font-size-base * .875;
    +$font-size-lg:                $font-size-base * 1.25;
    +
    +$font-weight-lighter:         lighter;
    +$font-weight-light:           300;
    +$font-weight-normal:          400;
    +$font-weight-medium:          500;
    +$font-weight-semibold:        600;
    +$font-weight-bold:            700;
    +$font-weight-bolder:          bolder;
    +
    +$font-weight-base:            $font-weight-normal;
    +
    +$line-height-base:            1.5;
    +$line-height-sm:              1.25;
    +$line-height-lg:              2;
    +
    +$h1-font-size:                $font-size-base * 2.5;
    +$h2-font-size:                $font-size-base * 2;
    +$h3-font-size:                $font-size-base * 1.75;
    +$h4-font-size:                $font-size-base * 1.5;
    +$h5-font-size:                $font-size-base * 1.25;
    +$h6-font-size:                $font-size-base;
    +
    +

    Sass maps

    Font-size utilities are generated from this map, in combination with our utilities API.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $font-sizes: (
    -  1: $h1-font-size,
    -  2: $h2-font-size,
    -  3: $h3-font-size,
    -  4: $h4-font-size,
    -  5: $h5-font-size,
    -  6: $h6-font-size
    -);
    -
    -
    -
    - scss/_maps.scss -
    - -
    -
    $theme-colors-text: (
    -  "primary": $primary-text-emphasis,
    -  "secondary": $secondary-text-emphasis,
    -  "success": $success-text-emphasis,
    -  "info": $info-text-emphasis,
    -  "warning": $warning-text-emphasis,
    -  "danger": $danger-text-emphasis,
    -  "light": $light-text-emphasis,
    -  "dark": $dark-text-emphasis,
    -);
    -
    -

    Sass utilities API

    -

    Font and text utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "font-family": (
    -  property: font-family,
    -  class: font,
    -  values: (monospace: var(--#{$prefix}font-monospace))
    -),
    -"font-size": (
    -  rfs: true,
    -  property: font-size,
    -  class: fs,
    -  values: $font-sizes
    -),
    -"font-style": (
    -  property: font-style,
    -  class: fst,
    -  values: italic normal
    -),
    -"font-weight": (
    -  property: font-weight,
    -  class: fw,
    -  values: (
    -    lighter: $font-weight-lighter,
    -    light: $font-weight-light,
    -    normal: $font-weight-normal,
    -    medium: $font-weight-medium,
    -    semibold: $font-weight-semibold,
    -    bold: $font-weight-bold,
    -    bolder: $font-weight-bolder
    -  )
    -),
    -"line-height": (
    -  property: line-height,
    -  class: lh,
    -  values: (
    -    1: 1,
    -    sm: $line-height-sm,
    -    base: $line-height-base,
    -    lg: $line-height-lg,
    -  )
    -),
    -"text-align": (
    -  responsive: true,
    -  property: text-align,
    -  class: text,
    -  values: (
    -    start: left,
    -    end: right,
    -    center: center,
    -  )
    -),
    -"text-decoration": (
    -  property: text-decoration,
    -  values: none underline line-through
    -),
    -"text-transform": (
    -  property: text-transform,
    -  class: text,
    -  values: lowercase uppercase capitalize
    -),
    -"white-space": (
    -  property: white-space,
    -  class: text,
    -  values: (
    -    wrap: normal,
    -    nowrap: nowrap,
    -  )
    -),
    -"word-wrap": (
    -  property: word-wrap word-break,
    -  class: text,
    -  values: (break: break-word),
    -  rtl: false
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    $font-sizes: (
    +  1: $h1-font-size,
    +  2: $h2-font-size,
    +  3: $h3-font-size,
    +  4: $h4-font-size,
    +  5: $h5-font-size,
    +  6: $h6-font-size
    +);
    +
    +
    $theme-colors-text: (
    +  "primary": $primary-text-emphasis,
    +  "secondary": $secondary-text-emphasis,
    +  "success": $success-text-emphasis,
    +  "info": $info-text-emphasis,
    +  "warning": $warning-text-emphasis,
    +  "danger": $danger-text-emphasis,
    +  "light": $light-text-emphasis,
    +  "dark": $dark-text-emphasis,
    +);
    +
    +

    Sass utilities API

    +

    Font and text utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "font-family": (
    +  property: font-family,
    +  class: font,
    +  values: (monospace: var(--#{$prefix}font-monospace))
    +),
    +"font-size": (
    +  rfs: true,
    +  property: font-size,
    +  class: fs,
    +  values: $font-sizes
    +),
    +"font-style": (
    +  property: font-style,
    +  class: fst,
    +  values: italic normal
    +),
    +"font-weight": (
    +  property: font-weight,
    +  class: fw,
    +  values: (
    +    lighter: $font-weight-lighter,
    +    light: $font-weight-light,
    +    normal: $font-weight-normal,
    +    medium: $font-weight-medium,
    +    semibold: $font-weight-semibold,
    +    bold: $font-weight-bold,
    +    bolder: $font-weight-bolder
    +  )
    +),
    +"line-height": (
    +  property: line-height,
    +  class: lh,
    +  values: (
    +    1: 1,
    +    sm: $line-height-sm,
    +    base: $line-height-base,
    +    lg: $line-height-lg,
    +  )
    +),
    +"text-align": (
    +  responsive: true,
    +  property: text-align,
    +  class: text,
    +  values: (
    +    start: left,
    +    end: right,
    +    center: center,
    +  )
    +),
    +"text-decoration": (
    +  property: text-decoration,
    +  values: none underline line-through
    +),
    +"text-transform": (
    +  property: text-transform,
    +  class: text,
    +  values: lowercase uppercase capitalize
    +),
    +"white-space": (
    +  property: white-space,
    +  class: text,
    +  values: (
    +    wrap: normal,
    +    nowrap: nowrap,
    +  )
    +),
    +"word-wrap": (
    +  property: word-wrap word-break,
    +  class: text,
    +  values: (break: break-word),
    +  rtl: false
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/vertical-align/index.html b/docs/5.3/utilities/vertical-align/index.html index f574f2b9d9..1e5691109d 100644 --- a/docs/5.3/utilities/vertical-align/index.html +++ b/docs/5.3/utilities/vertical-align/index.html @@ -1,580 +1,41 @@ - - - - - - - - - - - - - - - - -Vertical alignment · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Vertical alignment

    -
    -

    Easily change the vertical alignment of inline, inline-block, inline-table, and table cell elements.

    - - -
    - - - -
    - - -

    Change the alignment of elements with the vertical-alignment utilities. Please note that vertical-align only affects inline, inline-block, inline-table, and table cell elements.

    + Vertical alignment · Bootstrap v5.3

    Vertical alignment

    Easily change the vertical alignment of inline, inline-block, inline-table, and table cell elements.

    +

    Change the alignment of elements with the vertical-alignment utilities. Please note that vertical-align only affects inline, inline-block, inline-table, and table cell elements.

    Choose from .align-baseline, .align-top, .align-middle, .align-bottom, .align-text-bottom, and .align-text-top as needed.

    -

    To vertically center non-inline content (like <div>s and more), use our flex box utilities.

    +

    To vertically center non-inline content (like <div>s and more), use our flex box utilities.

    With inline elements:

    -
    -
    - -baseline +
    baseline top middle bottom text-top -text-bottom - -
    - html -
    - - -
    -
    <span class="align-baseline">baseline</span>
    -<span class="align-top">top</span>
    -<span class="align-middle">middle</span>
    -<span class="align-bottom">bottom</span>
    -<span class="align-text-top">text-top</span>
    -<span class="align-text-bottom">text-bottom</span>
    -
    - +text-bottom
    html
    <span class="align-baseline">baseline</span>
    +<span class="align-top">top</span>
    +<span class="align-middle">middle</span>
    +<span class="align-bottom">bottom</span>
    +<span class="align-text-top">text-top</span>
    +<span class="align-text-bottom">text-bottom</span>

    With table cells:

    -
    -
    - - +
    @@ -585,122 +46,28 @@ -
    baselinetext-bottom
    - -
    - html -
    - - -
    -
    <table style="height: 100px;">
    -  <tbody>
    -    <tr>
    -      <td class="align-baseline">baseline</td>
    -      <td class="align-top">top</td>
    -      <td class="align-middle">middle</td>
    -      <td class="align-bottom">bottom</td>
    -      <td class="align-text-top">text-top</td>
    -      <td class="align-text-bottom">text-bottom</td>
    -    </tr>
    -  </tbody>
    -</table>
    -
    - -

    CSS

    -

    Sass utilities API

    -

    Vertical align utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "align": (
    -  property: vertical-align,
    -  class: align,
    -  values: baseline top middle bottom text-bottom text-top
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    html
    <table style="height: 100px;">
    +  <tbody>
    +    <tr>
    +      <td class="align-baseline">baseline</td>
    +      <td class="align-top">top</td>
    +      <td class="align-middle">middle</td>
    +      <td class="align-bottom">bottom</td>
    +      <td class="align-text-top">text-top</td>
    +      <td class="align-text-bottom">text-bottom</td>
    +    </tr>
    +  </tbody>
    +</table>
    +

    CSS

    +

    Sass utilities API

    +

    Vertical align utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "align": (
    +  property: vertical-align,
    +  class: align,
    +  values: baseline top middle bottom text-bottom text-top
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/visibility/index.html b/docs/5.3/utilities/visibility/index.html index 9905c6aebe..b5838ed09b 100644 --- a/docs/5.3/utilities/visibility/index.html +++ b/docs/5.3/utilities/visibility/index.html @@ -1,651 +1,51 @@ - - - - - - - - - - - - - - - - -Visibility · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    - -

    Visibility

    -
    -

    Control the visibility of elements, without modifying their display, with visibility utilities.

    - - -
    - - - -
    - - -

    Set the visibility of elements with our visibility utilities. These utility classes do not modify the display value at all and do not affect layout – .invisible elements still take up space in the page.

    -
    -Elements with the .invisible class will be hidden both visually and for assistive technology/screen reader users. -
    - + Visibility · Bootstrap v5.3

    Visibility

    Control the visibility of elements, without modifying their display, with visibility utilities.

    +

    Set the visibility of elements with our visibility utilities. These utility classes do not modify the display value at all and do not affect layout – .invisible elements still take up space in the page.

    +

    Elements with the .invisible class will be hidden both visually and for assistive technology/screen reader users.

    Apply .visible or .invisible as needed.

    -
    <div class="visible">...</div>
    -<div class="invisible">...</div>
    -
    // Class
    -.visible {
    -  visibility: visible !important;
    -}
    -.invisible {
    -  visibility: hidden !important;
    -}
    -

    CSS

    -

    Sass utilities API

    -

    Visibility utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "visibility": (
    -  property: visibility,
    -  class: null,
    -  values: (
    -    visible: visible,
    -    invisible: hidden,
    -  )
    -),
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    <div class="visible">...</div>
    +<div class="invisible">...</div>
    +
    +
    // Class
    +.visible {
    +  visibility: visible !important;
    +}
    +.invisible {
    +  visibility: hidden !important;
    +}
    +
    +

    CSS

    +

    Sass utilities API

    +

    Visibility utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "visibility": (
    +  property: visibility,
    +  class: null,
    +  values: (
    +    visible: visible,
    +    invisible: hidden,
    +  )
    +),
    +
    \ No newline at end of file diff --git a/docs/5.3/utilities/z-index/index.html b/docs/5.3/utilities/z-index/index.html index f31d2fb19d..46f1c0d615 100644 --- a/docs/5.3/utilities/z-index/index.html +++ b/docs/5.3/utilities/z-index/index.html @@ -1,713 +1,59 @@ - - - - - - - - - - - - - - - - -Z-index · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - - -
    -
    -
    -
    Added in v5.3 - View on GitHub - -
    -

    Z-index

    -
    -

    Use our low-level z-index utilities to quickly change the stack level of an element or component.

    - - -
    - - -
    - - On this page -
    - -
    - - -
    - - -

    Example

    + Z-index · Bootstrap v5.3
    +Added in v5.3 +View on GitHub +

    Z-index

    Use our low-level z-index utilities to quickly change the stack level of an element or component.

    +

    Example

    Use z-index utilities to stack elements on top of one another. Requires a position value other than static, which can be set with custom styles or using our position utilities.

    -
    -We call these “low-level” z-index utilities because of their default values of -1 through 3, which we use for the layout of overlapping components. High-level z-index values are used for overlay components like modals and tooltips. -
    - -
    -
    - -
    z-3
    +

    We call these “low-level” z-index utilities because of their default values of -1 through 3, which we use for the layout of overlapping components. High-level z-index values are used for overlay components like modals and tooltips.

    +
    z-3
    z-2
    z-1
    z-0
    -
    z-n1
    - -
    - html -
    - - -
    -
    <div class="z-3 position-absolute p-5 rounded-3"><span>z-3</span></div>
    -<div class="z-2 position-absolute p-5 rounded-3"><span>z-2</span></div>
    -<div class="z-1 position-absolute p-5 rounded-3"><span>z-1</span></div>
    -<div class="z-0 position-absolute p-5 rounded-3"><span>z-0</span></div>
    -<div class="z-n1 position-absolute p-5 rounded-3"><span>z-n1</span></div>
    -
    - -

    Overlays

    -

    Bootstrap overlay components—dropdown, modal, offcanvas, popover, toast, and tooltip—all have their own z-index values to ensure a usable experience with competing “layers” of an interface.

    -

    Read about them in the z-index layout page.

    -

    Component approach

    +
    z-n1
    html
    <div class="z-3 position-absolute p-5 rounded-3"><span>z-3</span></div>
    +<div class="z-2 position-absolute p-5 rounded-3"><span>z-2</span></div>
    +<div class="z-1 position-absolute p-5 rounded-3"><span>z-1</span></div>
    +<div class="z-0 position-absolute p-5 rounded-3"><span>z-0</span></div>
    +<div class="z-n1 position-absolute p-5 rounded-3"><span>z-n1</span></div>
    +

    Overlays

    +

    Bootstrap overlay components—dropdown, modal, offcanvas, popover, toast, and tooltip—all have their own z-index values to ensure a usable experience with competing “layers” of an interface.

    +

    Read about them in the z-index layout page.

    +

    Component approach

    On some components, we use our low-level z-index values to manage repeating elements that overlap one another (like buttons in a button group or items in a list group).

    -

    Learn about our z-index approach.

    -

    CSS

    -

    Sass maps

    +

    Learn about our z-index approach.

    +

    CSS

    +

    Sass maps

    Customize this Sass map to change the available values and generated utilities.

    -
    -
    - scss/_variables.scss -
    - -
    -
    $zindex-levels: (
    -  n1: -1,
    -  0: 0,
    -  1: 1,
    -  2: 2,
    -  3: 3
    -);
    -
    -

    Sass utilities API

    -

    Position utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    -
    -
    - scss/_utilities.scss -
    - -
    -
    "z-index": (
    -  property: z-index,
    -  class: z,
    -  values: $zindex-levels,
    -)
    - -
    -
    -
    - - - - - - - - - - - - - - - +
    $zindex-levels: (
    +  n1: -1,
    +  0: 0,
    +  1: 1,
    +  2: 2,
    +  3: 3
    +);
    +
    +

    Sass utilities API

    +

    Position utilities are declared in our utilities API in scss/_utilities.scss. Learn how to use the utilities API.

    +
    "z-index": (
    +  property: z-index,
    +  class: z,
    +  values: $zindex-levels,
    +)
    +
    \ No newline at end of file diff --git a/docs/getting-started/index.html b/docs/getting-started/index.html index 349df656a8..77668bc23d 100644 --- a/docs/getting-started/index.html +++ b/docs/getting-started/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/getting-started/introduction/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 349df656a8..b2e5f03e22 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/getting-started/introduction/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/docs/versions/index.html b/docs/versions/index.html index bdd75caade..585a3f4281 100644 --- a/docs/versions/index.html +++ b/docs/versions/index.html @@ -1,604 +1,21 @@ - - - - - - - - - - - - - - - - -Versions · Bootstrap v5.3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    -

    Versions

    -

    An appendix of hosted documentation for nearly every release of Bootstrap, from v1 through v5.

    - -
    -
    - - -
    -
    -
    -
    - -
    -
    - -
    -
    -

    v5.x

    -

    Current major release. Last update was v5.3.5.

    -
    - -
    -

    v4.x

    -

    Our previous major release with its minor releases. Last update was v4.6.2.

    -
    - -
    -

    v3.x

    -

    Every minor release from v3 is listed below. Last update was v3.4.1.

    -
    - -
    -

    v2.x

    -

    Every minor and patch release from v2 is listed below.

    -
    - -
    -

    v1.x

    -

    Every minor and patch release from v1 is listed below.

    -
    -
    - - - - -
    -
    - - - - - - - - - - - - - + Versions · Bootstrap v5.3

    Versions

    An appendix of hosted documentation for nearly every release of Bootstrap, from v1 through v5.

    v5.x

    Current major release. Last update was v5.3.5.

    v4.x

    Our previous major release with its minor releases. Last update was v4.6.2.

    v3.x

    Every minor release from v3 is listed below. Last update was v3.4.1.

    v1.x

    Every minor and patch release from v1 is listed below.

    \ No newline at end of file diff --git a/docsref/index.html b/docsref/index.html index 92d31ba7e2..edb45fd414 100644 --- a/docsref/index.html +++ b/docsref/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/docsref/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/examples/blog/index.html b/examples/blog/index.html deleted file mode 100644 index 16c5e15335..0000000000 --- a/examples/blog/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/carousel/index.html b/examples/carousel/index.html deleted file mode 100644 index de1ada7f95..0000000000 --- a/examples/carousel/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/cover/index.html b/examples/cover/index.html deleted file mode 100644 index da46e3986b..0000000000 --- a/examples/cover/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/dashboard/index.html b/examples/dashboard/index.html deleted file mode 100644 index d407d7c71e..0000000000 --- a/examples/dashboard/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/grid/index.html b/examples/grid/index.html deleted file mode 100644 index a6224e7d31..0000000000 --- a/examples/grid/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/index.html b/examples/index.html index e4db458d4a..2c88cbb27d 100644 --- a/examples/index.html +++ b/examples/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/examples/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/examples/jumbotron-narrow/index.html b/examples/jumbotron-narrow/index.html deleted file mode 100644 index 4cf9b3a875..0000000000 --- a/examples/jumbotron-narrow/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/jumbotron/index.html b/examples/jumbotron/index.html deleted file mode 100644 index 30ca77673e..0000000000 --- a/examples/jumbotron/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/justified-nav/index.html b/examples/justified-nav/index.html deleted file mode 100644 index 57461b77e8..0000000000 --- a/examples/justified-nav/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/navbar-fixed-top/index.html b/examples/navbar-fixed-top/index.html deleted file mode 100644 index d1c8466b58..0000000000 --- a/examples/navbar-fixed-top/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/navbar-static-top/index.html b/examples/navbar-static-top/index.html deleted file mode 100644 index 89edf9874f..0000000000 --- a/examples/navbar-static-top/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/navbar/index.html b/examples/navbar/index.html deleted file mode 100644 index 43d677f805..0000000000 --- a/examples/navbar/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/non-responsive/index.html b/examples/non-responsive/index.html deleted file mode 100644 index b4b1756f48..0000000000 --- a/examples/non-responsive/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/offcanvas/index.html b/examples/offcanvas/index.html deleted file mode 100644 index daf48fa468..0000000000 --- a/examples/offcanvas/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/signin/index.html b/examples/signin/index.html deleted file mode 100644 index bf4a79e49d..0000000000 --- a/examples/signin/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/starter-template/index.html b/examples/starter-template/index.html deleted file mode 100644 index 883f86ee4d..0000000000 --- a/examples/starter-template/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/sticky-footer-navbar/index.html b/examples/sticky-footer-navbar/index.html deleted file mode 100644 index ce063820cc..0000000000 --- a/examples/sticky-footer-navbar/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/sticky-footer/index.html b/examples/sticky-footer/index.html deleted file mode 100644 index 5aed843575..0000000000 --- a/examples/sticky-footer/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/theme/index.html b/examples/theme/index.html deleted file mode 100644 index 0b34bc7eab..0000000000 --- a/examples/theme/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/examples/tooltip-viewport/index.html b/examples/tooltip-viewport/index.html deleted file mode 100644 index 343bcde83d..0000000000 --- a/examples/tooltip-viewport/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - Redirecting… - - - - -

    Redirecting…

    - Click here if you are not redirected. - diff --git a/getting-started/index.html b/getting-started/index.html index 349df656a8..77668bc23d 100644 --- a/getting-started/index.html +++ b/getting-started/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/getting-started/introduction/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/index.html b/index.html index 13f2c17b6b..5c12da27cf 100644 --- a/index.html +++ b/index.html @@ -1,866 +1,176 @@ - - - - - - - - + Bootstrap · The most popular HTML, CSS, and JS library in the world.
    +Get Security Updates for Bootstrap 3 & 4 + Bootstrap

    Build fast, responsive sites with Bootstrap

    +Powerful, extensible, and feature-packed frontend toolkit. Build and customize with Sass, utilize prebuilt grid + system and components, and bring projects to life with powerful JavaScript plugins. +

    npm i bootstrap@5.3.5
    +Read the docs +

    +Currently v5.3.5 · Download · All releases

    Get started any way you want

    +Jump right into building with Bootstrap—use the CDN, install it via package manager, or download the source code. +

    +Read installation docs +

    Install via package manager

    +Install Bootstrap’s source Sass and JavaScript files via npm, RubyGems, Composer, or Meteor. Package-managed + installs don’t include documentation or our full build scripts. You can also use any demo from our Examples repo to quickly jumpstart Bootstrap projects. +

    npm install bootstrap@5.3.5
    gem install bootstrap -v 5.3.5

    Read our installation docs for more info and additional + package managers. +

    Include via CDN

    +When you only need to include Bootstrap’s compiled CSS or JS, you can use jsDelivr. See it in action with our simple quick start, or browse the examples to jumpstart your next project. You can also + choose to include Popper and our JS separately. +

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-SgOJa3DmI69IUzQ2PVdRZhwQ+dy64/BUtbMJw1MZ8t5HZApcHrRKUc4W0kG879m7" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.bundle.min.js" integrity="sha384-k6d4wzSIapyDyv1kpU366/PK5hCdSbCRGRCMv+eplOQJWyd1fbcAu9OCUj5zNLiq" crossorigin="anonymous"></script>

    Read our getting started guides

    Get a jump on including Bootstrap's source files in a new project with our official guides.

    Customize everything with Sass

    +Bootstrap utilizes Sass for a modular and customizable architecture. Import only the components you need, enable + global options like gradients and shadows, and write your own CSS with our variables, maps, functions, and mixins. +

    +Learn more about customizing +

    Include all of Bootstrap’s Sass

    Import one stylesheet and you're off to the races with every feature of our CSS.

    // Variable overrides first
    +$primary: #900;
    +$enable-shadows: true;
    +$prefix: "mo-";
     
    -
    -
    +// Then import Bootstrap
    +@import "../node_modules/bootstrap/scss/bootstrap";

    Learn more about our global Sass options.

    Include what you need

    The easiest way to customize Bootstrap—include only the CSS you need.

    // Functions first
    +@import "../node_modules/bootstrap/scss/functions";
     
    -
    +// Variable overrides second
    +$primary: #900;
    +$enable-shadows: true;
    +$prefix: "mo-";
     
    -
    +// Required Bootstrap imports
    +@import "../node_modules/bootstrap/scss/variables";
    +@import "../node_modules/bootstrap/scss/variables-dark";
    +@import "../node_modules/bootstrap/scss/maps";
    +@import "../node_modules/bootstrap/scss/mixins";
    +@import "../node_modules/bootstrap/scss/root";
     
    -Bootstrap · The most popular HTML, CSS, and JS library in the world.
    +// Optional components
    +@import "../node_modules/bootstrap/scss/utilities";
    +@import "../node_modules/bootstrap/scss/reboot";
    +@import "../node_modules/bootstrap/scss/containers";
    +@import "../node_modules/bootstrap/scss/grid";
    +@import "../node_modules/bootstrap/scss/helpers";
    +@import "../node_modules/bootstrap/scss/utilities/api";

    Learn more about using Bootstrap with Sass.

    Build and extend in real-time with CSS variables

    +Bootstrap 5 is evolving with each release to better utilize CSS variables for global theme styles, individual + components, and even utilities. We provide dozens of variables for colors, font styles, and more at a :root level for use anywhere. On components and utilities, CSS variables are scoped to the relevant class and can easily + be modified. +

    +Learn more about CSS variables +

    Using CSS variables

    +Use any of our global :root variables to write new styles. CSS variables use the var(--bs-variableName) syntax and can be inherited by children + elements. +

    .component {
    +  color: var(--bs-gray-800);
    +  background-color: var(--bs-gray-100);
    +  border: 1px solid var(--bs-gray-200);
    +  border-radius: .25rem;
    +}
     
    -
    +.component-header {
    +  color: var(--bs-purple);
    +}

    Customizing via CSS variables

    +Override global, component, or utility class variables to customize Bootstrap just how you like. No need to + redeclare each rule, just a new variable value. +

    body {
    +  --bs-body-font-family: var(--bs-font-monospace);
    +  --bs-body-line-height: 1.4;
    +  --bs-body-bg: var(--bs-gray-100);
    +}
     
    -
    -
    +.table {
    +  --bs-table-color: var(--bs-gray-600);
    +  --bs-table-bg: var(--bs-gray-100);
    +  --bs-table-border-color: transparent;
    +}

    Components, meet the Utility API

    +New in Bootstrap 5, our utilities are now generated by our Utility API. We built it as a feature-packed Sass map that can be quickly and easily customized. It's never been easier to + add, remove, or modify any utility classes. Make utilities responsive, add pseudo-class variants, and give them + custom names. +

    Quickly customize components

    +Apply any of our included utility classes to our components to customize their appearance, like the navigation + example below. There are hundreds of classes available—from positioning and sizing to colors and effects. Mix them with CSS variable overrides for + even more control. +

    <ul class="nav nav-pills nav-fill gap-2 p-1 small bg-primary rounded-5 shadow-sm" id="pillNav2" role="tablist" style="--bs-nav-link-color: var(--bs-white); --bs-nav-pills-link-active-color: var(--bs-primary); --bs-nav-pills-link-active-bg: var(--bs-white);">
    +  <li class="nav-item" role="presentation">
    +    <button class="nav-link active rounded-5" id="home-tab2" data-bs-toggle="tab" type="button" role="tab" aria-selected="true">Home</button>
    +  </li>
    +  <li class="nav-item" role="presentation">
    +    <button class="nav-link rounded-5" id="profile-tab2" data-bs-toggle="tab" type="button" role="tab" aria-selected="false">Profile</button>
    +  </li>
    +  <li class="nav-item" role="presentation">
    +    <button class="nav-link rounded-5" id="contact-tab2" data-bs-toggle="tab" type="button" role="tab" aria-selected="false">Contact</button>
    +  </li>
    +</ul>

    +Explore customized components +

    Create and extend utilities

    +Use Bootstrap's utility API to modify any of our included utilities or create your own custom utilities for any + project. Import Bootstrap first, then use Sass map functions to modify, add, or remove utilities. +

    @import "bootstrap/scss/bootstrap";
     
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -  
    -  
    -    
    -
    -    
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -    
    -  
    -  
    -    
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -  
    -    
    -  
    -
    -
    -
    -    
    -
    -
    -    
    -  
    -
    -
    -
    - - - Get Security Updates for Bootstrap 3 & 4 - - - - -Bootstrap - -

    Build fast, responsive sites with Bootstrap

    -

    - Powerful, extensible, and feature-packed frontend toolkit. Build and customize with Sass, utilize prebuilt grid system and components, and bring projects to life with powerful JavaScript plugins. -

    -
    -
    -
    npm i bootstrap@5.3.5
    -
    - - - Read the docs - -
    -

    - Currently v5.3.5 - · - Download - · - All releases -

    - - -
    -
    -
    - -
    -
    -
    - -
    -

    Get started any way you want

    -

    - Jump right into building with Bootstrap—use the CDN, install it via package manager, or download the source code. -

    -

    - - Read installation docs - - -

    -
    - -
    -
    - -

    Install via package manager

    -

    - Install Bootstrap’s source Sass and JavaScript files via npm, RubyGems, Composer, or Meteor. Package-managed installs don’t include documentation or our full build scripts. You can also use any demo from our Examples repo to quickly jumpstart Bootstrap projects. -

    -
    npm install bootstrap@5.3.5
    -
    gem install bootstrap -v 5.3.5
    -

    - Read our installation docs for more info and additional package managers. -

    -
    -
    - -

    Include via CDN

    -

    - When you only need to include Bootstrap’s compiled CSS or JS, you can use jsDelivr. See it in action with our simple quick start, or browse the examples to jumpstart your next project. You can also choose to include Popper and our JS separately. -

    -
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-SgOJa3DmI69IUzQ2PVdRZhwQ+dy64/BUtbMJw1MZ8t5HZApcHrRKUc4W0kG879m7" crossorigin="anonymous">
    -
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.5/dist/js/bootstrap.bundle.min.js" integrity="sha384-k6d4wzSIapyDyv1kpU366/PK5hCdSbCRGRCMv+eplOQJWyd1fbcAu9OCUj5zNLiq" crossorigin="anonymous"></script>
    -
    - -
    -

    Read our getting started guides

    -

    Get a jump on including Bootstrap's source files in a new project with our official guides.

    - -
    -
    - -
    -
    - -
    -

    Customize everything with Sass

    -

    - Bootstrap utilizes Sass for a modular and customizable architecture. Import only the components you need, enable global options like gradients and shadows, and write your own CSS with our variables, maps, functions, and mixins. -

    -

    - - Learn more about customizing - - -

    -
    - -
    -
    -

    Include all of Bootstrap’s Sass

    -

    Import one stylesheet and you're off to the races with every feature of our CSS.

    -
    // Variable overrides first
    -$primary: #900;
    -$enable-shadows: true;
    -$prefix: "mo-";
    -
    -// Then import Bootstrap
    -@import "../node_modules/bootstrap/scss/bootstrap";
    -
    -

    Learn more about our global Sass options.

    -
    -
    -

    Include what you need

    -

    The easiest way to customize Bootstrap—include only the CSS you need.

    -
    // Functions first
    -@import "../node_modules/bootstrap/scss/functions";
    -
    -// Variable overrides second
    -$primary: #900;
    -$enable-shadows: true;
    -$prefix: "mo-";
    -
    -// Required Bootstrap imports
    -@import "../node_modules/bootstrap/scss/variables";
    -@import "../node_modules/bootstrap/scss/variables-dark";
    -@import "../node_modules/bootstrap/scss/maps";
    -@import "../node_modules/bootstrap/scss/mixins";
    -@import "../node_modules/bootstrap/scss/root";
    -
    -// Optional components
    -@import "../node_modules/bootstrap/scss/utilities";
    -@import "../node_modules/bootstrap/scss/reboot";
    -@import "../node_modules/bootstrap/scss/containers";
    -@import "../node_modules/bootstrap/scss/grid";
    -@import "../node_modules/bootstrap/scss/helpers";
    -@import "../node_modules/bootstrap/scss/utilities/api";
    -
    -

    Learn more about using Bootstrap with Sass.

    -
    -
    - -
    -
    -
    - -
    -

    Build and extend in real-time with CSS variables

    -

    - Bootstrap 5 is evolving with each release to better utilize CSS variables for global theme styles, individual components, and even utilities. We provide dozens of variables for colors, font styles, and more at a :root level for use anywhere. On components and utilities, CSS variables are scoped to the relevant class and can easily be modified. -

    -

    - - Learn more about CSS variables - - -

    -
    -
    -
    -

    Using CSS variables

    -

    Use any of our global :root variables to write new styles. CSS variables use the var(--bs-variableName) syntax and can be inherited by children elements.

    -
    .component {
    -  color: var(--bs-gray-800);
    -  background-color: var(--bs-gray-100);
    -  border: 1px solid var(--bs-gray-200);
    -  border-radius: .25rem;
    -}
    -
    -.component-header {
    -  color: var(--bs-purple);
    -}
    -
    -
    -

    Customizing via CSS variables

    -

    Override global, component, or utility class variables to customize Bootstrap just how you like. No need to redeclare each rule, just a new variable value.

    -
    body {
    -  --bs-body-font-family: var(--bs-font-monospace);
    -  --bs-body-line-height: 1.4;
    -  --bs-body-bg: var(--bs-gray-100);
    -}
    -
    -.table {
    -  --bs-table-color: var(--bs-gray-600);
    -  --bs-table-bg: var(--bs-gray-100);
    -  --bs-table-border-color: transparent;
    -}
    -
    -
    -
    - -
    -
    -
    - -
    - -
    - -
    -

    Components, meet the Utility API

    -

    - New in Bootstrap 5, our utilities are now generated by our Utility API. We built it as a feature-packed Sass map that can be quickly and easily customized. It's never been easier to add, remove, or modify any utility classes. Make utilities responsive, add pseudo-class variants, and give them custom names. -

    -
    -
    -
    -

    Quickly customize components

    -

    Apply any of our included utility classes to our components to customize their appearance, like the navigation example below. There are hundreds of classes available—from positioning and sizing to colors and effects. Mix them with CSS variable overrides for even more control.

    -
    - - -
    -
    <ul class="nav nav-pills nav-fill gap-2 p-1 small bg-primary rounded-5 shadow-sm" id="pillNav2" role="tablist" style="--bs-nav-link-color: var(--bs-white); --bs-nav-pills-link-active-color: var(--bs-primary); --bs-nav-pills-link-active-bg: var(--bs-white);">
    -  <li class="nav-item" role="presentation">
    -    <button class="nav-link active rounded-5" id="home-tab2" data-bs-toggle="tab" type="button" role="tab" aria-selected="true">Home</button>
    -  </li>
    -  <li class="nav-item" role="presentation">
    -    <button class="nav-link rounded-5" id="profile-tab2" data-bs-toggle="tab" type="button" role="tab" aria-selected="false">Profile</button>
    -  </li>
    -  <li class="nav-item" role="presentation">
    -    <button class="nav-link rounded-5" id="contact-tab2" data-bs-toggle="tab" type="button" role="tab" aria-selected="false">Contact</button>
    -  </li>
    -</ul>
    -
    -

    - - Explore customized components - - -

    -
    -
    -

    Create and extend utilities

    -

    Use Bootstrap's utility API to modify any of our included utilities or create your own custom utilities for any project. Import Bootstrap first, then use Sass map functions to modify, add, or remove utilities.

    -
    @import "bootstrap/scss/bootstrap";
    -
    -$utilities: map-merge(
    -  $utilities,
    -  (
    -    "cursor": (
    -      property: cursor,
    -      class: cursor,
    -      responsive: true,
    -      values: auto pointer grab,
    -    )
    -  )
    -);
    -
    - -

    - - Explore the utility API - - -

    -
    -
    -
    - -
    -
    -
    - -
    -

    Powerful JavaScript plugins without jQuery

    -

    - Add toggleable hidden elements, modals and offcanvas menus, popovers and tooltips, and so much more—all without jQuery. Bootstrap's JavaScript is HTML-first, meaning most plugins are added with data attributes in your HTML. Need more control? Include individual plugins programmatically. -

    -

    - - Learn more about Bootstrap JavaScript - - -

    -
    -
    -
    -

    Data attribute API

    -

    Why write more JavaScript when you can write HTML? Nearly all of Bootstrap's JavaScript plugins feature a first-class data API, allowing you to use JavaScript just by adding data attributes.

    -
    - -
    - -
    <div class="dropdown">
    -  <button class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    -    Dropdown
    -  </button>
    -  <ul class="dropdown-menu">
    -    <li><button class="dropdown-item" type="button">Dropdown item</button></li>
    -    <li><button class="dropdown-item" type="button">Dropdown item</button></li>
    -    <li><button class="dropdown-item" type="button">Dropdown item</button></li>
    -  </ul>
    -</div>
    -
    -

    Learn more about our JavaScript as modules and using the programmatic API.

    -
    - -
    - -
    - -
    -
    -
    - - -
    -

    Personalize it with Bootstrap Icons

    -

    - Bootstrap Icons is an open source SVG icon library featuring over 1,800 glyphs, with more added every release. They're designed to work in any project, whether you use Bootstrap itself or not. Use them as SVGs or icon fonts—both options give you vector scaling and easy customization via CSS. -

    -

    - - Get Bootstrap Icons - - -

    -
    -
    - -Bootstrap Icons - -
    -
    - -
    -
    -
    - - -
    -

    Make it yours with official Bootstrap Themes

    -

    - Take Bootstrap to the next level with premium themes from the official Bootstrap Themes marketplace. Themes are built on Bootstrap as their own extended frameworks, rich with new components and plugins, documentation, and powerful build tools. -

    -

    - - Browse Bootstrap Themes - - -

    -
    -
    - -Bootstrap Themes - -
    -
    - -
    -
    - - - - - - - - - - - - - - - +$utilities: map-merge( + $utilities, + ( + "cursor": ( + property: cursor, + class: cursor, + responsive: true, + values: auto pointer grab, + ) + ) +);

    +Explore the utility API +

    Powerful JavaScript plugins without jQuery

    +Add toggleable hidden elements, modals and offcanvas menus, popovers and tooltips, and so much more—all without + jQuery. Bootstrap's JavaScript is HTML-first, meaning most plugins are added with data attributes in your + HTML. Need more control? Include individual plugins programmatically. +

    +Learn more about Bootstrap JavaScript +

    Data attribute API

    +Why write more JavaScript when you can write HTML? Nearly all of Bootstrap's JavaScript plugins feature a + first-class data API, allowing you to use JavaScript just by adding data attributes. +

    <div class="dropdown">
    +  <button class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
    +    Dropdown
    +  </button>
    +  <ul class="dropdown-menu">
    +    <li><button class="dropdown-item" type="button">Dropdown item</button></li>
    +    <li><button class="dropdown-item" type="button">Dropdown item</button></li>
    +    <li><button class="dropdown-item" type="button">Dropdown item</button></li>
    +  </ul>
    +</div>

    +Learn more about our JavaScript as modules and using the programmatic API. +

    Personalize it with Bootstrap Icons

    Bootstrap Icons is an open source SVG icon library featuring over 1,800 glyphs, with + more added every release. They're designed to work in any project, whether you use Bootstrap itself or not. Use them + as SVGs or icon fonts—both options give you vector scaling and easy customization via CSS. +

    +Get Bootstrap Icons +

    Bootstrap Icons

    Make it yours with official Bootstrap Themes

    +Take Bootstrap to the next level with premium themes from the official Bootstrap Themes marketplace. Themes are built on Bootstrap as their own extended frameworks, rich with new components and plugins, + documentation, and powerful build tools. +

    +Browse Bootstrap Themes +

    Bootstrap Themes
    \ No newline at end of file diff --git a/migration/index.html b/migration/index.html index 987229ff1f..2dbe12f0df 100644 --- a/migration/index.html +++ b/migration/index.html @@ -1,12 +1 @@ - - - - - - https://getbootstrap.com/docs/5.3/migration/ - - - - - - + Bootstrap \ No newline at end of file diff --git a/robots.txt b/robots.txt index 0e134b1d31..1ca8e05f93 100644 --- a/robots.txt +++ b/robots.txt @@ -1,5 +1,5 @@ # www.robotstxt.org # Allow crawling of all content User-agent: * -Disallow: -Sitemap: https://getbootstrap.com/sitemap.xml +Disallow: +Sitemap: https://getbootstrap.com/sitemap-index.xml diff --git a/sitemap-0.xml b/sitemap-0.xml new file mode 100644 index 0000000000..f61dd6d531 --- /dev/null +++ b/sitemap-0.xml @@ -0,0 +1 @@ +https://getbootstrap.com/https://getbootstrap.com/about/https://getbootstrap.com/components/https://getbootstrap.com/docs/5.3/about/https://getbootstrap.com/docs/5.3/about/brand/https://getbootstrap.com/docs/5.3/about/license/https://getbootstrap.com/docs/5.3/about/overview/https://getbootstrap.com/docs/5.3/about/team/https://getbootstrap.com/docs/5.3/about/translations/https://getbootstrap.com/docs/5.3/components/https://getbootstrap.com/docs/5.3/components/accordion/https://getbootstrap.com/docs/5.3/components/alerts/https://getbootstrap.com/docs/5.3/components/badge/https://getbootstrap.com/docs/5.3/components/breadcrumb/https://getbootstrap.com/docs/5.3/components/button-group/https://getbootstrap.com/docs/5.3/components/buttons/https://getbootstrap.com/docs/5.3/components/card/https://getbootstrap.com/docs/5.3/components/carousel/https://getbootstrap.com/docs/5.3/components/close-button/https://getbootstrap.com/docs/5.3/components/collapse/https://getbootstrap.com/docs/5.3/components/dropdowns/https://getbootstrap.com/docs/5.3/components/list-group/https://getbootstrap.com/docs/5.3/components/modal/https://getbootstrap.com/docs/5.3/components/navbar/https://getbootstrap.com/docs/5.3/components/navs-tabs/https://getbootstrap.com/docs/5.3/components/navs/https://getbootstrap.com/docs/5.3/components/offcanvas/https://getbootstrap.com/docs/5.3/components/pagination/https://getbootstrap.com/docs/5.3/components/placeholders/https://getbootstrap.com/docs/5.3/components/popovers/https://getbootstrap.com/docs/5.3/components/progress/https://getbootstrap.com/docs/5.3/components/scrollspy/https://getbootstrap.com/docs/5.3/components/spinners/https://getbootstrap.com/docs/5.3/components/toasts/https://getbootstrap.com/docs/5.3/components/tooltips/https://getbootstrap.com/docs/5.3/content/https://getbootstrap.com/docs/5.3/content/figures/https://getbootstrap.com/docs/5.3/content/images/https://getbootstrap.com/docs/5.3/content/reboot/https://getbootstrap.com/docs/5.3/content/tables/https://getbootstrap.com/docs/5.3/content/typography/https://getbootstrap.com/docs/5.3/customize/https://getbootstrap.com/docs/5.3/customize/color-modes/https://getbootstrap.com/docs/5.3/customize/color/https://getbootstrap.com/docs/5.3/customize/components/https://getbootstrap.com/docs/5.3/customize/css-variables/https://getbootstrap.com/docs/5.3/customize/optimize/https://getbootstrap.com/docs/5.3/customize/options/https://getbootstrap.com/docs/5.3/customize/overview/https://getbootstrap.com/docs/5.3/customize/sass/https://getbootstrap.com/docs/5.3/docsref/https://getbootstrap.com/docs/5.3/examples/https://getbootstrap.com/docs/5.3/examples/album-rtl/https://getbootstrap.com/docs/5.3/examples/album/https://getbootstrap.com/docs/5.3/examples/badges/https://getbootstrap.com/docs/5.3/examples/blog-rtl/https://getbootstrap.com/docs/5.3/examples/blog/https://getbootstrap.com/docs/5.3/examples/breadcrumbs/https://getbootstrap.com/docs/5.3/examples/buttons/https://getbootstrap.com/docs/5.3/examples/carousel-rtl/https://getbootstrap.com/docs/5.3/examples/carousel/https://getbootstrap.com/docs/5.3/examples/cheatsheet-rtl/https://getbootstrap.com/docs/5.3/examples/cheatsheet/https://getbootstrap.com/docs/5.3/examples/checkout-rtl/https://getbootstrap.com/docs/5.3/examples/checkout/https://getbootstrap.com/docs/5.3/examples/cover/https://getbootstrap.com/docs/5.3/examples/dashboard-rtl/https://getbootstrap.com/docs/5.3/examples/dashboard/https://getbootstrap.com/docs/5.3/examples/dropdowns/https://getbootstrap.com/docs/5.3/examples/features/https://getbootstrap.com/docs/5.3/examples/footers/https://getbootstrap.com/docs/5.3/examples/grid/https://getbootstrap.com/docs/5.3/examples/headers/https://getbootstrap.com/docs/5.3/examples/heroes/https://getbootstrap.com/docs/5.3/examples/jumbotron/https://getbootstrap.com/docs/5.3/examples/jumbotrons/https://getbootstrap.com/docs/5.3/examples/list-groups/https://getbootstrap.com/docs/5.3/examples/masonry/https://getbootstrap.com/docs/5.3/examples/modals/https://getbootstrap.com/docs/5.3/examples/navbar-bottom/https://getbootstrap.com/docs/5.3/examples/navbar-fixed/https://getbootstrap.com/docs/5.3/examples/navbar-static/https://getbootstrap.com/docs/5.3/examples/navbars-offcanvas/https://getbootstrap.com/docs/5.3/examples/navbars/https://getbootstrap.com/docs/5.3/examples/offcanvas-navbar/https://getbootstrap.com/docs/5.3/examples/offcanvas/https://getbootstrap.com/docs/5.3/examples/pricing/https://getbootstrap.com/docs/5.3/examples/product/https://getbootstrap.com/docs/5.3/examples/sidebars/https://getbootstrap.com/docs/5.3/examples/sign-in/https://getbootstrap.com/docs/5.3/examples/starter-template/https://getbootstrap.com/docs/5.3/examples/sticky-footer-navbar/https://getbootstrap.com/docs/5.3/examples/sticky-footer/https://getbootstrap.com/docs/5.3/extend/https://getbootstrap.com/docs/5.3/extend/approach/https://getbootstrap.com/docs/5.3/extend/icons/https://getbootstrap.com/docs/5.3/forms/https://getbootstrap.com/docs/5.3/forms/checks-radios/https://getbootstrap.com/docs/5.3/forms/checks/https://getbootstrap.com/docs/5.3/forms/floating-labels/https://getbootstrap.com/docs/5.3/forms/form-control/https://getbootstrap.com/docs/5.3/forms/input-group/https://getbootstrap.com/docs/5.3/forms/layout/https://getbootstrap.com/docs/5.3/forms/overview/https://getbootstrap.com/docs/5.3/forms/range/https://getbootstrap.com/docs/5.3/forms/select/https://getbootstrap.com/docs/5.3/forms/validation/https://getbootstrap.com/docs/5.3/getting-started/https://getbootstrap.com/docs/5.3/getting-started/accessibility/https://getbootstrap.com/docs/5.3/getting-started/best-practices/https://getbootstrap.com/docs/5.3/getting-started/browsers-devices/https://getbootstrap.com/docs/5.3/getting-started/build-tools/https://getbootstrap.com/docs/5.3/getting-started/contents/https://getbootstrap.com/docs/5.3/getting-started/contribute/https://getbootstrap.com/docs/5.3/getting-started/download/https://getbootstrap.com/docs/5.3/getting-started/introduction/https://getbootstrap.com/docs/5.3/getting-started/javascript/https://getbootstrap.com/docs/5.3/getting-started/parcel/https://getbootstrap.com/docs/5.3/getting-started/rfs/https://getbootstrap.com/docs/5.3/getting-started/rtl/https://getbootstrap.com/docs/5.3/getting-started/vite/https://getbootstrap.com/docs/5.3/getting-started/webpack/https://getbootstrap.com/docs/5.3/helpers/https://getbootstrap.com/docs/5.3/helpers/clearfix/https://getbootstrap.com/docs/5.3/helpers/color-background/https://getbootstrap.com/docs/5.3/helpers/colored-links/https://getbootstrap.com/docs/5.3/helpers/focus-ring/https://getbootstrap.com/docs/5.3/helpers/icon-link/https://getbootstrap.com/docs/5.3/helpers/position/https://getbootstrap.com/docs/5.3/helpers/ratio/https://getbootstrap.com/docs/5.3/helpers/screen-readers/https://getbootstrap.com/docs/5.3/helpers/stacks/https://getbootstrap.com/docs/5.3/helpers/stretched-link/https://getbootstrap.com/docs/5.3/helpers/text-truncation/https://getbootstrap.com/docs/5.3/helpers/vertical-rule/https://getbootstrap.com/docs/5.3/helpers/visually-hidden/https://getbootstrap.com/docs/5.3/layout/https://getbootstrap.com/docs/5.3/layout/breakpoints/https://getbootstrap.com/docs/5.3/layout/columns/https://getbootstrap.com/docs/5.3/layout/containers/https://getbootstrap.com/docs/5.3/layout/css-grid/https://getbootstrap.com/docs/5.3/layout/grid/https://getbootstrap.com/docs/5.3/layout/gutters/https://getbootstrap.com/docs/5.3/layout/utilities/https://getbootstrap.com/docs/5.3/layout/z-index/https://getbootstrap.com/docs/5.3/migration/https://getbootstrap.com/docs/5.3/utilities/https://getbootstrap.com/docs/5.3/utilities/api/https://getbootstrap.com/docs/5.3/utilities/background/https://getbootstrap.com/docs/5.3/utilities/borders/https://getbootstrap.com/docs/5.3/utilities/colors/https://getbootstrap.com/docs/5.3/utilities/display/https://getbootstrap.com/docs/5.3/utilities/flex/https://getbootstrap.com/docs/5.3/utilities/float/https://getbootstrap.com/docs/5.3/utilities/interactions/https://getbootstrap.com/docs/5.3/utilities/link/https://getbootstrap.com/docs/5.3/utilities/object-fit/https://getbootstrap.com/docs/5.3/utilities/opacity/https://getbootstrap.com/docs/5.3/utilities/overflow/https://getbootstrap.com/docs/5.3/utilities/position/https://getbootstrap.com/docs/5.3/utilities/shadows/https://getbootstrap.com/docs/5.3/utilities/sizing/https://getbootstrap.com/docs/5.3/utilities/spacing/https://getbootstrap.com/docs/5.3/utilities/text/https://getbootstrap.com/docs/5.3/utilities/vertical-align/https://getbootstrap.com/docs/5.3/utilities/visibility/https://getbootstrap.com/docs/5.3/utilities/z-index/https://getbootstrap.com/docs/getting-started/https://getbootstrap.com/docs/versions/https://getbootstrap.com/docsref/https://getbootstrap.com/examples/https://getbootstrap.com/getting-started/https://getbootstrap.com/migration/ \ No newline at end of file diff --git a/sitemap-index.xml b/sitemap-index.xml new file mode 100644 index 0000000000..382f44104d --- /dev/null +++ b/sitemap-index.xml @@ -0,0 +1 @@ +https://getbootstrap.com/sitemap-0.xml \ No newline at end of file