Class: StimulusPlumbers::Components::Checklist::Item

Inherits:
Plumber::Base
  • Object
show all
Defined in:
lib/stimulus_plumbers/components/checklist/item.rb,
lib/stimulus_plumbers/components/checklist/item/slots.rb

Defined Under Namespace

Classes: Slots

Instance Attribute Summary

Attributes inherited from Plumber::Base

#template

Instance Method Summary collapse

Methods inherited from Plumber::Base

#initialize, #theme

Methods included from Plumber::Renderer

#set_slots, #slot_block_for, #slot_kwargs_for, #slot_renderable?

Methods included from Plumber::Options::Aria

#labelled_aria

Methods included from Plumber::Options::Html

#merge_html_options

Constructor Details

This class inherits a constructor from StimulusPlumbers::Plumber::Base

Instance Method Details

#render(content = nil, checked: nil, readonly: false, **html_options, &block) ⇒ Object

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
14
15
# File 'lib/stimulus_plumbers/components/checklist/item.rb', line 7

def render(content = nil, checked: nil, readonly: false, **html_options, &block)
  raise ArgumentError, "checked: is required" if checked.nil?

  slots = build_slots(content, &block)

  template.(:label, **merge_html_options(theme.resolve(:checklist_item), html_options)) do
    template.safe_join([render_input(checked, readonly), render_content_slot(slots)].compact)
  end
end