如何相对于sidebarPanel放置通知?

时间:2019-02-01 10:41:02

标签: css r shiny

如何相对于sidebarPanel放置通知?我的目标是使两个元素顶部对齐,并将它们之间的水平间距设置为100像素。我现在正在做的是硬编码通知的位置:

library(shiny)

ui <- tagList(
  tags$head(tags$style(HTML(".shiny-notification {position:fixed;top:calc(10%);left:calc(35%);}"))),
  navbarPage(
    title = "some title",
    sidebarLayout(
      sidebarPanel(
        selectInput(
          inputId = "some_id", 
          label = HTML("Some label", 
                       as.character(actionLink(inputId = 'action_link', label = 'Click me'))),
          choices = c("choice A", "choice B"),
          selected = "choice A",
          selectize = F
        )

      ), # sidebarPanel

      mainPanel()

    ) # sidebarLayout
  ) # navbarPage
) # tagList

server <- function(input, output) {
  observeEvent(input$action_link, {
    showNotification("Test", duration = NULL, type = "message")
  })
}

shinyApp(ui, server)

enter image description here

0 个答案:

没有答案