Tooltip

It's a secret little top hat for your elements
Includes a Ruby component and corresponding Rails helper
Ruby
Includes a Stimulus controller
Stimulus

Example

Fill the tank
<% # Text content %>
<%= nk_tooltip(content: "Fill the tank") do |t| %>
  <%= nk_button icon: "fuel" %>
<% end %>

<% # Block content %>
<%= nk_tooltip do |t| %>
  <%= t.content do %>
    Anything goes here
  <% end %>
  <%= nk_button icon: "fuel" %>
<% end %>

Dependencies

This component adds third-party dependencies:

Usage

nk_tooltip(content: nil, placement: nil, **attrs) { |tooltip| ... }
PropertyDefaultDescription
contentnil Text content of the tooltip
placementnil Floating UI Placement of the dropdown
**attrsHTML attributes for <span> element
tooltip.content(text = nil, **attrs) { ... }
PropertyDefaultDescription
textnilPlain text content
**attrsHTML attributes for <div> element