将选项卡放在右侧的Shiny tabsetPanel中

时间:2018-01-12 09:28:10

标签: css r shiny bootstrap-4

默认情况下,tabsetPanel中的标签位于左侧。是否可以在右侧放置一个标签,同时左侧还有其他标签?它看起来像这样吗?

enter image description here

library(shiny)

ui <- fluidPage(
  tabsetPanel(
    tabPanel("tab_left1"),
    tabPanel("tab_left2"),
    tabPanel("tab_right")
  )
)

server <- function(input, output, session) {}

shinyApp(ui, server)

3 个答案:

答案 0 :(得分:4)

使用float-right确实可行。使用2 tabsetPanel的问题在于,同时有2个活动标签。

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)

enter image description here

答案 1 :(得分:2)

也许你可以创建2 tabsetPanel并将其拉到右边?

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)

enter image description here

答案 2 :(得分:1)

当您将类if (ARConfiguration.isSupported) { // Great! let have experience of ARKIT } else { // Sorry! you don't have ARKIT support in your device } 应用于要向右浮动的类时,它应该可以解决问题。