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.
5 6 7 8 9 |
# File 'app/components/lightning_ui_kit/dropdown_component.rb', line 5 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
11 12 13 14 15 16 17 18 19 20 |
# File 'app/components/lightning_ui_kit/dropdown_component.rb', line 11 def classes = %w[lui:hidden lui:transition lui:transform lui:p-1 lui:origin-top-left lui:absolute lui:left-0 lui:rounded-md lui:shadow-lg lui:bg-surface-secondary lui:ring-1 lui:ring-border lui:focus:outline-none lui:z-50] 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 |