Class: LightningUiKit::DropdownComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- LightningUiKit::DropdownComponent
- Defined in:
- app/components/lightning_ui_kit/dropdown_component.rb
Instance Method Summary collapse
-
#initialize(trigger_text: nil, anchor: :bottom_right, position: :bottom) ⇒ DropdownComponent
constructor
A new instance of DropdownComponent.
- #menu_classes ⇒ Object
Methods inherited from BaseComponent
Methods included from HeroiconHelper
Constructor Details
#initialize(trigger_text: nil, anchor: :bottom_right, position: :bottom) ⇒ DropdownComponent
Returns a new instance of DropdownComponent.
7 8 9 10 11 |
# File 'app/components/lightning_ui_kit/dropdown_component.rb', line 7 def initialize(trigger_text: nil, anchor: :bottom_right, position: :bottom) @trigger_text = trigger_text @anchor = anchor @position = position end |
Instance Method Details
#menu_classes ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'app/components/lightning_ui_kit/dropdown_component.rb', line 13 def classes = %w[lui:hidden lui:transition lui:transform lui:p-1 lui:origin-top-left lui:absolute lui:left-0 lui:w-56 lui:rounded-md lui:shadow-lg lui:bg-white lui:ring-1 lui:ring-zinc-950/10 lui:focus:outline-none] case @position.to_s when "top" classes << "lui:mb-2 lui:top-auto lui:bottom-full" when "bottom" classes << "lui:mt-2" end classes.join(" ") end |