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

Kanban board: a row of tinted columns holding cards that are dragged between them.

    <.kanban id="funnel" event="move" aria-label="Sales funnel" style="--cols:3">
      <.kanban_column id="col-open" list="open" label="Open" count={length(@open)} color="primary">
        <.kanban_card :for={card <- @open} id={"card-#{card.id}"} item={card.id}>
          <b>{card.title}</b>
        </.kanban_card>
        <:empty>Drop here</:empty>
      </.kanban_column>
      <.kanban_lost label="Lost" count={3} list="lost" />
    </.kanban>

The board is one `LedgerUI.Sortable` hook (`priv/static/ledger_ui/hooks/sortable.js`): columns are
lists, cards are items, and a drop pushes `event` (to `target` when given) with
`%{"id" => item, "from" => list, "to" => list, "index" => position}`. Nothing is moved in the
browser: the server's render is the new order. `data-list`/`data-id` are only rendered when
`list`/`item` are given; the hook falls back to the element ids.

A column with a `limit` turns its pill and bar red (`data-wip="exceeded"`) when `count` goes over
it. The board is `role="group"` when it has an `aria-label`. `--cols` in `style` sets the grid
columns; without it the columns are 272px wide in a row that scrolls sideways (`fluid` shares
the width instead).

The same hook sorts any list: put `phx-hook="LedgerUI.Sortable"` on it with `data-list`,
`data-event`, `data-group`, `data-handle`, `data-axis`, `data-target`, `data-disabled`; items
carry `data-id`.

# `kanban`

## Attributes

* `id` (`:string`) (required)
* `event` (`:string`) - Defaults to `nil`.
* `target` (`:any`) - Defaults to `nil`.
* `group` (`:string`) - Defaults to `nil`.
* `disabled` (`:boolean`) - Defaults to `false`.
* `fluid` (`:boolean`) - Defaults to `false`.
* `active` (`:string`) - Phone mode: the column shown below 640px. Defaults to `nil`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.
## Slots

* `inner_block` (required)

# `kanban_card`

## Attributes

* `id` (`:string`) (required)
* `item` (`:any`) - Defaults to `nil`.
* `risk` (`:boolean`) - Defaults to `false`.
* `dense` (`:boolean`) - Defaults to `false`.
* `grip` (`:boolean`) - Defaults to `false`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.
## Slots

* `actions`
* `inner_block` (required)

# `kanban_column`

## Attributes

* `id` (`:string`) (required)
* `list` (`:string`) - Defaults to `nil`.
* `label` (`:string`) (required)
* `count` (`:any`) - Defaults to `nil`.
* `count_label` (`:string`) - Defaults to `nil`.
* `over_limit` (`:boolean`) - Defaults to `false`.
* `hint` (`:string`) - Defaults to `"empty"`. Must be one of `"empty"`, or `"always"`.
* `active` (`:boolean`) - Defaults to `false`.
* `color` (`:string`) - Defaults to `nil`.Must be one of `nil`, `"neutral"`, `"info"`, `"warning"`, `"primary"`, `"teal"`, or `"success"`.
* `limit` (`:integer`) - Defaults to `nil`.
* `meta` (`:string`) - Defaults to `nil`.
* `total` (`:string`) - Defaults to `nil`.
* `progress` (`:integer`) - Defaults to `nil`.
* `disabled` (`:boolean`) - Defaults to `false`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.
## Slots

* `actions`
* `icon`
* `footer`
* `inner_block`
* `empty` - Accepts attributes:

  * `title` (`:string`)
  * `icon` (`:string`)

# `kanban_lost`

## Attributes

* `label` (`:string`) (required)
* `count` (`:integer`) - Defaults to `nil`.
* `meta` (`:string`) - Defaults to `nil`.
* `list` (`:string`) - Defaults to `nil`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.
## Slots

* `icon`

---

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