View laravel-hotwire on GitHub
1M
v0.91.0
Search 71 components and 72 controllers by name, category or description.
Hover Card
Hover- or focus-triggered preview card for lightweight, mostly non-interactive context
Hover card
Opens on hover and on focus, so it is reachable from the keyboard. The content is role="tooltip" and the trigger points at it through aria-describedby.
@emaia
EM
Ednilson Maia
Building Laravel Hotwire components.
{{-- The trigger opens on hover and on focus, so it works from the keyboard too. --}}
<hw:hover-card>
<hw:hover-card.trigger as="a" href="#">@emaia</hw:hover-card.trigger>
<hw:hover-card.content>
<div class="flex gap-3">
<hw:avatar name="Ednilson Maia" size="lg" />
<div class="space-y-1">
<p class="font-medium">Ednilson Maia</p>
<p class="text-sm text-muted-foreground">Building Laravel Hotwire components.</p>
</div>
</div>
</hw:hover-card.content>
</hw:hover-card>
Placement and timing
side, align and the offsets are the same Floating UI axes as Dropdown and Popover. open-delay (10ms) and close-delay (100ms) decide how eager it feels.
Opens above, centred on the trigger.
flip and shift keep it on screen when space runs out.
open-delay 500ms, close-delay 0ms.
The trigger takes the button variant and size axes;
motion="none" drops the transition.
{{-- Same Floating UI axes as Dropdown and Popover. --}}
<hw:hover-card side="top" align="center" :side-offset="8">
<hw:hover-card.trigger>Above</hw:hover-card.trigger>
<hw:hover-card.content>Opens above, centred on the trigger.</hw:hover-card.content>
</hw:hover-card>
<hw:hover-card side="right" align="start">
<hw:hover-card.trigger>To the right</hw:hover-card.trigger>
<hw:hover-card.content>flip and shift keep it on screen when space runs out.</hw:hover-card.content>
</hw:hover-card>
{{-- Slower to appear, quicker to leave. --}}
<hw:hover-card :open-delay="500" :close-delay="0">
<hw:hover-card.trigger>Deliberate delays</hw:hover-card.trigger>
<hw:hover-card.content>open-delay 500ms, close-delay 0ms.</hw:hover-card.content>
</hw:hover-card>
<hw:hover-card>
<hw:hover-card.trigger variant="outline" size="sm">Button trigger</hw:hover-card.trigger>
<hw:hover-card.content motion="none">
The trigger takes the button variant and size axes; <code>motion="none"</code> drops the transition.
</hw:hover-card.content>
</hw:hover-card>