Class: StimulusPlumbers::Components::Combobox::Popover
- Inherits:
-
Plumber::Base
- Object
- Plumber::Base
- StimulusPlumbers::Components::Combobox::Popover
- Defined in:
- lib/stimulus_plumbers/components/combobox/popover.rb
Constant Summary
Constants included from Plumber::HtmlOptions
Plumber::HtmlOptions::STIMULUS_SPACEJOIN_KEYS
Instance Attribute Summary
Attributes inherited from Plumber::Base
Instance Method Summary collapse
Methods inherited from Plumber::Base
Methods included from Plumber::HtmlOptions
#extract_classes, #merge_data_options, #merge_html_options, #merge_string_option, #normalize_part
Constructor Details
This class inherits a constructor from StimulusPlumbers::Plumber::Base
Instance Method Details
#render(stimulus_controller:, id:, tag: :div, role: nil, label: nil, labelledby: nil, content: nil, data: {}, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/stimulus_plumbers/components/combobox/popover.rb', line 7 def render(stimulus_controller:, id:, tag: :div, role: nil, label: nil, labelledby: nil, content: nil, data: {}, &block) stimulus_data = { "#{stimulus_controller}_target": "popover" } attrs = { id: id, hidden: "", data: (stimulus_data, data) } attrs[:role] = role if role if labelledby attrs[:aria] = { labelledby: labelledby } elsif label attrs[:aria] = { label: label } end html_content = block_given? ? template.capture(id, &block) : content template.content_tag(tag, **attrs) { html_content } end |