Koppula
Koppula

Reputation: 95

Text output showing in next row in Shiny app UI

I am using below code to display textOutput next to header, but it's always showing in next row.

Currently displaying:-

GrandTotal:-

Display $ Value

Expected to display

GrandTotal:- Display $ Value

Here is the code i am using.

ui <- fluidPage(
  div(style="display: inline-block;vertical-align:top; width: 150px;",h3(style="color:blue;font-size:100%;","GrandTotal:-"),textOutput("Test"))
  )
server <- function(input,output) {

  output$Test <- renderText("Display $ Value")
}
shinyApp(ui, server)

Upvotes: 0

Views: 327

Answers (1)

Pork Chop
Pork Chop

Reputation: 29417

Wrap both of them into div and add block style to both like so:

rm(list = ls())
library(shiny)

ui <- fluidPage(
  div(style="display: inline-block;width:80px;",h3(style="color:blue;font-size:100%;","GrandTotal:-")),
  div(style="display: inline-block;",textOutput("Test"))
)
server <- function(input,output) {
  output$Test <- renderText("Display $ Value")
}
shinyApp(ui, server)

enter image description here

Upvotes: 1

Related Questions