Class: StimulusPlumbers::Components::List::Item
- Inherits:
-
Plumber::Base
- Object
- Plumber::Base
- StimulusPlumbers::Components::List::Item
- Defined in:
- lib/stimulus_plumbers/components/list/item.rb,
lib/stimulus_plumbers/components/list/item/slots.rb
Defined Under Namespace
Classes: Slots
Instance Attribute Summary
Attributes inherited from Plumber::Base
Instance Method Summary collapse
Methods inherited from Plumber::Base
Methods included from Plumber::Renderer
#set_slots, #slot_block_for, #slot_kwargs_for, #slot_renderable?
Methods included from Plumber::Options::Aria
Methods included from Plumber::Options::Html
Constructor Details
This class inherits a constructor from StimulusPlumbers::Plumber::Base
Instance Method Details
#build(**kwargs, &block) ⇒ Object
20 21 22 23 |
# File 'lib/stimulus_plumbers/components/list/item.rb', line 20 def build(**kwargs, &block) = (theme.resolve(:list_item), kwargs) template.capture(, &block) end |
#render(content = nil, **kwargs) {|slots| ... } ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/stimulus_plumbers/components/list/item.rb', line 7 def render(content = nil, **kwargs, &block) slots = List::Item::Slots.new slots.with_title(content) if content slots.with_icon_trailing("external-link") if kwargs[:url].present? && kwargs[:target] == "_blank" yield slots if block_given? template.content_tag(:li) do build(**kwargs) do |attrs| (**attrs) { render_item_slots(slots) } end end end |