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

A short hint around a trigger (`<.tooltip>`).

    <.tooltip id="save-tip" text="Save the draft">
      <.button>Save</.button>
    </.tooltip>

    <.tooltip id="top-start" text="Top Start" color="success" placement="top-start">
      <.button variant="outline">Top Start</.button>
    </.tooltip>

    <.tooltip id="profile" trigger="click">
      <.button>Content</.button>
      <:content><div class="p-3">...</div></:content>
    </.tooltip>

The trigger is the inner block (or, with a `<:trigger>` slot, the slot, and the inner block is
the hint: `<.tooltip id="t"><:trigger><.button>Save</.button></:trigger>Save the draft</.tooltip>`); the hint floats next to it (`placement`, 12 values) in any
`color`. The `LedgerUI.Float` hook (`priv/static/ledger_ui/hooks/float.js`) shows it on hover/focus,
click or never (`manual`), after `delay` ms, optionally following the cursor, and flips it when
there is no room. `LedgerUI.open/close/toggle("id")` show and hide it, `open` drives it from the
server. `on_open` / `on_close` take an event name (payload `%{"id" => id}`, sent to `target`) or a `%JS{}`.

# `tooltip`

## Attributes

* `id` (`:string`) (required)
* `text` (`:string`) - Defaults to `nil`.
* `color` (`:string`) - Defaults to `"neutral"`. Must be one of `"neutral"`, `"light"`, `"dark"`, `"primary"`, `"secondary"`, `"info"`, `"success"`, `"warning"`, or `"error"`.
* `placement` (`:string`) - Defaults to `"top"`. Must be one of `"top"`, `"top-start"`, `"top-end"`, `"right"`, `"right-start"`, `"right-end"`, `"bottom"`, `"bottom-start"`, `"bottom-end"`, `"left"`, `"left-start"`, or `"left-end"`.
* `delay` (`:integer`) - Defaults to `0`.
* `duration` (`:integer`) - Defaults to `300`.
* `follow_cursor` (`:string`) - Defaults to `nil`.Must be one of `nil`, `""`, `"both"`, `"horizontal"`, `"vertical"`, or `"initial"`.
* `arrow` (`:boolean`) - Defaults to `true`.
* `interactive` (`:boolean`) - Defaults to `nil`.
* `open` (`:boolean`) - Defaults to `false`.
* `on_open` (`:any`) - Defaults to `nil`.
* `on_close` (`:any`) - Defaults to `nil`.
* `target` (`:any`) - Defaults to `nil`.
* `class` (`:any`) - Defaults to `nil`.
* `tip_class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted. `trigger` is how it opens: `hover` (the default), `click`, `focus` or `manual`. `content="..."` is the text, like `text`. Supports all globals plus: `["trigger", "content"]`.
## Slots

* `content`
* `trigger` - The element the hint hangs from; the inner block is then the hint.
* `inner_block` (required)

---

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