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
Overview
The List component is a vertical layout to display information in rows. It can contain various content types including text, images, and actions arranged in a consistent format.
The List component is useful for displaying structured data like user profiles, media libraries, or content collections with a consistent layout.
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
Constructor Details
#initialize(**kws, &block) ⇒ ListComponent
Create a new List component.
68 69 70 71 72 73 74 |
# File 'app/components/daisy/data_display/list_component.rb', line 68 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)
51 52 53 |
# File 'app/components/daisy/data_display/list_component.rb', line 51 def header_css @header_css end |
#header_html ⇒ String (readonly)
51 52 53 |
# File 'app/components/daisy/data_display/list_component.rb', line 51 def header_html @header_html end |
#simple_header ⇒ String (readonly)
51 52 53 |
# File 'app/components/daisy/data_display/list_component.rb', line 51 def simple_header @simple_header end |
Instance Method Details
#before_render ⇒ Object
76 77 78 79 80 81 |
# File 'app/components/daisy/data_display/list_component.rb', line 76 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 |