3

I'm creating a Shiny app in which I want to have a large (h1) formatted title and an action button right next to it, which when clicked on pops up a window with additional details and some other information. I got the button set up and working well (not included in the code). My problem is with the formatting of this line. Despite my best efforts the icon (an action button) gets pushed to a new row, even though it's in the same column as the dynamic text, and in the same h1 format as well. How could I achieve what I want?

 library(shiny)

 ui <- fluidRow(column(12, tags$h1(textOutput("chosen_date_fact"), 
                                   actionButton("scoping2", 
                                                label = icon("info-circle"), 
                                                style = "color: #000000; background-color: #ffffff; border-color: #ffffff"))))


 server = function(input, output){  

 last_fact_date = '2017-07-16'

 output$chosen_date_fact = renderText ({   
 date = as.Date(last_fact_date)   
 paste0('Details of', ' ', format(date,"%B"),' ', '(as of: ', date,')') 
 })     
 }

 shinyApp(ui = ui, server = server)

Picture of the result: https://i.stack.imgur.com/gmhNM.jpg

Thank you in advance!

zsoltnyiri
  • 33
  • 3

1 Answers1

3

Something like this? Fore more examples visit another question i answered How to display widgets inline in shiny

library(shiny)

ui <- fluidRow(column(12, div(style="display: inline-block;",tags$h1(textOutput("chosen_date_fact"))),
                      actionButton("scoping2", label = icon("info-circle"), style = " color: #000000; background-color: #ffffff; border-color: #ffffff")
))


server = function(input, output){  

  last_fact_date = '2017-07-16'

  output$chosen_date_fact = renderText ({   
    date = as.Date(last_fact_date)   
    paste0('Details of', ' ', format(date,"%B"),' ', '(as of: ', date,')') 
  })     
}

shinyApp(ui = ui, server = server)
Pork Chop
  • 28,528
  • 5
  • 63
  • 77