Case Studies: Building Web Applications with Shiny in R
Dean Attali
Shiny Consultant
tableOutput("table")
output$table <- renderTable({ gapminder })
DT::dataTableOutput("table")
output$table <- DT::renderDataTable({ gapminder })
DT::dataTableOutput("table")
output$table <- DT::renderDataTable({ gapminder })
DT::dataTableOutput("table")
output$table <- DT::renderDataTable({ gapminder })
DT::dataTableOutput("table")
output$table <- DT::renderDataTable({ gapminder })
DT::dataTableOutput("table")
output$table <- DT::renderDataTable({ gapminder })
tabPanel(title = "tab 1", "content goes here")
tabPanel(title = "tab 2", "second tab", plotOutput("plot"))
fluidPage(
tabsetPanel(
tabPanel(title = "tab 1", "first tab content goes here"), tabPanel(title = "tab 2", "second tab", plotOutput("plot")), tabPanel(title = "tab 3", textInput("text", "Name", ""))
)
)
CSS rules syntax
#ID {
property: value;
property: value;
...
}
ID is element ID to apply the style to
To add CSS to Shiny, use tags$style()
ui <- fluidPage(
tags$style("
#ID {
property: value;
}
")
)
ui <- fluidPage(
textInput("name", "Enter your name", "Dean"),
tableOutput("table")
)
ui <- fluidPage(
textInput("name", "Enter your name", "Dean"),
tableOutput("table")
)
ui <- fluidPage(
textInput("name", "Enter your name", "Dean"),
tableOutput("table")
)
ui <- fluidPage(
textInput("name", "Enter your name", "Dean"),
tableOutput("table")
)
css <- "
#name { color: red; }
#table { background: yellow; font-size: 24px; }
"
ui <- fluidPage(
tags$style(css),
textInput("name", "Enter your name", "Dean"), tableOutput("table") )
Case Studies: Building Web Applications with Shiny in R