diff --git a/inst/examples/03_reactivity/app.R b/inst/examples/03_reactivity/app.R index 393ebfe619..a4990adf9b 100644 --- a/inst/examples/03_reactivity/app.R +++ b/inst/examples/03_reactivity/app.R @@ -1,50 +1,41 @@ +library(bslib) library(shiny) # Define UI for dataset viewer app ---- -ui <- fluidPage( +ui <- page_sidebar( + # Main panel for displaying outputs ---- + + # Output: Formatted text for caption ---- + h3(textOutput("caption", container = span)), + + # Output: Verbatim text for data summary ---- + verbatimTextOutput("summary"), + + # Output: HTML table with requested number of observations ---- + tableOutput("view"), + + # Sidebar panel for inputs ---- + sidebar = sidebar( + # Input: Text for providing a caption ---- + # Note: Changes made to the caption in the textInput control + # are updated in the output area immediately as you type + textInput(inputId = "caption", + label = "Caption:", + value = "Data Summary"), + + # Input: Selector for choosing dataset ---- + selectInput(inputId = "dataset", + label = "Choose a dataset:", + choices = c("rock", "pressure", "cars")), + + # Input: Numeric entry for number of obs to view ---- + numericInput(inputId = "obs", + label = "Number of observations to view:", + value = 10) + ), # App title ---- - titlePanel("Reactivity"), - - # Sidebar layout with input and output definitions ---- - sidebarLayout( - - # Sidebar panel for inputs ---- - sidebarPanel( - - # Input: Text for providing a caption ---- - # Note: Changes made to the caption in the textInput control - # are updated in the output area immediately as you type - textInput(inputId = "caption", - label = "Caption:", - value = "Data Summary"), - - # Input: Selector for choosing dataset ---- - selectInput(inputId = "dataset", - label = "Choose a dataset:", - choices = c("rock", "pressure", "cars")), - - # Input: Numeric entry for number of obs to view ---- - numericInput(inputId = "obs", - label = "Number of observations to view:", - value = 10) - - ), - - # Main panel for displaying outputs ---- - mainPanel( - - # Output: Formatted text for caption ---- - h3(textOutput("caption", container = span)), - - # Output: Verbatim text for data summary ---- - verbatimTextOutput("summary"), - - # Output: HTML table with requested number of observations ---- - tableOutput("view") - - ) - ) + title = "Reactivity", ) # Define server logic to summarize and view selected dataset ----