Skip to content

Menu

Use menu to create vertical lists of navigational links.
  • Alpha
  • Not reviewed for accessibility

Use Menu to create vertical lists of navigational links.

Arguments

NameTypeDefaultDescription
system_argumentsHashN/ASystem arguments

Slots

heading

Optional menu heading

NameTypeDefaultDescription
tagSymbolN/AOne of :h1, :h2, :h3, :h4, :h5, or :h6.
system_argumentsHashN/ASystem arguments

items

Required list of navigational links

NameTypeDefaultDescription
hrefStringN/AURL to be used for the Link
selectedBooleanN/AWhether the item is the current selection
system_argumentsHashN/ASystem arguments

Examples

Default

<%= render(Primer::Alpha::Menu.new) do |component| %>
<% component.with_heading(tag: :h2) do %>
Heading
<% end %>
<% component.with_item(selected: true, href: "#url") do %>
Item 1
<% end %>
<% component.with_item(href: "#url") do %>
<%= render(Primer::Beta::Octicon.new("check")) %>
With Icon
<% end %>
<% component.with_item(href: "#url") do %>
<%= render(Primer::Beta::Octicon.new("check")) %>
With Icon and Counter
<%= render(Primer::Beta::Counter.new(count: 25)) %>
<% end %>
<% end %>