Components
Tooltip
A short hint on hover and keyboard focus.
Usage
After the one-time setup, call the helper directly from ERB. No component import is needed.
<%= lc_inline gap: :content do %>
<%= lc_tooltip "Copy a link to this page", id: "my-component-copy-tip" do |tip| %>
<%= lc_icon_button "Copy link", icon: "link", **tip %>
<% end %>
<%= lc_tooltip "Only owners can archive", id: "my-component-archive-tip", side: :bottom do |tip| %>
<%= lc_button "Archive", variant: :secondary, **tip %>
<% end %>
<% end %>
Examples
Tooltips
Copy a link to this page
Only owners can archive
<%= lc_inline gap: :content do %>
<%= lc_tooltip "Copy a link to this page", id: "example-0-copy-tip" do |tip| %>
<%= lc_icon_button "Copy link", icon: "link", **tip %>
<% end %>
<%= lc_tooltip "Only owners can archive", id: "example-0-archive-tip", side: :bottom do |tip| %>
<%= lc_button "Archive", variant: :secondary, **tip %>
<% end %>
<% end %>
API reference
Helpers render semantic HTML and include their interaction wiring. Pass native attributes through class:, data:, aria: and the usual Rails options. Blocks use captured ERB content.
lc_tooltip
lc_tooltip(text, id:, side: :top, **attributes, &block)
| Input | Default | Values |
|---|---|---|
| text | Required | — |
| id | Required | — |
| side | :top | — |
| attributes | {} | Native HTML attributes; class:, data: and aria: merge with defaults |
| block | Captured block | Captured Rails ERB content |
The examples also use lc_inline, lc_icon_button, and lc_button. Each is documented on its own page.
Styling and extension
Use class: to merge utilities, native attributes for application behavior, and the theming guide for the shared palette. For custom markup, the advanced class helpers expose the same styles, including glass surfaces and class merging.