Gives skeletons to an app with no change to each output. bones_auto()
looks through a UI and puts each Shiny output in withBones(). Each one
gets the shape of its output, as with withBones(output): a
plotOutput() gets a chart, a tableOutput() gets rows, a DT table
gets the shape of DT, and so on.
Arguments
- ui
A UI: a page, a tag, or a tag list.
- ...
Arguments for
withBones(), used for every output that is wrapped: for examplestale = FALSEoranimation = "pulse". Nottype, because each output gets the shape of its own kind.- exclude
The ids of outputs to leave alone.
Details
Give it the whole page, or only a part of it:
ui <- bones_auto(page_sidebar(...))
ui <- page_sidebar(sidebar = ..., bones_auto(navset_card_tab(...)))What it leaves alone
An output that is already in
withBones(). To give one output its own shape or options, wrap it yourself:bones_auto()keeps that wrapper.An output whose id is in
exclude.An inline output, such as
textOutput("n", inline = TRUE). The wrapper is a block, so it would break the line of text.
A uiOutput() can hold anything, so it gets the text shape. Wrap it
yourself to give it another shape, such as type = "cards".
bones_auto() sees only the UI that you give it. Outputs that a
renderUI() makes later are not in it. Call bones_auto() on the UI
inside that renderUI() to give them skeletons too.
Examples
if (requireNamespace("shiny", quietly = TRUE)) {
library(shiny)
ui <- bones_auto(fluidPage(
plotOutput("chart"),
tableOutput("results"),
textOutput("count", inline = TRUE), # inline: left alone
withBones(uiOutput("cards"), type = "cards") # wrapped already: kept
))
}
