In the example below, the 'Selections Saved' notification appears in the bottom-right corner of the application. Instead I would like it to appear in the sidebar (either directly under the action button, or simply at the bottom left of the side-bar):
## app.R ##
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
actionButton("apply", "Save Selections")
),
dashboardBody()
)
server <- function(input, output) {
observeEvent(input$apply, {
showNotification("Selections Saved", duration = 2)
})
}
shinyApp(ui, server)
I know that there are similar questions already, but these result in the notification being shown in the middle of the screen, rather than in the sidebar.
CodePudding user response:
Have you tried to just change the percentages?
# bottom-left
custom_notes <- HTML(
"
.shiny-notification {
position: fixed;
top: calc(0%);
left: calc(100%);
}
"
)
And them put tags$head(tags$style(custom_notes))
inside ui
, before the dashboard elements?