writer_typer
writer_typer

Reputation: 798

How to align button next to text input?

I'm trying to align the actionButton right next to the textbox.

Is there a way to add an argument to the column function? Or is there a simple css workaround?

Code:


library(shiny)

ui <- fluidPage(

      sidebarLayout(
        sidebarPanel(),
        
        mainPanel(
            fluidRow(
                column(11, textInput("code", label = " ", width = "100%")),
                column(1, actionButton("run", "Run")))
        )
    )
)
server <- function(input, output) {

}

shinyApp(ui = ui, server = server)

Right now it looks like this:

enter image description here

But I want to achieve something like this:

enter image description here

Upvotes: 2

Views: 967

Answers (1)

YBS
YBS

Reputation: 21287

Try margin-top as shown below.

library(shiny)

ui <- fluidPage(
  
  sidebarLayout(
    sidebarPanel(),
    
    mainPanel(
      fluidRow(
        column(11, textInput("code", label = " ", width = "100%")),
        column(1, div( style = "margin-top: 20px;", actionButton("run", "Run"))))
    )
  )
)
server <- function(input, output) {
  
}

shinyApp(ui = ui, server = server)

output

Upvotes: 4

Related Questions