# `LedgerUI.Components.MenuList`
[🔗](https://github.com/devaction-labs/ledger_ui/blob/v0.2.0/lib/ledger_ui/components/menu_list.ex#L1)

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_row`s (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.

# `menu`

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

* `id` (`:string`) - Defaults to `nil`.
* `variant` (`:string`) - Defaults to `"link"`. Must be one of `"link"`, `"solid"`, `"pill"`, `"gradient"`, `"bordered"`, or `"static"`.
* `color` (`:string`) - Defaults to `"primary"`. Must be one of `"primary"`, or `"neutral"`.
* `on_select` (`:any`) - Defaults to `nil`.
* `target` (`:any`) - Defaults to `nil`.
* `rows` (`:any`) - A list or a stream rendered by `:row`. Defaults to `nil`.
* `row_id` (`:any`) - Defaults to `nil`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.
## Slots

* `item` - Accepts attributes:

  * `href` (`:string`)
  * `navigate` (`:string`)
  * `patch` (`:string`)
  * `active` (`:boolean`)
  * `value` (`:string`)
  * `count` (`:any`)
  * `class` (`:any`)
  * `style` (`:string`)
  * `id` (`:string`)
  * `title` (`:string`)
  * `phx-click` (`:any`)
  * `phx-target` (`:any`)
  * `phx-value-id` (`:any`)
* `row`

# `menu_item`

## Attributes

* `variant` (`:string`) - Defaults to `nil`.Must be one of `nil`, `"link"`, `"solid"`, `"pill"`, `"gradient"`, or `"bordered"`.
* `color` (`:string`) - Defaults to `nil`.Must be one of `nil`, `"primary"`, or `"neutral"`.
* `active` (`:boolean`) - Defaults to `false`.
* `value` (`:string`) - Defaults to `nil`.
* `on_select` (`:any`) - Defaults to `nil`.
* `target` (`:any`) - Defaults to `nil`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted. Supports all globals plus: `["href", "navigate", "patch", "method", "download", "replace"]`.
## Slots

* `count`
* `icon`
* `inner_block` (required)

# `menu_list`

## Attributes

* `id` (`:string`) - Defaults to `nil`.
* `variant` (`:string`) - Defaults to `"link"`. Must be one of `"link"`, `"solid"`, `"pill"`, `"gradient"`, `"bordered"`, or `"static"`.
* `color` (`:string`) - Defaults to `"primary"`. Must be one of `"primary"`, or `"neutral"`.
* `on_select` (`:any`) - Defaults to `nil`.
* `target` (`:any`) - Defaults to `nil`.
* `rows` (`:any`) - A list or a stream rendered by `:row`. Defaults to `nil`.
* `row_id` (`:any`) - Defaults to `nil`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.
## Slots

* `item` - Accepts attributes:

  * `href` (`:string`)
  * `navigate` (`:string`)
  * `patch` (`:string`)
  * `active` (`:boolean`)
  * `value` (`:string`)
  * `count` (`:any`)
  * `class` (`:any`)
  * `style` (`:string`)
  * `id` (`:string`)
  * `title` (`:string`)
  * `phx-click` (`:any`)
  * `phx-target` (`:any`)
  * `phx-value-id` (`:any`)
* `row`

# `menu_row`

## Attributes

* `title` (`:string`) - Defaults to `nil`.
* `sub` (`:string`) - Defaults to `nil`.
* `unread` (`:boolean`) - Defaults to `false`.
* `unread_label` (`:string`) - Defaults to `"Unread"`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted. Supports all globals plus: `["href", "navigate", "patch", "method", "download", "replace"]`.
## Slots

* `icon`
* `value`
* `inner_block`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
