Class: DaisyUI::Dropdown
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- DaisyUI::Dropdown
- Defined in:
- app/components/daisy_ui/actions/dropdown.rb
Overview
Dropdown component implementing DaisyUI’s dropdown styles
Constant Summary collapse
- POSITIONS =
Available dropdown positions from DaisyUI
{ top: 'dropdown-top', top_end: 'dropdown-top-end', top_center: 'dropdown-top-center', bottom: 'dropdown-bottom', bottom_end: 'dropdown-bottom-end', bottom_center: 'dropdown-bottom-center', left: 'dropdown-left', left_end: 'dropdown-left-end', left_center: 'dropdown-left-center', right: 'dropdown-right', right_end: 'dropdown-right-end', right_center: 'dropdown-right-center' }.freeze
- ALIGNMENTS =
{ start: 'dropdown-start', end: 'dropdown-end', center: 'dropdown-center' }.freeze
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(position: nil, hover: false, open: false, align: nil, menu_class: nil, menu_tabindex: 0, **system_arguments) ⇒ Dropdown
constructor
A new instance of Dropdown.
Constructor Details
#initialize(position: nil, hover: false, open: false, align: nil, menu_class: nil, menu_tabindex: 0, **system_arguments) ⇒ Dropdown
Returns a new instance of Dropdown.
69 70 71 72 73 74 75 76 77 78 |
# File 'app/components/daisy_ui/actions/dropdown.rb', line 69 def initialize(position: nil, hover: false, open: false, align: nil, menu_class: nil, menu_tabindex: 0, **system_arguments) @position = build_argument(position, POSITIONS, 'position') @hover = hover @open = open @align = build_argument(align, ALIGNMENTS, 'align') = = super(**system_arguments) end |
Instance Method Details
#call ⇒ Object
80 81 82 83 84 85 86 87 |
# File 'app/components/daisy_ui/actions/dropdown.rb', line 80 def call tag.div(**dropdown_arguments) do safe_join([ trigger, ].compact) end end |