When selecting an input in the sidebarPanel, how do i display the output in the mainPanel?

Hi all. I'm using the Golem package with Shiny and trying to set up my UI. I've created a module called 'display'. This module has been loaded into the sidebarPanel. Here is the code for the module.

display_ui <- function(id){
  ns <- NS(id)

  tagList(
    # * Display choice ----
    # A drop down menu to navigate different parts of the app
    selectInput(ns("display_select"), label = "Display",
                choices = c("Summary", "Return from Spray", "Net Return", "Yield", "Grain Price",
                            "Disease Impact", "Mitigation by Spray", "About", "Tips")),

    # * Spray choice ----
    # Buttons to select how many sprays the user requires
    radioButtons(ns("spray_radio"), label = "Spray Decision:",
                 choices = c("One spray", "Two sprays")),

    uiOutput(ns("display_output"))

  ) # end tagList
}
display_server <- function(id){
  moduleServer( id, function(input, output, session){
    ns <- session$ns

    output$display_output <- renderUI({
      if(input$display_select == "About"){
        about_ui("about")
      } else {
        NULL
      }
    }) # end output$display_output
  }) # end moduleServer
}

For now i'm just trying to get the module 'about' loaded into the mainPanel, but it's loading into the sidebarPanel. I've tried wrapping mainPanel around uiOutput(ns("display_output")). If i simply load the about module into app_ui it shows it for every single selectInput which i don't want. I plan to have modules for each of my selectInput choices.

Any ideas how i can get this to work?

Cheers!

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.