Class: Daisy::DataDisplay::ListItemComponent

Inherits:
LocoMotion::BaseComponent show all
Defined in:
app/components/daisy/data_display/list_item_component.rb,
app/components/daisy/data_display/list_item_component.rb

Overview

The ListItem component represents an individual row within a List component. It provides a consistent layout for displaying content in a list format.

Constant Summary

Constants inherited from LocoMotion::BaseComponent

LocoMotion::BaseComponent::EMPTY_PART_IGNORED_TAGS, LocoMotion::BaseComponent::SELF_CLOSING_TAGS

Instance Attribute Summary

Attributes inherited from LocoMotion::BaseComponent

#config, #loco_parent

Instance Method Summary collapse

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(**kwargs, &block) ⇒ ListItemComponent

Create a new ListItem component.

Parameters:

  • kwargs (Hash)

    The keyword arguments for the component.

Options Hash (**kwargs):

  • :css (String)

    Additional CSS classes to apply to the list item.



26
27
28
# File 'app/components/daisy/data_display/list_item_component.rb', line 26

def initialize(**kwargs, &block)
  super
end

Instance Method Details

#before_renderObject

Called before rendering to setup the component CSS and structure



31
32
33
34
# File 'app/components/daisy/data_display/list_item_component.rb', line 31

def before_render
  set_tag_name(:component, :li)
  add_css(:component, "list-row")
end

#callObject



36
37
38
# File 'app/components/daisy/data_display/list_item_component.rb', line 36

def call
  part(:component) { content }
end