Class: Daisy::Feedback::ProgressComponent
- Inherits:
-
LocoMotion::BaseComponent
- Object
- ViewComponent::Base
- LocoMotion::BaseComponent
- Daisy::Feedback::ProgressComponent
- Defined in:
- app/components/daisy/feedback/progress_component.rb
Overview
The ProgressComponent displays a horizontal bar that indicates the completion status of a process. It can show determinate progress with a specific value or indeterminate progress with an animated bar.
The component renders as an HTML ‘<progress>` element and supports various colors and styles through CSS classes.
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
- #call ⇒ Object
-
#initialize(*args, **kws, &block) ⇒ ProgressComponent
constructor
Creates a new Progress 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(*args, **kws, &block) ⇒ ProgressComponent
Creates a new Progress component.
42 43 44 45 46 47 |
# File 'app/components/daisy/feedback/progress_component.rb', line 42 def initialize(*args, **kws, &block) super @value = config_option(:value, nil) @max = config_option(:max, 100) end |
Instance Method Details
#before_render ⇒ Object
49 50 51 52 53 |
# File 'app/components/daisy/feedback/progress_component.rb', line 49 def before_render set_tag_name(:component, :progress) add_css(:component, "progress") add_html(:component, { value: @value, max: @max }) if @value != nil end |
#call ⇒ Object
55 56 57 |
# File 'app/components/daisy/feedback/progress_component.rb', line 55 def call part(:component) end |