Sha256: 84534135cf631f293907e0799c5f9bdbbeaf20663230d3bb4a158e5eb07b590c

Contents?: true

Size: 1.24 KB

Versions: 1330

Compression:

Stored size: 1.24 KB

Contents

<%= pb_rails("flex", props: { orientation: "column", gap: "md" }) do %>
  <%= pb_rails("button", props: {text: "Toggle state", id: "toggle-tooltip-button"}) %>
  <%= pb_rails("body") do %>
      Tooltip is: <code id="show-tooltip-state">enabled</code>
  <% end %>
  <%= pb_rails("flex/flex_item") do %>
    <span id="truncated-tooltip-1">Hover me</span>
    <%= pb_rails("tooltip", props: {
      trigger_element_selector: "#truncated-tooltip-1",
      tooltip_id: "truncated-1",
      position: "right",
    }) do %>
        Tooltip is enabled
    <% end %>
  <% end %>
<% end %>


<script>
const toggleTooltipButton = document.getElementById("toggle-tooltip-button");
const showTooltipStateText = document.getElementById("show-tooltip-state");

function hideTooltipIfNotTruncated(tooltipId) {
  const tooltipElement = document.querySelector(
    `[data-pb-tooltip-tooltip-id="${tooltipId}"]`
  );

  tooltipElement.dataset.pbTooltipShowTooltip =
    tooltipElement.dataset.pbTooltipShowTooltip == "false" ? "true" : "false";

  showTooltipStateText.innerText = 
    tooltipElement.dataset.pbTooltipShowTooltip == "false" ? "disabled" : "enabled";
}

toggleTooltipButton.addEventListener("click", () => {
  hideTooltipIfNotTruncated("truncated-1");
});
</script>

Version data entries

1,330 entries across 1,330 versions & 2 rubygems

Version Path
playbook_ui_docs-14.11.1.pre.alpha.PLAY17445539 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui-14.11.1.pre.alpha.PLAY17445539 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui_docs-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui-14.11.1.pre.alpha.PBNTR798datepickerturbo5537 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui_docs-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui-14.11.1.pre.alpha.pbntr703collapsiblerowsrails5536 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui_docs-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui-14.11.1.pre.alpha.PLAY1751pbcontenttagpt25529 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui_docs-14.11.1.pre.alpha.PBNTR7495495 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui-14.11.1.pre.alpha.PBNTR7495495 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui_docs-14.12.0.pre.rc.11 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui-14.12.0.pre.rc.11 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui_docs-14.12.0.pre.rc.10 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui-14.12.0.pre.rc.10 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui_docs-14.12.0.pre.rc.9 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui-14.12.0.pre.rc.9 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui_docs-14.12.0.pre.rc.8 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui-14.12.0.pre.rc.8 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui_docs-14.12.0.pre.rc.7 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb
playbook_ui-14.12.0.pre.rc.7 app/pb_kits/playbook/pb_tooltip/docs/_tooltip_show_tooltip.html.erb