【问题标题】:Set R shiny modal width when theme is defined by bslib当主题由 bslib 定义时设置 R 闪亮模态宽度
【发布时间】:2022-01-18 12:11:55
【问题描述】:

当 bs_theme() 处于活动状态时,如何将模态宽度设置为 80%? bs_theme() 中是否有可能?我只是无法正确使用标签。

library(shiny)
library(bslib)
ui <- fluidPage(
    shiny::bootstrapLib(),
    theme = bs_theme(
        version = 4,
        bootswatch = "minty"),
    tags$style(".modal-dialog{width: 80% !important;}"),
    actionButton("open_modal", "open modal"),
)

server <- function(input, output) {
    observeEvent(input$open_modal, {
        showModal(
            modalDialog(
                title = "This modal isn't 80% wide")
        )
    })
} 
shinyApp(ui = ui, server = server)

【问题讨论】:

标签: r shiny modal-dialog bslib


【解决方案1】:

请改用tags$style(".modal-dialog {max-width: 80vw;}")。它确保您的模态始终占据整个窗口的 80%,并在您更改窗口大小时自动调整大小。

【讨论】:

    猜你喜欢
    • 2014-10-02
    • 2018-08-14
    • 2017-02-25
    • 2019-04-30
    • 1970-01-01
    • 1970-01-01
    • 2016-01-02
    • 2021-06-13
    • 1970-01-01
    相关资源
    最近更新 更多