Button misaligned in shiny dashboard

1,239 views
Skip to first unread message

Ricardo Vladimiro

unread,
Jul 26, 2016, 12:51:14 PM7/26/16
to Shiny - Web Framework for R
Hi,

I'm having an issue with button alignment in shiny dashboards to which I have not found a solution.

Here's what it looks like:


This is happens on a sidebarMenu of a Shiny Dashboard.

Below is the code:

ui.R

dashboardPage(
    skin = "green",
    
    dashboardHeader(title = "UA LTV"),
    dashboardSidebar(
        sidebarMenu(
            id = "sidebarMenu",
            menuItem(
                text = "Prediction",
                icon = icon("line-chart"),
                tabName = "prediction"
            ),
            # Starting hidden, the sidebar filters are only showed when the
            # current menu item is prediction. The div assures that all filters
            # are handled as one
            hidden(div(id = "sidebarFilters", SidebarFilters())),
            menuItem(
                text = "Diagnostics",
                icon = icon("ambulance"),
                tabName = "diagnostics"
            )
        )
    ),
    dashboardBody(Body())
)

And the button and the filters are on another file that has the SideBarFilters() function:

SidebarFilters <- function() {
    
    return(
        tagList(
            selectInput("network", "Network",
                        choices = NULL),
            selectInput("campaign", "Campaign",
                        choices = NULL,multiple = T),
            selectInput("country", "Country",
                        choices = NULL, multiple = T),
            selectInput("platform", "Platform",
                        choices = NULL, multiple = T),
            selectInput("attributionMonth", "Attribution Month",
                        choices = NULL, multiple = T),
            actionButton("submitFilters", "Run Prediction",
                         icon = icon("refresh"))
            
))}

The action button is in no way different from the select inputs. Every thing else behaves normally except the alignment of that action button. Any hint on why that happens and how to solve it is appreciated.

Thank you in advance!

themupp...@yahoo.com

unread,
Jan 28, 2017, 6:51:30 AM1/28/17
to Shiny - Web Framework for R
Not sure if you still need to fix this, but I had the same problem and found the answer here.

For you, this would be something like adding 
tags$style(type='text/css', "button#submitFilters { margin-left: 9px; }")
below your actionButton call.

Hope that helps.
Reply all
Reply to author
Forward
0 new messages