Marta
Marta

Reputation: 3843

R shiny display wellPanel objects horizontally

I have wellPanel:

   wellPanel(
              h5("Accuracy table:"),
              tableOutput(accuracy_tablename))
          )

enter image description here

I want to display objects in wellPanel horizontally. How can I manage that?

Thank you in advance!

Upvotes: 2

Views: 2430

Answers (2)

harkmug
harkmug

Reputation: 2785

In case you mean showing multiple panels side-by-side intead of one-below-the-other, I found the following useful:

    div(style="display:inline-block",  
       h5("Accuracy table:"),
       tableOutput(accuracy_tablename))
    )

  div(style="display:inline-block",  
       h5("Accuracy table 2:"),
       tableOutput(accuracy_tablename2))
    )

etc.

Upvotes: 3

Julien Navarre
Julien Navarre

Reputation: 7830

You can define a div with the class "row" (or "row-fluid") and insert sub-divs (the "spanX" class specify the space between each divs) which will be displayed horizontally.

shiny::runApp(list(
  ui = basicPage(
    wellPanel(
      tags$div(class = "row",
        tags$div(class = "span4",
          h5("Accuracy table:")
        ),
        tags$div(class = "span4",
          tableOutput("table")
        )
      )
    )
  ),
  server = function(input, output, session) {

    output$table <- renderTable({
      iris[1,]
    })

  }
))

Upvotes: 3

Related Questions