Popover

锚定在触发器旁的非模态面板,可放在任意一侧,打开时获得焦点,按 Escape 或点击外部即关闭。

可用框架
  • Angular: 可用
  • Vue: 可用
  • React: 可用
  • React Native: 可用

用法

导入

ts
import {
  SonePopoverDescriptionDirective,
  SonePopoverDirective,
  SonePopoverHeaderDirective,
  SonePopoverTitleDirective,
  SonePopoverTriggerDirective,
} from "@surface-one/angular/popover";

API 参考

SonePopoverDescriptionDirective指令

`[sonePopoverDescription]` — a secondary line under the title.

选择器
[sonePopoverDescription]

SonePopoverDirective指令

`[sonePopover]` (or `[sonePopoverContent]`) — the popover surface (spartan/ui Popover content): opaque, padded, `role="dialog"` by default — name it with `aria-labelledby` (its `sonePopoverTitle`) or `aria-label`. Put it in the `<ng-template>` a `sonePopoverTrigger` opens, or pass it to the trigger by reference (`#pop="sonePopover"`): it stays hidden in place until the trigger opens it.

选择器
[sonePopover], [sonePopoverContent]
导出为
sonePopover
输入
名称类型 默认值
role

`dialog` by default; `null` (or another role) when the panel is not one.

string | null"dialog"

SonePopoverHeaderDirective指令

`[sonePopoverHeader]` — the title and description at the top of a popover.

选择器
[sonePopoverHeader]

SonePopoverTitleDirective指令

`[sonePopoverTitle]` — the popover's title; give it an `id` the popover names itself by.

选择器
[sonePopoverTitle]

SonePopoverTriggerDirective指令

`[sonePopoverTrigger]` — opens a non-modal popover next to its host (spartan/ui `brnPopoverTrigger`). Pass an `<ng-template>` (`let-close` closes it) or a `[sonePopover]` panel by reference (`#pop="sonePopover"`). It closes on Escape and on a click outside, returning focus to the trigger; inside a `sone-dialog` the panel joins the dialog's focus trap.

选择器
[sonePopoverTrigger]
导出为
sonePopoverTrigger
输入
名称类型 默认值
side

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

FloatingSide"bottom"
align

Alignment along the trigger's edge.

FloatingAlign"start"
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
sonePopoverTriggerSoneOverlayContent | nullnull