Class: Primer::PopoverComponent
- Includes:
- ViewComponent::Slotable
- Defined in:
- app/components/primer/popover_component.rb
Overview
Use popovers to bring attention to specific user interface elements, typically to suggest an action or to guide users through a new experience.
By default, the popover renders with absolute positioning, meaning it should usually be wrapped in an element with a relative position in order to be positioned properly. To render the popover with relative positioning, use the relative property.
Defined Under Namespace
Constant Summary
Constants inherited from Component
Constants included from FetchOrFallbackHelper
FetchOrFallbackHelper::InvalidValueError
Instance Method Summary collapse
-
#initialize(**system_arguments) ⇒ PopoverComponent
constructor
A new instance of PopoverComponent.
- #render? ⇒ Boolean
Methods inherited from Component
Methods included from ViewHelper
Methods included from JoinStyleArgumentsHelper
Methods included from FetchOrFallbackHelper
#fetch_or_fallback, #fetch_or_fallback_boolean
Methods included from ClassNameHelper
Constructor Details
#initialize(**system_arguments) ⇒ PopoverComponent
Returns a new instance of PopoverComponent.
44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/components/primer/popover_component.rb', line 44 def initialize(**system_arguments) @system_arguments = system_arguments @system_arguments[:tag] ||= :div @system_arguments[:classes] = class_names( system_arguments[:classes], "Popover" ) @system_arguments[:position] ||= :relative @system_arguments[:right] = false unless system_arguments.key?(:right) @system_arguments[:left] = false unless system_arguments.key?(:left) end |
Instance Method Details
#render? ⇒ Boolean
56 57 58 |
# File 'app/components/primer/popover_component.rb', line 56 def render? body.present? end |