On this page
@addTagHelper *, Webority.Ui.RazorAnchored panel
Use a panel beside a trigger for richer content than a menu, such as notifications or a short form.
Title or body only
Add a title for a labelled panel; leave it out when the body explains itself.
Placement
Choose the side the panel opens on, or let auto flip it to whichever side has room.
What opens it
Use hover with focus for a quick preview; keep click for anything a person must open on purpose.
Every option
Every value of every prop, one cell each.
trigger: one element
<app-popover-trigger>: any markup, here an icon
children: the panel body
<app-popover-body>: any content, and long text grows the panel
title: with and without
title="Notifications": header rendered
(no title): body-only panel
placement: all five
placement="top"
placement="bottom" (default)
placement="start"
placement="end"
placement="auto": flips to stay in view
triggerType: every value
trigger-type="click" (default)
trigger-type="focus"
trigger-type="hover focus": hover or keyboard focus
trigger-type="hover" (pair with focus for keyboard and touch)
onOpenChange: reports open and close
onOpenChange={fn} (React only): here, listen for shown.bs.popover
onClick (Razor: a click on the trigger)
aria-expanded is not a prop: the popover sets it on the trigger to match the open state, so it has no cell.
open: held open or closed
open={true} and open={false} (React only): here, trigger-type alone opens it
role: none or dialog
(no role) (default)
role="dialog": named by the title, Escape closes it
labelledBy: names a dialog
labelled-by="pop-demo-name": names the dialog, and wins over the title
autoFocus: off and on
(no auto-focus) (default): focus stays on the trigger
auto-focus="true": moves focus into the panel on open
className: extra classes
class="text-primary": the class lands on the host span
openDelay: hover open delay
open-delay="80" (default): a hover waits 80 ms
open-delay="0": a hover opens at once
closeDelay: hover close delay
close-delay="220" (default): a hover waits 220 ms to close
close-delay="0": a hover closes at once
Guidance
What to do, and what to avoid.
Use it when
- A trigger needs a floating panel of content richer than a flat action list: a notifications feed, a filters form, a mini preview.
- The content is contextual to the trigger and doesn’t need a backdrop or to interrupt the page.
- You want the panel positioned and flipped to stay in view automatically.
Reach for something else when
- The content is a flat list of actions. → AppDropdown
- The task needs full attention, such as a form, a multi-step flow or a destructive confirmation. → AppModal
- You are explaining a single term next to a label. → AppInfoTip
Keep the panel short
A short, scannable panel: a few lines the user can read without scrolling.
A multi-field form crammed into a popover has nowhere to show validation and no backdrop to hold focus. Use AppModal instead.
Reference
Try every prop, read the full list, and check keyboard and screen reader behaviour.
11 props. The 3 most used come first.
Used on most screens 3 props
| Prop | Type | Default | Description |
|---|---|---|---|
| titledefault - | string | - | An optional panel title, plain text so it never breaks the page's heading order. |
| placementdefault bottom | top | bottom | start | end | auto | bottom | Where the panel opens. auto flips to stay in view. |
| roledefault - | dialog | - | dialog names the panel after the title or labelled-by, marks it not modal, and lets Escape close it. |
Less common 8 props
| Prop | Type | Default | Description |
|---|---|---|---|
| app-popover-triggerdefault - | markup | - | Child slot: the anchor element the panel opens from. |
| app-popover-bodydefault - | markup | - | Child slot: the panel body. |
| trigger-typedefault click | click | hover | focus, or a space-separated combination (e.g. hover focus) | click | What opens the panel. Razor takes the same combinations as a space-separated string, such as hover focus. |
| labelled-bydefault - | string | - | The id of the element that names a dialog panel. It wins over the title. |
| auto-focusdefault false | bool | false | Moves focus into the panel on open and back to the trigger on close. |
| open-delaydefault 80 | int | 80 | Milliseconds a hover popover waits before it opens. |
| close-delaydefault 220 | int | 220 | Milliseconds a hover popover waits before it closes after the pointer leaves the trigger and the panel. |
| classdefault - | string | - | Extra classes on the panel host span. |
Screen reader
3 notes- With role dialog the panel is named by the title, or by the element labelledBy points to (which wins), is marked not modal, and Escape closes it.
- With autoFocus focus moves into the panel on open and back to the trigger on close.
- The trigger is the caller's own element with aria-expanded added for a click trigger, so it needs its own accessible name.
Do and avoid
1 pairsKeep the panel short
A short, scannable panel: a few lines the user can read without scrolling.
A multi-field form crammed into a popover has nowhere to show validation and no backdrop to hold focus. Use AppModal instead.