Sha256: 276fd3dcf4daf3421480c4f3a4001df111dd505498cf9766510375dd784c86fc

Contents?: true

Size: 923 Bytes

Versions: 1

Compression:

Stored size: 923 Bytes

Contents

<%= render(Primer::Alpha::NavList.new) do |list| %>
  <% list.with_group do |group| %>
    <%= group.with_heading(title: "Shopping list") %>
    <% group.with_item(label: "Bread", href: "/list/1") do |item| %>
      <%= item.with_trailing_action(show_on_hover: true, icon: :plus, aria: { label: "Activate alert" }, name: "bread_button") %>
    <% end %>
    <% group.with_item(label: "Cheese", href: "/list/2") do |item| %>
      <%= item.with_trailing_action(icon: :plus, aria: { label: "Activate alert" }, name: "cheese_button") %>
    <% end %>
  <% end %>
<% end %>

<script type="text/javascript" data-eval="true">
  const breadButton = document.querySelector("[name=bread_button]")
  breadButton.addEventListener("click", () => alert("You selected bread."))

  const cheeseButton = document.querySelector("[name=cheese_button]")
  cheeseButton.addEventListener("click", () => alert("You selected cheese."))
</script>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
primer_view_components-0.1.1 previews/primer/alpha/nav_list_preview/trailing_action.html.erb