Description Usage Arguments Value Examples
Create an accordion element for use in shiny apps. This function returns
a component that expands and collapses user defined content. For example,
you can create an FAQ page using this component, create definitions, or
hide anything you like. The returned component is a text element (i.e.,
title, question, etc.) and an html element (or tagList
containing)
two or more html elements.
1 2 3 4 5 6 7 |
inputId |
a unique ID for the accordion component |
title |
a text string containing a title for the collapsible section |
content |
an html element or a list of html elements |
heading_level |
adjust the HTML heading level; default is "h3". Use on of the following headings: h1, h2, h3, h4, h5, h6 |
class |
a string containing css classes. Using this argument, you can pass your own class names or use one of the classes made available by this package: "accordion__style__a" (styling used in the app). Use "class = NULL", to return a minimally styled component. Notes on |
Create an accordion component
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | if (interactive()) {
library(shiny)
ui <- tagList(
iceComponents::use_iceComponents(),
tags$head(
tags$style(
"#what-is-shiny {
width: 400px;
}"
)
),
tags$main(
id = "main",
class = "main",
tags$h2("Frequently Asked Questions Page"),
tags$p("Here are some commonly asked questions"),
iceComponents::accordion(
inputId = "what-is-shiny",
title = "What is Shiny?",
content = tagList(
tags$p(
"Shiny is an R package that makes it easy to build",
"interactive web apps straight from R. You can host",
"standalone apps on a webpage or embed them in R Markdown",
"documents or build dashboards. You can also extend your",
"Shiny apps with CSS themes, htmlwidgets, and JavaScript",
"actions."
),
tags$cite("Rstudio.org")
)
)
)
)
server <- function(input, output) {}
shinyApp(ui, server)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.