Class: Daisy::DataDisplay::CardComponent
- Inherits:
-
LocoMotion::BaseComponent
- Object
- ViewComponent::Base
- LocoMotion::BaseComponent
- Daisy::DataDisplay::CardComponent
- Defined in:
- app/components/daisy/data_display/card_component.rb
Overview
The Card component is a flexible container for displaying content with a consistent style. It can include images, titles, text, and actions.
Includes the LocoMotion::Concerns::TippableComponent module to enable easy tooltip addition.
Constant Summary
Constants inherited from LocoMotion::BaseComponent
LocoMotion::BaseComponent::EMPTY_PART_IGNORED_TAGS, LocoMotion::BaseComponent::SELF_CLOSING_TAGS
Instance Attribute Summary collapse
-
#simple_title ⇒ String
readonly
The title text when using the simple title option.
Attributes inherited from LocoMotion::BaseComponent
Instance Method Summary collapse
- #before_render ⇒ Object
-
#initialize(**kws, &block) ⇒ CardComponent
constructor
Creates a new card 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) ⇒ CardComponent
Creates a new card component.
84 85 86 87 88 |
# File 'app/components/daisy/data_display/card_component.rb', line 84 def initialize(**kws, &block) super @simple_title = kws[:title] end |
Instance Attribute Details
#simple_title ⇒ String (readonly)
Returns The title text when using the simple title option.
65 66 67 |
# File 'app/components/daisy/data_display/card_component.rb', line 65 def simple_title @simple_title end |
Instance Method Details
#before_render ⇒ Object
90 91 92 93 94 95 |
# File 'app/components/daisy/data_display/card_component.rb', line 90 def before_render setup_component super # Runs TippableComponent's setup hook with_title { simple_title } if simple_title && !title? end |