Examples
Modals you can open.
Every button below opens a modal built by the extension as this page was rendered.
This site sets two defaults for all of them, in _quarto.yml:
extensions:
modal:
fade: true
centred: trueIndividual modals below override those.
Sizes
size takes the Bootstrap tokens or the friendly aliases.
::: {#modal-small size=small}
::: {#modal-large size=lg}
::: {#modal-xl size=extra-large}Scrolling, fullscreen, and a static backdrop
::: {#modal-scrollable scrollable=true}
::: {#modal-fullscreen fullscreen=lg}
::: {#modal-static backdrop-static=true keyboard=false}Opening a modal from a link
A link whose target is a modal identifier is expanded into a toggle, so a modal can be opened from the middle of a sentence, like this one.
[like this one](#modal-basic)The explicit Bootstrap attributes work too, when a link would be the wrong element:
[Open it]{bs-target="#modal-basic" bs-toggle="modal"}Accessibility
description points at the identifier of an element elsewhere on the page, and becomes the modal’s aria-describedby.
This paragraph carries the identifier the modal points at.
::: {#modal-described description="described-note" close-button-label="Dismiss this dialog"}The identifier has to exist in the document; the extension warns when it does not, since a dangling aria-describedby is worse than none.
Source
The repository ships a short, standalone starting point you can copy: example.qmd.