Skip to contents

Element Plus's el-menu-item, el-sub-menu and el-menu-item-group, for el_menu(items =). A submenu and a group hold items of their own in ..., nested to any depth.

Usage

el_menu_item(label, index, icon = NULL, route = NULL, disabled = NULL)

el_sub_menu(
  label,
  index,
  ...,
  icon = NULL,
  disabled = NULL,
  popper_class = NULL,
  popper_style = NULL,
  show_timeout = NULL,
  hide_timeout = NULL,
  teleported = NULL,
  popper_offset = NULL,
  expand_close_icon = NULL,
  expand_open_icon = NULL,
  collapse_close_icon = NULL,
  collapse_open_icon = NULL
)

el_menu_item_group(title, ...)

Arguments

label

The text shown.

index

The item's value, input$<id> when it is selected.

icon

An icon, by name: "House".

route

Where the item goes, with el_menu(router = TRUE).

disabled

Whether the item or submenu is disabled.

...

The submenu's or the group's items.

popper_class, popper_style

Class and style of the submenu's popup.

show_timeout, hide_timeout

Delay before the submenu opens and closes, in milliseconds; the menu's by default.

teleported

Whether the popup is appended to <body>: by default for a top-level submenu, not for others.

popper_offset

Offset of the popup, over the menu's.

expand_close_icon, expand_open_icon

Icons of the submenu when the menu is expanded, closed and open; give both.

collapse_close_icon, collapse_open_icon

The same when the menu is collapsed.

title

The group's title.

Value

An item, for el_menu(items =).

Binding

No argument follows v_bind(): an item is drawn by el_menu() from R.

Examples

el_menu(
  "m",
  items = list(
    el_menu_item("Processing Center", "1"),
    el_sub_menu(
      "Workspace",
      "2",
      el_menu_item("item one", "2-1"),
      el_menu_item_group("Group", el_menu_item("item two", "2-2"))
    ),
    el_menu_item("Info", "3", disabled = TRUE)
  ),
  mode = "horizontal"
)
#> <div id="m" data-shiny-vue style="display: contents">
#>   <script type="text/x-template" data-shiny-vue-template><div id="m_container" style="display: contents">
#>   <el-menu v-bind="$optional(&#39;menu&#39;)" :default-active="active" :mode="mode" :collapse="collapse" :unique-opened="uniqueOpened" @select="handleSelect">
#>     <el-menu-item index="1" @click="elMenuItemClick(&quot;1&quot;)">
#>       <span>Processing Center</span>
#>     </el-menu-item>
#>     <el-sub-menu index="2">
#>       <template v-slot:title>
#>         <span>Workspace</span>
#>       </template>
#>       <el-menu-item index="2-1" @click="elMenuItemClick(&quot;2-1&quot;)">
#>         <span>item one</span>
#>       </el-menu-item>
#>       <el-menu-item-group title="Group">
#>         <el-menu-item index="2-2" @click="elMenuItemClick(&quot;2-2&quot;)">
#>           <span>item two</span>
#>         </el-menu-item>
#>       </el-menu-item-group>
#>     </el-sub-menu>
#>     <el-menu-item index="3" :disabled="true" @click="elMenuItemClick(&quot;3&quot;)">
#>       <span>Info</span>
#>     </el-menu-item>
#>   </el-menu>
#> </div></script>
#>   <script type="application/json" data-shiny-vue-options>{"options":{"data":{"active":"","mode":"horizontal","collapse":false,"uniqueOpened":false,"path":[],"backgroundColor":null,"textColor":null,"activeTextColor":null,"defaultOpeneds":null,"menuTrigger":null,"collapseTransition":null,"router":null,"closeOnClickOutside":null,"ellipsis":null,"ellipsisIcon":null,"hideTimeout":null,"persistent":null,"popperClass":null,"popperEffect":null,"popperOffset":null,"popperStyle":null,"showTimeout":null},"methods":{"elMenuItemClick":"function(index) { window.Shiny && Shiny.setInputValue && Shiny.setInputValue('m_item_click', index, {priority: 'event'}); }","handleSelect":"function(index, indexPath) { var self = this; self.path = indexPath; window.Shiny && Shiny.setInputValue && Shiny.setInputValue('m_path', indexPath); if (self.router && self.$router) return; self.active = index; }"},"watch":{"$route.path":{"handler":"function(p) { if (!this.router || !this.$router || p === undefined) return; this.active = p; window.Shiny && Shiny.setInputValue && Shiny.setInputValue('m', p); }","immediate":true}},"mounted":"function() { var self = this; var send = function() { window.Shiny && Shiny.setInputValue && Shiny.setInputValue(\"m_path\", self.path); }; if (window.Shiny && Shiny.shinyapp && typeof Shiny.shinyapp.isConnected === 'function' && Shiny.shinyapp.isConnected()) { send(); } else if (window.jQuery) { jQuery(document).one('shiny:connected', send); } var prev = self._svReport; self._svReport = function() { if (prev) prev(); self.$nextTick(send); }; }"},"input":"active || null","rate":null,"type":null,"use":["shinyElement.plugin"],"optional":{"menu":{"background-color":"backgroundColor","text-color":"textColor","active-text-color":"activeTextColor","default-openeds":"defaultOpeneds","menu-trigger":"menuTrigger","collapse-transition":"collapseTransition","router":"router","close-on-click-outside":"closeOnClickOutside","ellipsis":"ellipsis","ellipsis-icon":"ellipsisIcon","hide-timeout":"hideTimeout","persistent":"persistent","popper-class":"popperClass","popper-effect":"popperEffect","popper-offset":"popperOffset","popper-style":"popperStyle","show-timeout":"showTimeout"}},"evals":["options.methods.elMenuItemClick","options.methods.handleSelect","options.watch.$route\\.path.handler","options.mounted"]}</script>
#> </div>