Popover

A non-modal panel anchored to its trigger, placed on any side, that takes focus and closes on Escape or a click outside.

Available in
  • Angular: available
  • Vue: available
  • React: available
  • React Native: available

Usage

Import

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

API reference

SonePopoverDescriptionDirectiveDirective

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

Selector
[sonePopoverDescription]

SonePopoverDirectiveDirective

`[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.

Selector
[sonePopover], [sonePopoverContent]
Export as
sonePopover
Inputs
NameType Default
role

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

string | null"dialog"

SonePopoverHeaderDirectiveDirective

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

Selector
[sonePopoverHeader]

SonePopoverTitleDirectiveDirective

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

Selector
[sonePopoverTitle]

SonePopoverTriggerDirectiveDirective

`[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.

Selector
[sonePopoverTrigger]
Export as
sonePopoverTrigger
Inputs
NameType Default
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
opentwo-way

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

booleanfalse
keepOpenOnOutsideClick

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

booleanfalse
sonePopoverTriggerSoneOverlayContent | nullnull