Class: UiBibz::Ui::Core::Notifications::Tooltip

Inherits:
Component show all
Includes:
UiBibz::Ui::Concerns::NotificationConcern
Defined in:
lib/ui_bibz/ui/core/notifications/tooltip.rb

Overview

Create a tooltip

This element is an extend of UiBibz::Ui::Core::Component.

Attributes

  • content - Content of element

  • options - Options of element

  • html_options - Html Options of element

Options

You can add HTML attributes using the html_options. You can pass arguments in options attribute:

Signatures

UiBibz::Ui::Core::Notifications::Tooltip.new(content, options = nil, html_options = nil)

UiBibz::Ui::Core::Notifications::Tooltip.new(options = nil, html_options = nil) do
  content
end

Examples

UiBibz::Ui::Core::Notifications::Tooltip.new("My content")

# or

UiBibz::Ui::Core::Notifications::Tooltip.new(position: :right) do
  content
end

Helper

tooltip = UiBibz::Ui::Core::Notifications::Tooltip.new("My content", position: :left)
ui_glyph("diamond", tooltip: tooltip)

# or

ui_glyph("diamond", {tooltip: true}, { title: "My content" })

# or

ui_glyph("diamond", tooltip: { title: "My content", position: :right})

Constant Summary collapse

DATA_ATTRIBUTES =

Note that for security reasons the sanitize, sanitizeFn, and allowList options cannot be supplied using data attributes. getbootstrap.com/docs/5.0/components/tooltips/#options

%i[animation container delay html selector template trigger
fallbackPlacement boundary].freeze

Constants inherited from Component

Component::BREAKPOINTS, Component::SIZES, Component::STATUSES

Instance Attribute Summary

Attributes inherited from Component

#content, #html_options, #options

Attributes inherited from Base

#output_buffer

Instance Method Summary collapse

Methods inherited from Component

#pre_render, #tapped?

Methods included from PopoverExtension

#popover_data_html, #tooltip_data_html

Methods included from GlyphExtension

#generate_glyph, #glyph_and_content_html

Methods included from KlassExtension

#exclude_classes, #exclude_classes_in_html_options, #join_classes, #status

Methods inherited from Base

#generate_id, #i18n_set?, #inject_url

Constructor Details

#initialize(content = nil, options = nil, html_options = nil, &block) ⇒ Tooltip

See UiBibz::Ui::Core::Component.initialize



60
61
62
63
# File 'lib/ui_bibz/ui/core/notifications/tooltip.rb', line 60

def initialize(content = nil, options = nil, html_options = nil, &block)
  super
  @content = @options[:title] if content.is_a?(Hash) && block.nil?
end

Instance Method Details

#renderObject

Render html tag



66
67
68
# File 'lib/ui_bibz/ui/core/notifications/tooltip.rb', line 66

def render
  base_attributes.merge(data_attributes)
end