Class: Ariadne::UI::Popover::Component
- Inherits:
-
BaseComponent
- Object
- ViewComponentContrib::Base
- BaseComponent
- Ariadne::UI::Popover::Component
- Defined in:
- app/components/ariadne/ui/popover/component.rb
Overview
A component that displays rich content in a card, triggered by a button. Typically you would use this component to display a menu, a form, or any other card within a hover or trigger.
Constant Summary collapse
- ALIGNMENT_DEFAULT =
:center- ALIGNMENT_OPTIONS =
[:left, :right, ALIGNMENT_DEFAULT]
- POSITION_DEFAULT =
:auto- POSITION_OPTIONS =
[POSITION_DEFAULT, :above, :below]
Constants inherited from BaseComponent
BaseComponent::ACCEPT_ANYTHING
Constants included from ViewHelper
Constants included from AttributesHelper
AttributesHelper::PLURAL_ARIA_ATTRIBUTES, AttributesHelper::PLURAL_DATA_ATTRIBUTES
Instance Method Summary collapse
Methods inherited from BaseComponent
audited_at, #class_for, #component, component_id, #component_id, component_name, generate_id, #html_attributes, i18n_scope, #merge_data_attributes, #merge_tailwind_classes, #options, stimulus_name, translate, #validate_aria_label!
Methods included from AttributesHelper
#aria, #data, #merge_aria, #merge_data, #merge_prefixed_attribute_hashes, #prepend_action, #prepend_controller, #prepend_data_attribute
Methods included from ViewComponent::StyleVariants
Instance Method Details
#popover_placement ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/components/ariadne/ui/popover/component.rb', line 65 def popover_placement placement = case @position when :above then "top" when :below then "bottom" else "bottom" end placement += "-start" if @alignment == :left placement += "-end" if @alignment == :right placement end |