R-Notebooks Collapse Button

I've taken to using R Notebooks for many of the tasks that I used to write in R Markdown. Advantages are that code chunks can be executed independently, leading to easier management and debugging, and that the output is still a usable document.
There are times, however, when I would like to include a large table or multiple plots but don't want them to take up too much of the output document. For tables this can easily be accomplished using a datatable but for more complex tables or multiple plots placing them in a collapsible div attached to a button works well. In the code chunk below, formattable is used to format the iris dataset.

 1library(htmltools)
 2library(formattable)
 3HTML('<div class="row">
 4        <div class="col-md-12">
 5          <button type="button" class="btn btn-warning btn-sm code-folding-btn" data-toggle="collapse" data-target="#table_iris" aria-expanded="false">
 6            <span>Iris Data</span>
 7          </button>
 8        </div>
 9      </div>
10<div id="table_iris" class="collapse">')
11as.htmlwidget(formattable(iris,
12                          list(Sepal.Length = color_tile("white", "lightpink"),
13                          Sepal.Width = color_tile("white", "lightgreen"),
14                          Petal.Length = color_tile("white", "lightpink"),
15                          Petal.Width = color_tile("white", "lightgreen"))), 
16                          width = '30%')
17HTML('</div>')