Hover Card
Interactive preview card shown when a link or mention is hovered or focused, rendered in the top layer.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
placement | Placement | bottom | Preferred side of the trigger; flips when there is no room. |
open-delay | number | 700 | Delay before opening, in milliseconds. |
close-delay | number | 300 | Delay before closing once the pointer or focus has left, in milliseconds. |
disabled | boolean | false | Keeps the card from opening on hover or focus; open still works. |
open | boolean | false | Visible state. Set it to open or close the card programmatically. |
Slots
| Name | Description |
|---|---|
trigger | The element that opens the card, typically a link or a mention. |
(default) | Card content. |
Events
| Name | Type | Description |
|---|---|---|
show | Event | Fired when the card opens. |
hide | Event | Fired when the card closes. |
CSS custom properties
Grouped by semantic target and state from --c2-<component>__<target>__<state>--<property>. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-hover-card--background-color | background-color | #ffffff | |
--c2-hover-card--color | color | #18181b | |
--c2-hover-card--border | border | 1px solid #e4e4e7 | |
--c2-hover-card--border-radius | border-radius | 8px | |
--c2-hover-card--box-shadow | box-shadow | 0 8px 24px rgba(24, 24, 27, 0.08) | |
--c2-hover-card--font-size | font-size | 14px | |
--c2-hover-card--font-family | font-family | — | |
--c2-hover-card--line-height | line-height | 1.5 | |
--c2-hover-card--padding-top | padding | 16px | |
--c2-hover-card--padding-right | padding | 16px | |
--c2-hover-card--padding-bottom | padding | 16px | |
--c2-hover-card--padding-left | padding | 16px | |
--c2-hover-card--width | pixel | 320px | |
--c2-hover-card--offset | pixel | 8px | Distance between the trigger and the card. |
--c2-hover-card--transition-duration | time | 150ms | |
--c2-hover-card--enter-transform | transform | scale(0.96) | Start of the enter animation. |