Showcase

Blazor Popover

The Blazor Bootstrap Popover component shows a title and rich content next to a trigger, with placements, triggers, colors, and content that updates while it is open. The examples below cover placements, triggers, dismiss behavior, rich content and live content.
API Documentation
INFO
Popover wraps the Bootstrap 5.3 popover. Put the trigger, a focusable element such as a button, inside Popover. The title and content are rendered by Blazor and keep updating while the popover is open. A popover with no title and no content never opens.

Basic usage #

Click the button to open and close the popover.
How to use:
  1. Wrap the trigger in Popover, and set Title and Content. Strings always show as text.
  2. The trigger gets aria-describedby and aria-expanded.

Placements #

Open the popover on the top, right, bottom, or left of the trigger, or let it pick the side with the most room.
How to use:
  1. Set Placement. The default is Right; Right and Left are mirrored in right-to-left layouts.

Triggers #

Open the popover on click (default), hover, focus, or only from code.
How to use:
  1. Set Trigger. Combine Click, Hover, and Focus with |; Manual stands alone.
  2. Pair Hover with Focus, so keyboard users can open it too.
  3. Hover and Focus popovers close when focus leaves the trigger, so use them for content that is read; put links and buttons in a Click popover.

Dismiss behavior #

Close the popover on the next click, on a click outside, or on Escape.
How to use:
  1. For Bootstrap's dismiss on next click, use the Focus trigger on an <a tabindex="0" role="button">; buttons do not take focus on click in every browser.
  2. AutoClose (default true) closes the popover on a click outside it and its trigger, on Escape, and when focus leaves its content. Set it to false to keep it open until the trigger is clicked again.

Rich content #

Show markup in the title and content, such as an icon, a badge, a table, or a link.
How to use:
  1. Set TitleTemplate and ContentTemplate, and put the trigger in ChildContent.
  2. Widen the popover for a table with a CustomClass that sets --bs-popover-max-width.

Live content #

The content updates in place while the popover is open, and the popover repositions when its size changes.
How to use:
  1. Bind the content to your state as usual; the open popover is never re-created.
  2. Open it with Enter or Space, and focus moves to its first button; Escape closes it and returns focus to the trigger.
  3. Tab and Shift+Tab move between the trigger and the content as if the popover sat right after the trigger; tabbing past the last button closes it.

Methods #

Control the popover from code.
How to use:
  1. Get a reference with @ref, and call ShowAsync, HideAsync, ToggleAsync, or UpdateAsync.
  2. Call UpdateAsync after the trigger moves; content size changes reposition the popover by themselves.

Events #

React when the popover shows and hides.
How to use:
  1. Handle OnShowing, OnInserted, OnShown, OnHiding, and OnHidden.

Colors #

Color the popover's header and border.
How to use:
  1. Set Color.

Custom popovers #

Style a popover through Bootstrap's popover CSS variables.
How to use:
  1. Define a class that sets the --bs-popover-* variables, and set it as CustomClass.

Disabled elements #

Describe a disabled control. A disabled element cannot be hovered, clicked, or focused, so the wrapper around it gets the popover, and becomes focusable with the Click or Focus trigger.
How to use:
  1. Put the disabled control in Popover; the wrapper takes over automatically.
  2. Use PopoverTrigger.Hover | PopoverTrigger.Focus, as users may not expect to click a disabled control.

Disabled popover #

Stop a popover from opening until it is enabled again.
How to use:
  1. Set Disabled="true". An open popover closes when it is disabled.

Offset, delay, animation, and fallback placements #

Fine-tune where and when the popover appears.
How to use:
  1. Offset is "skidding,distance" in pixels (Bootstrap's default is "0,8").
  2. ShowDelay and HideDelay apply to the Hover and Focus triggers.
  3. Animation="false" turns off the fade.
  4. FallbackPlacements lists the sides to try, in order, when Placement has no room.

Custom container #

Add the popover to another element, for example a modal, so its interactive content works inside the modal's focus trap.
How to use:
  1. Set Container to a CSS selector, such as "#my-modal .modal-body". The default is the page body.

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.