更改大小,徽章的颜色和dragulaInput的文本

时间:2020-09-03 18:51:11

标签: r shiny shinydashboard

我使用包esquisse创建输入,我想知道如何更改徽章的大小,彩色文本和徽章的颜色吗?

enter image description here

if (interactive()) {
  
  library("shiny")
  library("esquisse")
  
  
  ui <- fluidPage(
    tags$h2("Demo dragulaInput"),
    tags$br(),
    dragulaInput(
      inputId = "dad",
      sourceLabel = "Old",
      targetsLabels = c("New"),
      choices = levels(iris[,"Species"]),
      width = "250px",
      height = "100px",
      status = "danger"
    ),
    verbatimTextOutput(outputId = "result")
  )
  
  
  server <- function(input, output, session) {
    
    output$result <- renderPrint({
      new_level <- input$dad$target$New
      new_level_1 <- c(new_level,input$dad$source)
       })
    
  }
  
  shinyApp(ui = ui, server = server)
  
}

1 个答案:

答案 0 :(得分:1)

您必须更改徽章的css属性。如果您检查徽章html,则会看到它们分别位于带有<span>的{​​{1}}标记中。

enter image description here

由于span标签不响应height和width指令,因此您必须将其转换为inline-block元素以更改大小(由于this发布)。所有这些操作都是在id=label-dragula label label-danger函数中完成的-宽度和高度是不言自明的,背景颜色是徽章的颜色,颜色是文本的颜色。

tags$style()

enter image description here