skip to Main Content

I have a Shiny app that features a downloadButton and an actionButton that are separated:

enter image description here

Here is the reproducible code:

library(shiny)

ui <- fluidPage(
  titlePanel("Minimal App"),
  hr(),
  sidebarLayout(
    sidebarPanel(
      "Placeholder"
    ),
    mainPanel("Placeholder",
              br(),
              fluidRow("Placeholder"),
              fluidRow(
                column(2, downloadButton("download")),
                column(1, actionButton("send_email", "Email", icon = icon("inbox")))
              )
    )
  )
)

server <- function(input, output, session) {}

shinyApp(ui, server)

How can I minimize the space between the "Download" button and the "Email" button? I want to make the space between them closer, but not zero pixels. The YouTube buttons are a good example:

enter image description here

2

Answers


  1. You can use splitLayout:

        mainPanel("Placeholder",
                  br(),
                  fluidRow("Placeholder"),
                  fluidRow(
                    column(
                3, 
                splitLayout(
                  downloadButton("download"),
                          actionButton("send_email", "Email", icon = icon("inbox"))
                )
                    )
                  )
        )
    

    enter image description here

    Login or Signup to reply.
  2. u cadd add styling to your shiny App in different ways.
    see here.

    a fast solution would be

      actionButton("send_email", "Email", icon = icon("inbox")) %>%
        tagAppendAttributes(
          style = "border-radius: .5rem;"
        )
    

    same goes for downloadButton

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search