Wrap Shiny UI element with a loading spinner contained in html div tags

wrap_loader(id, ui_element)

Arguments

id

string: id of loader, used with show/hide in server side

ui_element

wrapped Shiny UI element

Value

html div element wrapped around given Shiny UI element

Examples

wrap_loader('id_example', shiny::actionButton('id_example', 'example'))
#> <div>
#>   <button id="id_example" type="button" class="btn btn-default action-button">example</button>
#>   <div id="id_example" style="display:none;">
#>     <i class="fas fa-spinner fa-spin" role="presentation" aria-label="spinner icon" style="font-size: 20px; color: #008000;"></i>
#>   </div>
#> </div>