Use href infobox as actionbutton

前端 未结 3 768
执念已碎
执念已碎 2020-12-17 00:49

I was building an App with Rshiny.

I have a couple of infoBoxand I would like to use the href option to make a po

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-17 01:04

    I decided to change the method. I have now include an actionbutton (or actionLink) inside the substile element of the value box and create a bsModal element linked to this actionButton.
    If you are not familiar with the ShinyBS package it allow to make popover, tooltip etc features without including HTML or java.

    I follow the @Mikko Martila advice Shiny: adding addPopover to actionLink and here is a reproductile example to show you my issue :

    library("shiny")
    library("shinydashboard")
    library("shinyBS")
    
    header <- dashboardHeader(title = "reporductible example")
    
    body <- dashboardBody(valueBoxOutput("box_01"),
                          bsModal("modal", "foo", trigger = "", "bar"))
    sidebar <- dashboardSidebar()
    ui <- dashboardPage(header,sidebar,body,skin="green")
    server = function(input, output, session) {
      # ----- First info box synthesis menu
      output$box_01 <- renderValueBox({
        entry_01 <- "BlaBla"
        valueBox(value=entry_01, icon = icon("users",lib="font-awesome"),
                        width=NULL,color = "blue",subtitle = HTML("my substitle ")
        )
      })
    
      observeEvent(input$button, {
        toggleModal(session, "modal", "open")
      })
    }
    
    runApp(list(ui = ui, server = server))
    

    I use the HTML() option to add my button inside the subtitle of value boxes.

    It's not really what i wanted but it do the work.

    You can do it with actionLink (it's look better) by using subtitle like this :

    subtitle=HTML("my subtitle
         
    
           ")
    

提交回复
热议问题