r - 如何使 Fluent UI Nav 水平折叠

标签 r shiny fluent-ui

我开始使用基于Microsoft Fluent UI的shiny.fluent R包来构建应用程序,但我坚持让导航组件在单击(第一个链接,导航栏图标)和小屏幕尺寸时折叠

这是来自shiny.flutter示例的示例代码:

library(shiny)
library(shiny.fluent)

navigation_styles <- list(
  root = list(
    height = "100%",
    width = "30%",
    boxSizing = "border-box",
    border = "1px solid #eee",
    overflowY = "auto"
  )
)

link_groups <- list(
  list(
    links = list(
      list(key = "toggle_hide", icon = "GlobalNavButton"),
      list(
        name = "Home",
        expandAriaLabel = "Expand Home section",
        collapseAriaLabel = "Collapse Home section",
        links = list(
          list(
            name = "Activity",
            url = "http://msn.com",
            key = "key1",
            target = "_blank"
          ),
          list(
            name = "MSN",
            url = "http://msn.com",
            disabled = TRUE,
            key = "key2",
            target = "_blank"
          )
        ),
        isExpanded = TRUE
      ),
      list(
        name = "Documents",
        url = "http://example.com",
        key = "key3",
        isExpanded = TRUE
      ),
      list(
        name = "Pages",
        url = "http://msn.com",
        key = "key4"
      ),
      list(
        name = "Notebook",
        url = "http://msn.com",
        key = "key5",
        disabled = TRUE
      ),
      list(
        name = "Communication and Media",
        url = "http://msn.com",
        key = "key6"
      ),
      list(
        name = "News",
        url = "http://cnn.com",
        icon = "News",
        key = "key7",
        target = "_blank",
        iconProps = list(
          iconName = "News",
          styles = list(
            root = list(
              fontSize = 20,
              color = "#106ebe"
            )
          )
        )
      )
    )
  )
)

shinyApp(
  ui = withReact(
    Nav(
      groups = link_groups,
      selectedKey = "key1",
      styles = navigation_styles
    )
  ),
  server = function(input, output) {
  }
)

我想要的视觉输出是:

请帮助我解决这个问题,我仍然无法在网上找到任何可用的解决方案

最佳答案

我通过使用悬停时的转换而不是展开按钮来实现这一点。检查我在风格上所做的更改。不过,嵌套菜单将成为此方法的一个问题。

    navigation_styles <- list(
    root = list(
        height = "100%",
        width = "30%",
        boxSizing = "border-box",
        border = "1px solid #eee",
        overflowY = "auto",


        //TRYOUT THE CODE BELOW
        transition: 'width 0.3s ease-in-out',
        selectors: {
                     ':hover':{
                         width: '100%'
                      }
                   }
        )
     )

关于r - 如何使 Fluent UI Nav 水平折叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67089903/

相关文章:

r - 在 R 中使用 randomForest 包进行预测

r - 如何从数据表中的列子集中提取唯一行?

r - 如何在 Shiny 的不同选项卡面板上使用相同的输出绑定(bind)

flutter - 在 Flutter 中设置窗口拖动点

r - 过滤至少包含 X 个观测值且值大于(或等于)Y 的表行

r - ggplot 将主轴.刻度线长度与短轴.刻度线长度对齐

r - 如何阅读 .xpt 文件?

删除 Shiny 数据表excel输出中标题上方的 "title"行?

c# - 无法为类型 'IconService' 上的属性 'Microsoft.Fast.Components.FluentUI.FluentIcon' 提供值

reactjs - 如何使用 react 在 Fluent UI Detaillist 中添加分页