CSS 스타일 속성을 덮어 쓰려면 $ style 태그를 사용할 수 있습니다. 또한 이러한 접근 방식으로 너비와 높이와 같은 다른 속성을 조정할 수 있습니다. 아래 제공된 앱 템플릿은 내가 제공 한 링크의 코드에서 가져 왔습니다. 알리미를위한이 특정 CSS 사용자 정의는 또 다른 기존 답변에서 사용되었지만 지금 참조 할 링크를 찾지 못했습니다.
shinyApp(
ui = fluidPage(
tags$head(
tags$style(
HTML(".shiny-notification {
position:fixed;
top: calc(50%);;
left: calc(50%);;
}
"
)
)
),
textInput("txt", "Content", "Text of message"),
radioButtons("duration", "Seconds before fading out",
choices = c("2", "5", "10", "Never"),
inline = TRUE
),
radioButtons("type", "Type",
choices = c("default", "message", "warning", "error"),
inline = TRUE
),
checkboxInput("close", "Close button?", TRUE),
actionButton("show", "Show"),
actionButton("remove", "Remove most recent")
),
server = function(input, output) {
id <- NULL
observeEvent(input$show, {
if (input$duration == "Never")
duration <- NA
else
duration <- as.numeric(input$duration)
type <- input$type
if (is.null(type)) type <- NULL
id <<- showNotification(
input$txt,
duration = duration,
closeButton = input$close,
type = type
)
})
observeEvent(input$remove, {
removeNotification(id)
})
}
)
완벽한 Mr BigDataScientist! –