Class: Ui::Dropdown::Component::Item
- Inherits:
-
BaseComponent
- Object
- BaseComponent
- Ui::Dropdown::Component::Item
- Defined in:
- lib/uikit_rails/templates/components/dropdown/component.rb
Instance Attribute Summary collapse
-
#href ⇒ Object
readonly
Returns the value of attribute href.
-
#html_attrs ⇒ Object
readonly
Returns the value of attribute html_attrs.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(href: nil, **html_attrs) ⇒ Item
constructor
A new instance of Item.
Constructor Details
#initialize(href: nil, **html_attrs) ⇒ Item
Returns a new instance of Item.
29 30 31 32 33 |
# File 'lib/uikit_rails/templates/components/dropdown/component.rb', line 29 def initialize(href: nil, **html_attrs) @href = href @html_attrs = html_attrs super() end |
Instance Attribute Details
#href ⇒ Object (readonly)
Returns the value of attribute href.
27 28 29 |
# File 'lib/uikit_rails/templates/components/dropdown/component.rb', line 27 def href @href end |
#html_attrs ⇒ Object (readonly)
Returns the value of attribute html_attrs.
27 28 29 |
# File 'lib/uikit_rails/templates/components/dropdown/component.rb', line 27 def html_attrs @html_attrs end |
Instance Method Details
#call ⇒ Object
35 36 37 38 39 |
# File 'lib/uikit_rails/templates/components/dropdown/component.rb', line 35 def call tag_name = href ? :a : :div attrs = merge_attrs({ class: "ui-dropdown__item", href: href, role: "menuitem" }.compact, html_attrs) content_tag(tag_name, content, **attrs) end |