【发布时间】:2020-07-27 01:00:42
【问题描述】:
我正在设计一个闪亮的应用程序,并且有一个绝对面板,我希望它具有仪表板式的外观。
基本上,我希望在仪表板中显示一些按钮的文本描述,这些按钮显示在文本描述下方的中心。我目前使用 CSS 中的绝对位置控件来确定面板内的位置。虽然这目前有效,但我认为这不是一种特别可扩展的方法。
我附上了一些可重现的代码,以便您了解我在说什么。
非常感谢您的帮助。
library(shiny)
library(shinyWidgets)
ui <- fluidPage(
absolutePanel(
id = "quick-glance", style="z-index:500; opacity: 0.90",
class = "panel panel-default",
draggable=TRUE,
fixed=TRUE,
width = 180,
height = 75,
top = 20, left = 50,
textOutput("label1"), tags$head(tags$style("#label1{
color: steelblue;
font-weight: bold;
border: none;
position: absolute; top: 5px; left: 30px;
")),
actionBttn("bttn1",label = "$##",style = "bordered",color = "primary"),
tags$head(tags$style("#bttn1{ position: absolute; bottom: 5px; left: 20px;}")),
textOutput("label2"),tags$head(tags$style("#label2{
color: steelblue;
font-weight: bold;
border: none;
position: absolute; top: 5px; left: 100px;
")),
actionBttn("bttn2",label = "#",style = "bordered",color = "danger"),
tags$head(tags$style("#bttn2{ position: absolute; bottom: 5px; left: 110px;}"))
)
)
server <- function(input, output, session) {
output$bttn1 = renderPrint(input$bttn1)
output$label1 = renderText("Text")
output$label2 = renderText("Text Text")
output$bttn2 = renderPrint(input$bttn2)
}
shinyApp(ui, server)
【问题讨论】:
标签: html css r shiny dashboard