Class: Daisy::DataDisplay::AvatarComponent
- Inherits:
-
LocoMotion::BaseComponent
- Object
- ViewComponent::Base
- LocoMotion::BaseComponent
- Daisy::DataDisplay::AvatarComponent
- Includes:
- LocoMotion::Concerns::IconableComponent, LocoMotion::Concerns::LinkableComponent, LocoMotion::Concerns::TippableComponent
- Defined in:
- app/components/daisy/data_display/avatar_component.rb
Overview
The Avatar component displays an image, icon, or placeholder text to represent a user or entity. It provides a consistent, circular display with fallback options when an image is not available.
Includes the LocoMotion::Concerns::TippableComponent module to enable easy tooltip addition.
It utilizes the CSS ‘where()` pseudo-class to reduce the specificity to 0 to allow for easy overriding while giving you some sane defaults.
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
Instance Method Summary collapse
- #before_render ⇒ Object
-
#initialize(**kws, &block) ⇒ AvatarComponent
constructor
Create a new avatar component.
Methods included from LocoMotion::Concerns::IconableComponent
#has_icons?, #left_icon_html, #render_left_icon, #render_right_icon, #right_icon_html
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) ⇒ AvatarComponent
Create a new avatar component.
59 60 61 62 63 |
# File 'app/components/daisy/data_display/avatar_component.rb', line 59 def initialize(**kws, &block) super @src = config_option(:src) end |
Instance Method Details
#before_render ⇒ Object
65 66 67 68 69 70 |
# File 'app/components/daisy/data_display/avatar_component.rb', line 65 def before_render # Run component setup *before* super to allow BaseComponent hooks to run last setup_component super end |