Hover Card

リンクのプレビューカード。ホバーまたはキーボードフォーカスから少し遅れて表示され、ポインターがリンクかカードの上にある間は開いたままです。モーダルではなく、タッチスクリーンではタップで開きます。

対応フレームワーク
  • Angular: 対応
  • Vue: 対応
  • React: 対応
  • React Native: 対応

使い方

インポート

ts
import {
  SoneHoverCardDirective,
  SoneHoverCardTriggerDirective,
} from "@surface-one/angular/hover-card";

API リファレンス

SoneHoverCardDirectiveディレクティブ

`[soneHoverCard]` (or `[soneHoverCardContent]`) — the card a `soneHoverCardTrigger` previews: the popover surface at `--hover-card-w`, with no role (it describes its trigger). Put it in the trigger's `<ng-template>` or pass it by reference (`#card="soneHoverCard"`): it stays hidden in place until the trigger opens it.

セレクター
[soneHoverCard], [soneHoverCardContent]
エクスポート名
soneHoverCard

SoneHoverCardTriggerDirectiveディレクティブ

`[soneHoverCardTrigger]` — a link (or any focusable element) that previews a card on hover and keyboard focus (spartan/ui `brnHoverCardTrigger`, Radix HoverCard): it opens after `openDelay`, stays open while the pointer is on the trigger or the card, and closes `closeDelay` after it leaves, on Escape or on a click outside. Non-modal: focus stays on the trigger (the card is `aria-describedby` it while open) and Tab moves on as usual. On a touch screen the first tap opens the card and the next one follows the link.

セレクター
[soneHoverCardTrigger]
エクスポート名
soneHoverCardTrigger
入力
名前型 デフォルト
side

The side of the trigger the panel opens on; it flips when that side lacks room.

FloatingSide"bottom"
offset

Gap between the trigger and the panel, in px.

number4
open双方向

Shown or not — `[(open)]`.

booleanfalse
keepOpenOnOutsideClick

Keep the panel open on a click outside it (Escape still closes it).

booleanfalse
soneHoverCardTriggerSoneOverlayContent | nullnull
align

Alignment along the trigger's edge (centred, as in shadcn/ui).

FloatingAlign"center"
openDelay

ms from hovering or focusing the trigger to opening.

number700
closeDelay

ms from leaving the trigger and the card to closing.

number300
openOnFocus

Open on keyboard focus too (on by default).

booleantrue