使图像填充tabpanel中列的高度shinydashboard

xqkwcwgp  于 2024-01-03  发布在  其他
关注(0)|答案(1)|浏览(73)

我有一个选项卡面板,我想一个数字,以填补整个面板的高度(图是高但窄).在图的左边我有一些文本,我希望图对齐tabPanel的右侧.然而,与下面的代码,我似乎无法得到的图,以填补整个面板的长度,而且它不能自动调整到正确的屏幕尺寸。正确的方法是什么?

ui <- shinydashboard::dashboardPage(
  shinydashboard::dashboardHeader(title = "title"),
  shinydashboard::dashboardSidebar(),
  shinydashboard::dashboardBody(
    shinydashboard::tabBox(
      title = "title",
      shiny::tabPanel(
        "test panel",
        column(
          width = 8,
          HTML(
          "Some text goes here with bullet points.
          <ul>
          <li>
          <b>Point one:</b> Lorem ipsum.
          </li>
          </ul>")
        ),
        column(
          width = 2,
          img(
            src ='testfig.png',
            style = 'width: 100%;'
          )
        )
      )
    )
  )
)

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

shiny::shinyApp(ui, server)

字符串
上面的代码生成了这个:


的数据
虽然这是我想要的样子:


k2fxgqgv

k2fxgqgv1#

column()应该被 Package 在fluidRow()中:

library(shiny)
library(shinydashboard)

ui <- shinydashboard::dashboardPage(
  shinydashboard::dashboardHeader(title = "title"),
  shinydashboard::dashboardSidebar(),
  shinydashboard::dashboardBody(
    tagAppendAttributes(shinydashboard::tabBox(
      title = "title",
      shiny::tabPanel("test panel",
                      fluidRow(
                        column(width = 10,
                               withTags(
                                 div("Some text goes here with bullet points.",
                                     ul(li(
                                       b("Point one:"), " Lorem ipsum."
                                     )))
                               )),
                        column(
                          width = 2,
                          img(src = 'https://www.r-project.org/logo/Rlogo.svg',
                              style = 'width: 10vw; height: 84vh; float:right;')
                        )
                      )), width = 12
    ), style = "padding:0px;"))
)

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

shiny::shinyApp(ui, server)

字符串

相关问题