Class: Daisy::DataDisplay::ListComponent
- Inherits:
-
LocoMotion::BaseComponent
- Object
- ViewComponent::Base
- LocoMotion::BaseComponent
- Daisy::DataDisplay::ListComponent
- Defined in:
- app/components/daisy/data_display/list_component.rb,
app/components/daisy/data_display/list_component.rb
Constant Summary
Constants inherited from LocoMotion::BaseComponent
LocoMotion::BaseComponent::EMPTY_PART_IGNORED_TAGS, LocoMotion::BaseComponent::SELF_CLOSING_TAGS
Instance Attribute Summary collapse
-
#header_css ⇒ String
readonly
Optional header text for the list.
-
#header_html ⇒ String
readonly
Optional header text for the list.
-
#simple_header ⇒ String
readonly
Optional header text for the list.
Attributes inherited from LocoMotion::BaseComponent
Instance Method Summary collapse
- #before_render ⇒ Object
-
#initialize(**kws, &block) ⇒ ListComponent
constructor
Create a new List component.
Methods inherited from LocoMotion::BaseComponent
build, #component_ref, #config_option, #cssify, define_modifier, define_modifiers, define_part, define_parts, define_size, define_sizes, #empty_part_content, #inspect, #part, register_component_initializer, register_component_setup, #rendered_css, #rendered_data, #rendered_html, #rendered_stimulus_controllers, #rendered_tag_name, renders_many, renders_one, set_component_name, #set_loco_parent, #strip_spaces
Methods included from LocoMotion::Concerns::InspectableComponent
Constructor Details
#initialize(**kws, &block) ⇒ ListComponent
Create a new List component.
72 73 74 75 76 77 78 |
# File 'app/components/daisy/data_display/list_component.rb', line 72 def initialize(**kws, &block) super @simple_header = config_option(:header) @header_css = config_option(:header_css) @header_html = config_option(:header_html) end |
Instance Attribute Details
#header_css ⇒ String (readonly)
Returns Optional header text for the list.
55 56 57 |
# File 'app/components/daisy/data_display/list_component.rb', line 55 def header_css @header_css end |
#header_html ⇒ String (readonly)
Returns Optional header text for the list.
55 56 57 |
# File 'app/components/daisy/data_display/list_component.rb', line 55 def header_html @header_html end |
#simple_header ⇒ String (readonly)
Returns Optional header text for the list.
55 56 57 |
# File 'app/components/daisy/data_display/list_component.rb', line 55 def simple_header @simple_header end |
Instance Method Details
#before_render ⇒ Object
80 81 82 83 84 85 |
# File 'app/components/daisy/data_display/list_component.rb', line 80 def before_render add_css(:component, "list") set_tag_name(:component, :ul) with_header(tag_name: :li, css: header_css, html: header_html) { simple_header } if simple_header && !header? end |