Place tab in Shiny tabsetPanel on the right

后端 未结 3 985
夕颜
夕颜 2021-01-20 16:49

By default tabs in a tabsetPanel are put on the left. Is it possible to place a tab on the right side, while still having other tabs on the left? So that it loo

相关标签:
3条回答
  • 2021-01-20 17:34

    Maybe you can create 2 tabsetPanel and pull one over to the right?

    rm(list = ls())
    library(shiny)
    ui <- fluidPage(
      div(style="display:inline-block",tabsetPanel(type = c("pills"),tabPanel("tab_left1"),tabPanel("tab_left2"))),
      div(style="display:inline-block;float: right",tabsetPanel(type = c("pills"),tabPanel("tab_right")))
    )
    
    server <- function(input, output, session) {}
    
    shinyApp(ui, server)
    

    0 讨论(0)
  • 2021-01-20 17:43

    When you apply the class float-right to the ones you want to float to the right, it should do the trick.

    0 讨论(0)
  • 2021-01-20 17:47

    Using float-right should indeed work. The problem with using 2 tabsetPanel is that there are 2 active tabs at the same time.

    library(shiny)
    
    ui <- fluidPage(
      tags$head(
        tags$style(HTML(
          ".tabbable ul li:nth-child(3) { float: right; }"
        ))
      ),
      tabsetPanel(
        tabPanel("tab_left1"),
        tabPanel("tab_left2"),
        tabPanel("tab_right")
      )
    )
    
    server <- function(input, output, session) {}
    
    shinyApp(ui, server)
    

    0 讨论(0)
提交回复
热议问题