Search code examples
checkboxshinyiconsinline

Putting shiny_iconLink and checkboxInput on the same line in Shiny


I'm trying to put a shiny_iconlink() with a modal on the same line as a checkboxInput. I've been messing around with div classes and ids, but nothing seems to be working.

fluidRow(
  column(width = 4,
         span(id="icon", shiny_iconlink()),
         checkboxInput("checkbox", "get me inline"),
         bsModal("modal", "title", "icon", "content")
        )
)


Solution

  • As @SBista suggested, you use fluidRow and column. This article about Shiny application layout is helpful, especially the section on the fluid grid system.

    Try this out:

    library(shiny)
    library(bsplus)    
    library(shinyBS)
    
    ui <- fluidPage(
        fluidRow(
            column(width = 1,
                   span(id="icon", shiny_iconlink())),
            column(width = 2,
                   checkboxInput("checkbox", "get me inline"),
                   bsModal("modal", "title", "icon", "content")
            )
        )
    )
    
    server <- function(input, output, session) {
    
    }
    
    shinyApp(ui, server)