|
| 1 | +--- |
| 2 | +title: Overview |
| 3 | +page_title: Popover Overview |
| 4 | +description: Discover the Blazor Popover. Learn how to add the component to your app and explore its features like adding content, execute actions, positioning and collision, and animation customization. |
| 5 | +slug: popover-overview |
| 6 | +tags: telerik,blazor,popover,pop,over |
| 7 | +published: True |
| 8 | +position: 0 |
| 9 | +--- |
| 10 | + |
| 11 | +# Blazor Popover Overview |
| 12 | + |
| 13 | +The <a href = "https://www.telerik.com/blazor-ui/popover" target="_blank">Blazor Popover component</a> behaves much like a tooltip, as it helps you display additional information in a container that shows on top of the other page content. The major differences between the Popover and the [Tooltip]({%slug tooltip-overview%}) components is that the Popover has built-in support for action buttons and provides more configuration options about its animation and placement on the screen. This article explains how to start using the component and describes its features. |
| 14 | + |
| 15 | +## Creating Blazor Popover |
| 16 | + |
| 17 | +1. Add the `<TelerikPopover>` tag to a Razor file. |
| 18 | +1. Obtain a `@ref` of the component. |
| 19 | +1. Add the content to the `<PopoverContent>` child tag. |
| 20 | +1. Use the [`Show`](#popover-reference-and-methods) method to display the `<TelerikPopover>`. |
| 21 | +1. (optional) Add a title inside a `<PopoverHeader>` tag. HTML markup and child components are supported, too. |
| 22 | + |
| 23 | +>caption Basic configuration of the Telerik Popover for Blazor |
| 24 | +
|
| 25 | +````CSHTML |
| 26 | +<TelerikPopover @ref="@PopoverRef" |
| 27 | + AnchorSelector=".popover-target"> |
| 28 | + <PopoverContent> |
| 29 | + I am a Telerik Popover |
| 30 | + </PopoverContent> |
| 31 | + <PopoverActions> |
| 32 | + <TelerikButton OnClick="@(() => PopoverRef.Hide())" Icon="@SvgIcon.X">Close</TelerikButton> |
| 33 | + </PopoverActions> |
| 34 | +</TelerikPopover> |
| 35 | +
|
| 36 | +<TelerikButton OnClick="@(() => PopoverRef.Show())" Class="popover-target">Show the Popover</TelerikButton> |
| 37 | +
|
| 38 | +@code{ |
| 39 | + private TelerikPopover PopoverRef { get; set; } |
| 40 | +} |
| 41 | +```` |
| 42 | + |
| 43 | +## Popover Positioning and Collision |
| 44 | + |
| 45 | +Use the available positioning and collision settings to customize how the Popover positions itself and reacts to insufficient space in the viewport. [Read more about the Blazor Popover Positioning and Collision...]({%slug popover-position-collision%}) |
| 46 | + |
| 47 | +## Popover Animations |
| 48 | + |
| 49 | +Use the available parameters to customize the animation type and its duration. [Read more about the Blazor Popover Animations...]({%slug popover-animation%}) |
| 50 | + |
| 51 | +## Popover Parameters |
| 52 | + |
| 53 | +The Blazor Popover provides parameters to configure the component. Also check the [Popover API Reference](/blazor-ui/api/Telerik.Blazor.Components.TelerikPopover) for a full list of properties. |
| 54 | + |
| 55 | +@[template](/_contentTemplates/common/parameters-table-styles.md#table-layout) |
| 56 | + |
| 57 | +| Parameter | Type | Description | |
| 58 | +| ----------- | ----------- | ----------- | |
| 59 | +| `ActionsLayout` | `PopoverActionsLayoutAlign ` enum <br /> (`Stretch`) | The positioning of the elements in the `<PopoverActions>` child tag. The possible values are `Stretch`, `Start`, `Center`, and `End`. | |
| 60 | +| `AnchorSelector` | `string` | The CSS selector targeting the element that the Popover uses as an anchor. | |
| 61 | +| `AnimationDuration` | `int` | The duration of the animation in milliseconds. [Read more about Popover animations...]({%slug popover-animation%}) | |
| 62 | +| `AnimationType` | `AnimationType` enum <br /> (`SlideDown`) | The type of animation when the component displays and hides. [Read more about Popover animations...]({%slug popover-animation%}) | |
| 63 | +| `Collision` | `PopoverCollision` enum <br /> (`Fit`) | The behavior of the Popover when it doesn't fit in the viewport. [Read more about Popover collision...]({%slug popover-position-collision%}) | |
| 64 | +| `Offset` | `double ` | The space between the Popover and its anchor in pixels. | |
| 65 | +| `Position` | `PopoverPosition ` enum <br /> (`Top`) | The position relative to the target element at which the Popover will be shown. [Read more about Popover position...]({%slug popover-position-collision%}) | |
| 66 | +| `ShowCallout` | `bool` <br /> (`true`) | Defines if the callout is rendered. | |
| 67 | +| `ShowOn` | `PopoverShowEvent` enum <br /> (`Click`) | The browser event that will display the Popover (`MouseEnter` or `Click`). When you set the `ShowOn` parameter to `Click`, the Popover will hide when the user clicks outside the component. If the parameter's value is `MouseEnter`, the Popover will hide when the mouse pointer leaves. | |
| 68 | + |
| 69 | +### Styling and Appearance |
| 70 | + |
| 71 | +The following parameters enable you to customize the appearance of the Blazor Popover: |
| 72 | + |
| 73 | +| Parameter | Type | Description | |
| 74 | +| --- | --- | --- | |
| 75 | +| `Class` | `string` | The custom CSS class to be rendered on the `<div>` element, which wraps the component `ChildContent`. Use for [styling customizations]({%slug themes-override%}). | |
| 76 | +| `Height` | `string` | The height of the Popover. | |
| 77 | +| `Width` | `string` | The width of the Popover. | |
| 78 | + |
| 79 | +## Popover Reference and Methods |
| 80 | + |
| 81 | +To execute Popover methods, obtain a reference to the component instance with `@ref`. |
| 82 | + |
| 83 | +| Method | Description | |
| 84 | +|---------|-------------| |
| 85 | +| `Refresh` | Use this method to programmatically re-render the Popover. <br /> The Popover is rendered as a child of the `TelerikRootComponent`, instead of where it is declared. As a result, it doesn't automatically refresh when its content is updated. In such cases, the `Refresh` method comes in handy to ensure that the Popover content is up-to-date. | |
| 86 | +| `Show` | Use this method to display the Popover. | |
| 87 | +| `Hide` | Use this method to close the Popover. | |
| 88 | + |
| 89 | +````CSHTML |
| 90 | +<TelerikPopover @ref="@PopoverRef" |
| 91 | + AnchorSelector=".popover-target"> |
| 92 | + <PopoverContent> |
| 93 | + I am a Telerik Popover |
| 94 | + </PopoverContent> |
| 95 | + <PopoverActions> |
| 96 | + <TelerikButton OnClick="@(() => PopoverRef.Hide())" Icon="@SvgIcon.X">Close</TelerikButton> |
| 97 | + </PopoverActions> |
| 98 | +</TelerikPopover> |
| 99 | +
|
| 100 | +<TelerikButton OnClick="@(() => PopoverRef.Show())" Class="popover-target">Show the Popover</TelerikButton> |
| 101 | +
|
| 102 | +@code{ |
| 103 | + private TelerikPopover PopoverRef { get; set; } |
| 104 | +} |
| 105 | +```` |
| 106 | + |
| 107 | +## Next Steps |
| 108 | + |
| 109 | +* [Explore the Popover Positioning and Collision Settings]({%slug popover-position-collision%}) |
| 110 | +* [Customize the Popover Animations]({%slug popover-animation%}) |
| 111 | + |
| 112 | +## See Also |
| 113 | + |
| 114 | +* [Live Popover Demos](https://demos.telerik.com/blazor-ui/popover/overview) |
| 115 | +* [Popover API Reference](/blazor-ui/api/Telerik.Blazor.Components.TelerikPopover) |
0 commit comments