Reputation: 101
Below is my ui code
> dashboardHeader(title = uiOutput("flex_logo"),
> tags$li(class = "dropdown",
> tags$a("Help",target="_blank",href="Flex-Forecasting_Usage_Guidelines.pdf",
> style="font-weight: bold;color:white;")),
> tags$li(class = "dropdown",tags$a(href="mailto:[email protected]?subject=
> flex-forecasting","Contact us",style="font-weight:
> bold;color:white;")),
> tags$li(class = "dropdown",tags$a("Change password",actionLink("ChangePassword","Change
> Password"),style="font-weight: bold;color:white;")),
> tags$li(class ="dropdown",dropdownMenu(type = "notifications",
> notificationItem(text = "No new notification",status = "success")
> # notificationItem(text = "Nnet & Nnetx takes time to converge",status = "success")
>
> )))
>
>
I want the Change Password button in same format and style as help and contact us,but when i add actionbutton OR actionlink,not able to get the same format and alignment respectively.
Alternatively if i add a tagname(Change password it has the same format,but i want to link it with observe function further
Upvotes: 1
Views: 2016
Reputation: 7830
You are giving the style
parameter to tag$a
, so you are stylizing the hyperlink and not the button. You should have used it into actionLink
i.e. : actionLink("ChangePassword", "Change Password", style = "font-weight: bold;color:white;")
Also you don't have to wrap your actionButton
in tag$a
and since you use the same style
for several items then you can create a custom css class with the desire style and it will applies to every tags having the same class
shinyApp(
ui = dashboardPage(
dashboardHeader(
tags$li(class = "dropdown", tags$a(href = "", class = "my_class", "Help", target="_blank")),
tags$li(class = "dropdown", tags$a(href = "", class = "my_class", "Contact us")),
tags$li(class = "dropdown", actionLink("ChangePassword", "Change Password", class = "my_class"))),
dashboardSidebar(),
dashboardBody(tags$head(
tags$style(HTML("
.my_class {
font-weight: bold;
color:white;
}"))
)),
title = "Dashboard example"
),
server = function(input, output) { }
)
Upvotes: 2