Popover
トリガーに固定される非モーダルのパネル。どの辺にも配置でき、フォーカスを受け取り、Escape キーや外側のクリックで閉じます。
Angular: 対応 Vue: 対応 React: 対応 React Native: 対応
使い方
<div class="demo-row" style="align-items: flex-start; min-height: 17rem">
<button soneBtn variant="outline" type="button" [sonePopoverTrigger]="dimensions">Dimensions</button>
<ng-template #dimensions let-close="close">
<div sonePopoverContent aria-labelledby="dimensions-title">
<div sonePopoverHeader>
<p sonePopoverTitle id="dimensions-title">Dimensions</p>
<p sonePopoverDescription>Set the size of the layer.</p>
</div>
<div soneField>
<label soneFieldLabel for="dimensions-width">Width</label>
<input id="dimensions-width" type="text" value="100%" />
</div>
<div soneField>
<label soneFieldLabel for="dimensions-height">Height</label>
<input id="dimensions-height" type="text" value="25px" />
</div>
<button soneBtn size="sm" type="button" (click)="close()">Apply</button>
</div>
</ng-template>
</div>インポート
import {
SonePopoverDescriptionDirective,
SonePopoverDirective,
SonePopoverHeaderDirective,
SonePopoverTitleDirective,
SonePopoverTriggerDirective,
} from "@surface-one/angular/popover";API リファレンス
SonePopoverDescriptionDirectiveディレクティブ
`[sonePopoverDescription]` — a secondary line under the title.
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.
| 名前 | 型 | デフォルト |
|---|---|---|
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.
SonePopoverTitleDirectiveディレクティブ
`[sonePopoverTitle]` — the popover's title; give it an `id` the popover names itself by.
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.
| 名前 | 型 | デフォルト |
|---|---|---|
sideThe side of the trigger the panel opens on; it flips when that side lacks room. | FloatingSide | "bottom" |
alignAlignment along the trigger's edge. | FloatingAlign | "start" |
offsetGap between the trigger and the panel, in px. | number | 4 |
open双方向Shown or not — `[(open)]`. | boolean | false |
keepOpenOnOutsideClickKeep the panel open on a click outside it (Escape still closes it). | boolean | false |
sonePopoverTrigger | SoneOverlayContent | null | null |