R Shiny 的 PrettyRadioButtons 答案选项不会根据屏幕尺寸换行

发布于 2025-01-10 06:45:05 字数 1411 浏览 2 评论 0原文

为什么这个 prettyRadioButtons 问题的长答案选项不会根据屏幕尺寸自动换行?下面是模拟不同设备的 Chrome 浏览器 Inspect 模式的两张屏幕截图。

即使手动将宽度设置为“300px”也不会包装答案选项。

铬>检查>反应灵敏 输入图片此处描述

Chrome >检查> iPhone SE 输入图片此处描述

library(shiny)
library(bslib)
library(shinyWidgets)

ui <- bootstrapPage(
  theme = bs_theme(version = 5, "font-scale" = 1.0), 
  
  div(class = "container-fluid",
      
      div(class = "row",
          div(class="col-12", 
              prettyRadioButtons(
                inputId = "a",
                label = "Group A",
                selected = NULL,
                status = "primary",
                shape = c("round"),
                width = NULL,
                choiceNames = c("Lorem Ipsum is simply dummy text of the ",
                                "printing and typesetting industry.Lorem Ipsum has",
                                "been the industry's standard dummy text ever since the 1500s, when an unknown printer"), 
                choiceValues = c("opt1", "opt2", "opt3")
              )
          )
      )
  )
)

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

shinyApp(ui, server)

Why do the long answer options of this prettyRadioButtons question not automatically wrap based on the screen size? Below are two screenshots of the Chrome browser's Inspect mode simulating different devices.

Even manually setting the width to "300px" doesn't wrap the answer options.

Chrome > Inspect > Responsive
enter image description here

Chrome > Inspect > iPhone SE
enter image description here

library(shiny)
library(bslib)
library(shinyWidgets)

ui <- bootstrapPage(
  theme = bs_theme(version = 5, "font-scale" = 1.0), 
  
  div(class = "container-fluid",
      
      div(class = "row",
          div(class="col-12", 
              prettyRadioButtons(
                inputId = "a",
                label = "Group A",
                selected = NULL,
                status = "primary",
                shape = c("round"),
                width = NULL,
                choiceNames = c("Lorem Ipsum is simply dummy text of the ",
                                "printing and typesetting industry.Lorem Ipsum has",
                                "been the industry's standard dummy text ever since the 1500s, when an unknown printer"), 
                choiceValues = c("opt1", "opt2", "opt3")
              )
          )
      )
  )
)

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

shinyApp(ui, server)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

無處可尋 2025-01-17 06:45:05

这可能是 Chrome 的问题。如果 Inspect 打开时将 Dimensions: 设置为 Responsive,然后我切换到 iPhone SE,它就可以工作。

如果 Inspect 打开时将 Dimensions: 设置为 iPhone SE,则答案选项将始终被截断。

This may be an issue with Chrome. If Inspect opens with Dimensions: set to Responsive and then I switch to iPhone SE it works.

If Inspect opens with Dimensions: set to iPhone SE the answer options will always be cutoff.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文