如何将表格添加到 Shiny 中 ConditionalPanel 的隐藏选项中?

How to add tabulation to the hidden choices from a ConditionalPanel in Shiny?

我正在创建一个应用程序,其中有一个 checkboxInput,如果您单击它,您将有另一个选项 select。这些选项被 conditionalPanel 隐藏。只有单击复选框才能看到它们。

但是,我想知道是否可以对这些选项进行一些制表,因为我不希望它们具有相同的组织级别。 例如:

代码:

library(shiny)


ui <- fluidPage(
  
  titlePanel("My app"),
  
  sidebarLayout(
    sidebarPanel(
      tabsetPanel(

        tabPanel("Tab1",
                 checkboxInput("option1", "Remove...", value = FALSE),
                 
                 conditionalPanel(
                   condition = "input.option1 == 1",
                   radioButtons(inputId = "type_removal", label=NULL,
                                choices = c("Remove 1" = "remove1",
                                            "Remove 2" = "remove2"))),
                 
                  textInput(inputId = "data2", "Data1", value = "data")),
        
        tabPanel("Tab2",
                textInput(inputId = "data", "Data1", value = "data")
       ),
      
      )
    ),
    
    mainPanel(
     
    )
  )
)


server <- function(input, output) {

}

shinyApp(ui = ui, server = server)

可以在 Shiny 中实现吗?

非常感谢

此致

将此 css 添加到您的闪亮应用中:

.shiny-options-group{
  margin-left: 20px;
}

您可以向条件面板添加内联样式:

             conditionalPanel(
               condition = "input.option1 == 1",
               style = "margin-left: 100px;",
               radioButtons(inputId = "type_removal", label=NULL,
                            choices = c("Remove 1" = "remove1",
                                        "Remove 2" = "remove2"))),