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

Events down a line, each marked by a filled, outlined, icon or avatar point.

    <.timeline marker="icon" size="lg">
      <.timeline_item title="NF-e autorizada" description="Protocolo 129 2611" time="14:02" color="success">
        <:point><.icon name="check" size="sm" /></:point>
      </.timeline_item>
    </.timeline>

The items can come from a list or a stream through `rows` and the `:item` slot, which gets
`{dom_id, row}` (given a stream, the list renders with `phx-update="stream"` and needs an `id`):

    <.timeline id="events" rows={@streams.events}>
      <:item :let={{id, event}}>
        <.timeline_item id={id} title={event.title} time={event.ago} color={event.color} />
      </:item>
    </.timeline>

`variant="canvas"` is a list of `timeline_event`s, each with a boxed icon tile, a title over a
subtitle and the time at the right.

Styling note: the marker look (`solid`, `outline`, `icon`, `avatar`, `dot`) is a class of the
whole line in the stylesheet, so it is set on the timeline with `marker`; the item's `variant`
only decides what its point holds.

# `timeline`

## Attributes

* `line_space` (`:boolean`) - Leaves a gap between the points and the line. Defaults to `false`.
* `size` (`:string`) - Defaults to `"md"`. Must be one of `"md"`, `"lg"`, `"xl"`, or `"2xl"`.
* `density` (`:string`) - Defaults to `"default"`. Must be one of `"default"`, or `"compact"`.
* `variant` (`:string`) - Defaults to `"line"`. Must be one of `"line"`, or `"canvas"`.
* `marker` (`:string`) - The look of the points of a `line` timeline. Defaults to `"solid"`. Must be one of `"solid"`, `"outline"`, `"icon"`, `"avatar"`, or `"dot"`.
* `items` (`:list`) - Points as data, before the inner block: maps with `:title` and optionally `:time`, `:description`, `:color`, `:variant` (`solid`, `outline`, `icon`, `avatar`) and `:ping`, one `timeline_item/1` each. Defaults to `[]`.
* `id` (`:string`) - Required with a stream. Defaults to `nil`.
* `rows` (`:any`) - A list or a stream of rows rendered by the `:item` slot. Defaults to `nil`.
* `row_id` (`:any`) - A function from a row to its DOM id, for a plain list. Defaults to `nil`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.
## Slots

* `inner_block`
* `item` - Renders one row; gets `{dom_id, row}`.

# `timeline_day`

## Attributes

* `label` (`:string`) (required)
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.

# `timeline_event`

## Attributes

* `title` (`:string`) - Defaults to `nil`.
* `subtitle` (`:string`) - Defaults to `nil`.
* `time` (`:string`) - Defaults to `nil`.
* `tone` (`:string`) - Defaults to `"default"`. Must be one of `"acc"`, `"default"`, `"info"`, `"neg"`, `"pos"`, or `"warn"`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.
## Slots

* `icon` - The icon inside the tile.
* `inner_block` - Free content after the title and the subtitle.

# `timeline_item`

## Attributes

* `title` (`:string`) - Defaults to `nil`.
* `time` (`:string`) - Defaults to `nil`.
* `description` (`:string`) - Defaults to `nil`.
* `color` (`:string`) - Defaults to `"neutral"`. Must be one of `"accent"`, `"dark"`, `"error"`, `"info"`, `"neutral"`, `"primary"`, `"secondary"`, `"success"`, or `"warning"`.
* `variant` (`:string`) - Defaults to `"solid"`. Must be one of `"solid"`, `"outline"`, `"icon"`, or `"avatar"`.
* `point_class` (`:any`) - Defaults to `nil`.
* `ping` (`:boolean`) - Defaults to `false`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.
## Slots

* `details` - The description with markup; replaces `description`.
* `inner_block`
* `point` - What the point shows, usually an icon.

---

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