Current section

Files

Jump to
sigma_kit lib components popups.ex
Raw

lib/components/popups.ex

defmodule SigmaKit.Components.Popups do
use Phoenix.LiveComponent
attr :text, :string
slot :inner_block
def tooltip(assigns) do
assigns = assign(assigns, :id, SigmaKit.Util.random_string())
~H"""
<div data-tooltip-target={@id} class="inline">
{render_slot(@inner_block)}
</div>
<div
id={@id}
role="tooltip"
class="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white transition-opacity duration-300 bg-black/80 backdrop-blur rounded-lg shadow-sm opacity-0 tooltip"
>
{@text}
<div class="tooltip-arrow" data-popper-arrow></div>
</div>
"""
end
end