将闪亮的WellPanel调整为内容大小并放置一个关闭按钮

时间:2018-08-02 17:31:20

标签: r layout shiny

最近我开始学习闪亮的东西,我正在玩wellPanels。我正在尝试创建一个不超过其内容所需的wellPanel。我设法得到以下信息:

wellPanel

但尚未找到消除wellPanel右侧多余空间的方法。如果可能的话,我也想将“ X”按钮放在wellPanel的右上角。有办法吗?预先感谢!

这是工作代码:

library(shiny)

ui <- fluidPage(

  fluidRow(column(width = 6, 
                  wellPanel(
                    fluidRow(
                      column(width = 3, textInput(inputId = "layer", label = "Layer name", placeholder = "Layer name")),
                      column(width = 3, numericInput(inputId = "att_point", label = "Attachment Point", value = 100)),
                      column(width = 3, numericInput(inputId = "capacity", label = "Capacity", value = 100)),
                      column(width = 3, actionButton(inputId = "rm_btn", label = "", icon = icon("times")))
                    )))))

shinyApp(ui, function(input,output){})

1 个答案:

答案 0 :(得分:1)

您需要像这样调整宽度:

library(shiny)

ui <- fluidPage(

  fluidRow(column(width = 6, 
                  wellPanel(
                    fluidRow(
                      column(width = 4, textInput(inputId = "layer", label = "Layer name", placeholder = "Layer name")),
                      column(width = 4, numericInput(inputId = "att_point", label = "Attachment Point", value = 100)),
                      column(width = 3, numericInput(inputId = "capacity", label = "Capacity", value = 100)),
                      column(width = 1, actionButton(inputId = "rm_btn", label = "", icon = icon("times")))
                    )))))

shinyApp(ui, function(input,output){})

通过此操作,您将获得如下所示的输出: enter image description here

希望有帮助!