Class: Daisy::Feedback::LoadingComponent

Inherits:
LocoMotion::BaseComponent show all
Includes:
LocoMotion::Concerns::TippableComponent
Defined in:
app/components/daisy/feedback/loading_component.rb

Overview

Note:

The helper method is also aliased as ‘daisy_loader` for better readability, but CSS classes must still use the `loading-*` prefix.

The LoadingComponent displays an animated indicator to show that a process is running in the background. It supports multiple animation styles and can be customized with different colors and sizes.

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

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(*args, **kws, &block) ⇒ LoadingComponent

Creates a new Loading component.

Options Hash (**kws):

  • css (String)

    Additional CSS classes for the loader. Available styles include: ‘loading-spinner`, `loading-dots`, `loading-ring`, `loading-ball`, `loading-bars`, and `loading-infinity`. Can be combined with color classes like `text-primary` or `text-success`.

  • tip (String)

    Optional tooltip text to display when hovering over the loader. Added by the TippableComponent module.



39
40
41
# File 'app/components/daisy/feedback/loading_component.rb', line 39

def initialize(*args, **kws, &block)
  super
end

Instance Method Details

#before_renderObject



43
44
45
46
# File 'app/components/daisy/feedback/loading_component.rb', line 43

def before_render
  setup_component
  super
end

#callObject



48
49
50
# File 'app/components/daisy/feedback/loading_component.rb', line 48

def call
  part(:component)
end