Skip to content

BbHoverCard

A rich preview card that opens on hover or keyboard focus (a person, an event, a link) — BbPopover's panel without the click; may hold commands that also exist elsewhere; also the v-bb-hover-card directive.

import { BbHoverCard } from 'bitboss-ui';

On this page

Props

NameDescription
activator Type: ElementOrComponentRef

External activator element or component ref. When provided, the activator slot is not rendered and the hover / focus listeners are attached programmatically to the referenced element.

For a card per row, v-bb-hover-card already attaches to an element without a template ref. Reach for the prop when the trigger is owned by code you cannot annotate.

See example
boundary Type: ElementOrComponentRefOrSelector

Constrains the card within a bounding element: it stays inside it alongside its trigger (sideways for a card above or below); away from the trigger it may pass the edge, and it flips at the viewport only. Accepts an HTMLElement, a Vue component ref, or a CSS selector string.

delay Type: numberDefault350

Milliseconds the pointer (or keyboard focus) rests on the activator before the card shows; longer than BbTooltip's, so passing over does not open it. Closing has a fixed grace (guide § Timing and the safe zone).

Holds the open back for hover and keyboard focus alike, with no skip for a neighbour reached quickly. Closing is not configurable: the card waits a fixed 200 ms, and a pointer travelling toward the card stays inside a safe zone.

See example
disabled Type: booleanDefaultfalse

Disables the component. Disabling an open card closes it.

eager Type: booleanDefaultfalse

Renders the card's content at mount instead of on the first open.

id Type: string

The activator's id (the card is bbhc_<id>, and is labelled by it once it holds a control). Generated when omitted.

modelValue Type: booleanDefaultfalse

Used by v-model to open / close the card. A card with no v-model starts closed and is driven by hover and keyboard focus.

offset Type: numberDefault4

Space the floating container will maintain from the activator.

See example
padding Type: numberDefault10

Minimum empty space to keep from the edge of the page.

placement Type: PlacementDefault"bottom"

Position of the card relative to the activator.

Flips itself near a viewport edge. Unlike BbPopover there is no 'cursor' value, and no arrow.

See example
pt Type: PtMap<BbHoverCardPtPart, "open">

Passthrough, object form: the same keys as the pt:* attributes without the prefix. See the pt:<part> row.

pt:<part> Type: PtValue

Passthrough, attribute form: one attribute per part, pt:<part>, and per part and state, pt:<part>:<state>. Parts: content, footer, header, panel, root. States: open.

The same parts as BbPopover minus the phone sheet: a hover card never turns into a bottom sheet.

See example
scrollable Type: booleanDefaultfalse

Caps the card height to the available viewport space and enables internal scrolling.

transitionDuration Type: numberDefault250

How long the transition has to last in milliseconds.

width Type: string | number

Width of the card. Accepts pixels or percentage (relative to activator width).

See example

v-model

Values kept in sync through v-model.

NameDescription
modelValue Type: boolean

Opens the card from elsewhere, a keyboard shortcut or a test. A click on the activator never toggles it, so this is the way when something other than hover must open it.

Events

NameDescription
hidden Type: (): void

Emitted after the card is fully closed.

hide Type: (): void

Emitted as soon as the card starts to close (model becomes false).

show Type: (): void

Emitted as soon as the card starts to open (model becomes true).

shown Type: (): void

Emitted after the card is fully opened. Focus never moves on open.

update:modelValue Type: (value: boolean): void

Emitted with the new value whenever v-model changes.

Slots

The listed properties are the ones exposed to the slot scope.

NameDescription
activator Type: BbHoverCardActivatorSlotProps

The element the card describes. Spread props onto it; it must be focusable (a link or a button) so a keyboard user can open the card too.

Spread props onto an element that can take focus, usually the link the card previews. On a <span> keyboard users can never open the card.

See example
default Type: BbHoverCardDefaultSlotProps

The card body.

See example
header Type: BbHoverCardDefaultSlotProps

Content pinned to the top of the card, outside the scroll region.

See example