The rmdexamples package illustrates various techniques for extending R Markdown. The examples included here are described in more detail in the article on Shiny Widgets.
To try out rmdexamples locally, you should first install the remotes package, then:
if (!require("remotes")) install.packages("remotes")
# you may also need to update packages: update.packages(ask = FALSE)
remotes::install_github("rstudio/rmdexamples")