module Ariadne::Behaviors::Tooltipable

def with_tooltip(text:, placement: :top, **options)

def with_tooltip(text:, placement: :top, **options)
  @tooltip_id = Ariadne::BaseComponent.generate_id(base_name: "ariadne-behaviors-tooltip")
  html_attrs[:aria] ||= {}
  html_attrs[:describedby] = @tooltip_id
  # TODO: this should raise if component's tag isn't an ARIA-compatible tag
  # ('a, button, input, select, textarea, [tabindex]:not([tabindex="-1"])')
  Ariadne::Behaviors::Tooltip.new(id: @tooltip_id, text: text, placement: placement, component: self, **options)
end