Class: Shadcn::TooltipComponent
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- Shadcn::TooltipComponent
- Defined in:
- app/components/shadcn/tooltip_component.rb
Overview
Tooltip component for contextual information Matches shadcn/ui Tooltip component Uses Stimulus for interactivity
Constant Summary collapse
- CONTENT_CLASSES =
"z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground whitespace-nowrap animate-tooltip-in data-[state=closed]:animate-tooltip-out"
Instance Attribute Summary
Attributes inherited from BaseComponent
#class_name, #data, #html_options
Instance Method Summary collapse
-
#initialize(text: nil, side: :top, align: :center, delay_duration: 200, skip_delay_duration: 300, **options) ⇒ TooltipComponent
constructor
A new instance of TooltipComponent.
Methods inherited from BaseComponent
Methods included from Rails::Helpers::ClassNameHelper
Constructor Details
#initialize(text: nil, side: :top, align: :center, delay_duration: 200, skip_delay_duration: 300, **options) ⇒ TooltipComponent
Returns a new instance of TooltipComponent.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/components/shadcn/tooltip_component.rb', line 28 def initialize( text: nil, side: :top, align: :center, delay_duration: 200, skip_delay_duration: 300, ** ) @tooltip_content = text @side = side @align = align @delay_duration = delay_duration @skip_delay_duration = skip_delay_duration super(**) end |