Increase the width of the text box made by bsPopover in Shiny

别说谁变了你拦得住时间么 提交于 2020-05-16 01:42:53

问题


Friends, I would like to increase the width of the text box made by bsPopover. Make it more horizontal, that is, increase the width of the text box. It's possible?? The executable code is below. Any help is appreciated.

library(shinyBS)
library(shiny)


DES_filter1<-paste("Sudden she seeing garret far regard. By hardly it direct if pretty up regret. Ability thought enquire settled prudent you sir. Or easy knew sold on well come year. Something consulted age extremely end procuring. Collecting preference he inquietude projection me in by. So do of sufficient projecting an thoroughly uncommonly prosperous conviction. Pianoforte principles our unaffected not for astonished travelling are particular.", sep = "<br>")


ui <- fluidPage(


  titlePanel("Old Faithful Geyser Data"),

  sidebarLayout(
    sidebarPanel(

      radioButtons(
        "filter1", 
        h3("Select properties"), 
        choiceValues = c(1, 2),
        choiceNames = list(
          tagList(
            tags$span("All properties"),
            tags$span(icon("info-circle"), id = "icon1", style = "color: blue;")
          ), 
          tagList(
            tags$span("Exclude properties"),
            tags$span(icon("info-circle"), id = "icon2", style = "color: blue;")
          )
        ),
        selected = 1
      ),

      bsPopover("icon1", "TITLE1", DES_filter1, placement = "right"), 
      bsPopover("icon2", "TITLE2", "CONTENT2", placement = "right"), 

      radioButtons("filter2", h3("Select farms"),
                   choices = list("All farms" = 1, 
                                  "Exclude farms" = 2),
                   selected = 1),
      ),

    mainPanel(

    )
  )
)

server <- function(input, output) {

}

shinyApp(ui = ui, server = server) 

Thank you very much friends!


回答1:


library(shinyBS)
library(shiny)

popoverTempate <- 
  '<div class="popover popover-lg" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'

DES_filter1<-paste("Sudden she seeing garret far regard. By hardly it direct if pretty up regret. Ability thought enquire settled prudent you sir. Or easy knew sold on well come year. Something consulted age extremely end procuring. Collecting preference he inquietude projection me in by. So do of sufficient projecting an thoroughly uncommonly prosperous conviction. Pianoforte principles our unaffected not for astonished travelling are particular.", sep = "<br>")


ui <- fluidPage(

  tags$head(
    tags$style(HTML(".popover.popover-lg {width: 500px; max-width: 500px;}"))
  ),
  titlePanel("Old Faithful Geyser Data"),

  sidebarLayout(
    sidebarPanel(

      radioButtons(
        "filter1", 
        h3("Select properties"), 
        choiceValues = c(1, 2),
        choiceNames = list(
          tagList(
            tags$span("All properties"),
            tags$span(icon("info-circle"), id = "icon1", style = "color: blue;")
          ), 
          tagList(
            tags$span("Exclude properties"),
            tags$span(icon("info-circle"), id = "icon2", style = "color: blue;")
          )
        ),
        selected = 1
      ),

      bsPopover("icon1", "TITLE1", DES_filter1, placement = "right", 
                options = list(template = popoverTempate)), 
      bsPopover("icon2", "TITLE2", "CONTENT2", placement = "right"), 

      radioButtons("filter2", h3("Select farms"),
                   choices = list("All farms" = 1, 
                                  "Exclude farms" = 2),
                   selected = 1),
    ),

    mainPanel(

    )
  )
)

server <- function(input, output) {

}

shinyApp(ui = ui, server = server) 


来源:https://stackoverflow.com/questions/61779533/increase-the-width-of-the-text-box-made-by-bspopover-in-shiny

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!