Class: Daisy::Actions::DropdownComponent
- Inherits:
-
LocoMotion::BaseComponent
- Object
- ViewComponent::Base
- LocoMotion::BaseComponent
- Daisy::Actions::DropdownComponent
- Includes:
- ViewComponent::SlotableDefault
- Defined in:
- app/components/daisy/actions/dropdown_component.rb
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
Adds the relevant Daisy classes to the component.
-
#default_button ⇒ Object
Provides a default button if no button or custom activator is provided.
-
#initialize(title = nil, **kws, &block) ⇒ DropdownComponent
constructor
Creates a new instance of the DropdownComponent.
-
#setup_component ⇒ Object
Add the ‘dropdown` CSS class to the component.
-
#setup_menu ⇒ Object
Make the menu a ‘<ul> / <li>` element and add the relevant Daisy classes.
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
Methods included from LocoMotion::Concerns::InspectableComponent
Constructor Details
#initialize(title = nil, **kws, &block) ⇒ DropdownComponent
Creates a new instance of the DropdownComponent.
81 82 83 84 85 |
# File 'app/components/daisy/actions/dropdown_component.rb', line 81 def initialize(title = nil, **kws, &block) super @simple_title = config_option(:title, title) end |
Instance Method Details
#before_render ⇒ Object
Adds the relevant Daisy classes to the component.
90 91 92 93 |
# File 'app/components/daisy/actions/dropdown_component.rb', line 90 def before_render setup_component end |
#default_button ⇒ Object
Provides a default button if no button or custom activator is provided.
115 116 117 |
# File 'app/components/daisy/actions/dropdown_component.rb', line 115 def Daisy::Actions::ButtonComponent.new(title: @simple_title) end |
#setup_component ⇒ Object
Add the ‘dropdown` CSS class to the component.
98 99 100 |
# File 'app/components/daisy/actions/dropdown_component.rb', line 98 def setup_component add_css(:component, "dropdown") end |
#setup_menu ⇒ Object
Make the menu a ‘<ul> / <li>` element and add the relevant Daisy classes.
105 106 107 108 109 110 |
# File 'app/components/daisy/actions/dropdown_component.rb', line 105 def # Setup menu itself set_tag_name(:menu, :ul) add_css(:menu, "dropdown-content where:menu where:bg-base-100 where:rounded-box where:shadow where:w-52 where:p-2 where:z-[1]") end |