将选项卡放在右侧的 Shiny tabsetPanel 中 [英] Place tab in Shiny tabsetPanel on the right

查看:23
本文介绍了将选项卡放在右侧的 Shiny tabsetPanel 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,tabsetPanel 中的选项卡位于左侧.是否可以在右侧放置一个选项卡,而左侧仍然有其他选项卡?所以它看起来像这样?

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 looks like this?

library(shiny)

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

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

shinyApp(ui, server)

推荐答案

使用 float-right 确实应该有效.使用 2 个 tabsetPanel 的问题是同时有 2 个活动标签.

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)

这篇关于将选项卡放在右侧的 Shiny tabsetPanel 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆