From: Mark Otto Date: Wed, 24 Jun 2026 22:30:08 +0000 (-0700) Subject: Docs: document delegated tooltips via the selector option X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13aef35043788b4150a7bf87d8448a30b3891a37;p=thirdparty%2Fbootstrap.git Docs: document delegated tooltips via the selector option Add an example initializing one Tooltip on a parent with the selector option to cover many (and dynamically-added) triggers. Fixes #41020. --- diff --git a/site/src/content/docs/components/tooltip.mdx b/site/src/content/docs/components/tooltip.mdx index 2a5cc65d72..33f0e0d562 100644 --- a/site/src/content/docs/components/tooltip.mdx +++ b/site/src/content/docs/components/tooltip.mdx @@ -171,6 +171,16 @@ const tooltip = new bootstrap.Tooltip('#example', { +### Delegated tooltips + +To enable tooltips on many triggers at once—including elements added to the DOM later—initialize a single instance on a parent element and pass the [`selector` option](#options). Any matching descendant gets a tooltip without re-initializing: + +```js +const tooltip = new bootstrap.Tooltip(document.body, { + selector: '[data-bs-toggle="tooltip"]' +}) +``` + ### Via data attributes