LedgerUI.Components.MenuList (LedgerUI v0.2.0)

Copy Markdown View Source

Menu lists: a vertical list of links with one active entry (lu-ml), plus menu_item and menu_row.

<.menu_list variant="solid" color="primary">
  <:item navigate={~p"/orders"} active><.icon name="cart" />Orders</:item>
  <:item navigate={~p"/clients"} count={12}>Clients</:item>
</.menu_list>

<.menu_list variant="pill" on_select="pick">
  <:item value="shipping" active={@tab == "shipping"}>Shipping</:item>
</.menu_list>

Items with a destination (href, navigate, patch) are links; items with a value push on_select with %{"value" => value} (a %JS{} runs instead). variant="static" with :item slots is the read-only list (lu-ml static); with rows and :row it is the canvas list of menu_rows (a div).

Streams: <.menu_list id="pages" rows={@streams.pages}><:row :let={{_id, page}}>....

Notes

  • An active link item (or menu_item) carries aria-current="page".
  • Each :item accepts any attribute (style, phx-click, id...).
  • menu_item's variant/color default to nil: the item is then a bare <a> meant for a menu_list :row; with a variant it is wrapped in its own lu-ml navigation.

Summary

Functions

Same as menu_list/1 (same attributes and slots), under the name the design vitrine uses.

Functions