|
| 1 | +--- |
| 2 | +title: Overview |
| 3 | +page_title: Popup Overview |
| 4 | +description: Discover the Blazor Popup. Learn how to add the component to your app and explore its features like positioning, alignment, and animation customization. |
| 5 | +slug: popup-overview |
| 6 | +tags: telerik,blazor,popup |
| 7 | +published: True |
| 8 | +position: 0 |
| 9 | +--- |
| 10 | + |
| 11 | +# Blazor Popup Overview |
| 12 | + |
| 13 | +The <a href = "https://www.telerik.com/blazor-ui/popup" target="_blank">Blazor Popup component</a> helps you easily display a popup for a target element (anchor) in your application. You can use the Telerik UI for Blazor Popup to display additional information. This article explains how to start using the component and describes its features. |
| 14 | + |
| 15 | +## Creating Blazor Popup |
| 16 | + |
| 17 | +1. Add the `<TelerikPopup>` tag to a Razor file. |
| 18 | +1. Obtain the component reference through `@ref`. |
| 19 | +1. Use the [Show](#popup-reference-and-methods) method to display the `<TelerikPopup>`. |
| 20 | + |
| 21 | +>caption Basic configuration of the Telerik Popup for Blazor |
| 22 | +
|
| 23 | +````CSHTML |
| 24 | +<TelerikPopup AnchorSelector=".popup-target" @ref="@PopupRef"> |
| 25 | + I am a Telerik Popup. |
| 26 | +</TelerikPopup> |
| 27 | +
|
| 28 | +<TelerikButton OnClick="@(() => PopupRef.Show())" Class="popup-target">Show the Popup</TelerikButton> |
| 29 | +
|
| 30 | +@code { |
| 31 | + private TelerikPopup PopupRef { get; set; } |
| 32 | +} |
| 33 | +```` |
| 34 | + |
| 35 | +## Popup Positioning and Collision |
| 36 | + |
| 37 | +Use the available positioning and collision settings to customize how the Popup positions and reacts to insufficient space in the viewport. [Read more about the Blazor Popup Positioning and Collision...]({%slug popup-position-collision%}) |
| 38 | + |
| 39 | +## Popup Animations |
| 40 | + |
| 41 | +Use the available parameters to customize the animation type and its duration. [Read more about the Blazor Popup animations...]({%slug popup-animation%}). |
| 42 | + |
| 43 | +## Popup Parameters |
| 44 | + |
| 45 | +The Blazor Popup provides parameters to configure the component. Also check the [Popup API Reference](/blazor-ui/api/Telerik.Blazor.Components.TelerikPopup) for a full list of properties, methods and events. |
| 46 | + |
| 47 | +@[template](/_contentTemplates/common/parameters-table-styles.md#table-layout) |
| 48 | + |
| 49 | +| Parameter | Type | Description | |
| 50 | +| ----------- | ----------- | ----------- | |
| 51 | +| `AnchorHorizontalAlign` | `PopupAnchorHorizontalAlign` enum <br /> (`Left`) | Defines how the anchor aligns with the Popup component on the horizontal plane. [Read more about Popup Positioning.]({%slug popup-position-collision%})| |
| 52 | +| `AnchorSelector` | `string` | The CSS selector for the anchor element of the Popup. | |
| 53 | +| `AnchorVerticalAlign` | `PopupAnchorVerticalAlign` enum <br /> (`Bottom`) | Defines how the anchor aligns with the Popup on the vertical plane. [Read more about Popup Positioning.]({%slug popup-position-collision%}). | |
| 54 | +| `AnimationDuration` | `int` | The duration of the animation in milliseconds. [Read more about Popup animations.]({%slug popup-animation%}) | |
| 55 | +| `AnimationType` | `AnimationType` enum <br /> (`SlideDown`) | The type of animation when the component displays and hides. [Read more about Popup animations.]({%slug popup-animation%}) | |
| 56 | +| `HorizontalAlign` | `PopupHorizontalAlign ` enum <br /> (`Left`) | Determines if the left or the right side of the Popup will touch its anchor. [Read more about Popup Positioning.]({%slug popup-position-collision%}) | |
| 57 | +| `HorizontalCollision` | `PopupCollision ` enum <br /> (`Fit`) | Sets the behavior of the Popup when it doesn't fit in the viewport based on the horizontal plane. [Read more about Popup collision behavior.]({%slug popup-position-collision%}) | |
| 58 | +| `HorizontalOffset` | `double` | The horizontal space between the Popup and its anchor in pixels. | |
| 59 | +| `VerticalAlign` | `PopupVerticalAlign ` enum <br /> (`Top`) | Determines if the Popup will touch the anchor with its top, bottom, or center. [Read more about Popup Positioning.]({%slug popup-position-collision%}) | |
| 60 | +| `VerticalCollision` | `PopupCollision ` enum <br /> (`Flip`) | Defines the behavior of the Popup when it doesn't fit in the viewport based on the vertical plane. [Read more about Popup collision behavior.]({%slug popup-position-collision%}) | |
| 61 | +| `VerticalOffset` | `double` | The vertical space between the Popup and its anchor in `pixels`. | |
| 62 | + |
| 63 | +### Styling and Appearance |
| 64 | + |
| 65 | +The following parameters enable you to customize the appearance of the Blazor Popup: |
| 66 | + |
| 67 | +| Parameter | Type | Description | |
| 68 | +| --- | --- | --- | |
| 69 | +| `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%}). | |
| 70 | +| `Height` | `string` | The height of the Popup. | |
| 71 | +| `Width` | `string` | The width of the Popup. | |
| 72 | + |
| 73 | +## Popup Reference and Methods |
| 74 | + |
| 75 | +To execute Popup methods, obtain a reference to the component instance with `@ref`. |
| 76 | + |
| 77 | +| Method | Description | |
| 78 | +|---------|-------------| |
| 79 | +| `Refresh` | Use this method to programmatically re-render the Popup. <br /> The Popup 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 Popup content is up-to-date. | |
| 80 | +| `Show` | Use this method to display the Popup. | |
| 81 | +| `Hide` | Use this method to close the Popup. | |
| 82 | + |
| 83 | +````CSHTML |
| 84 | +<TelerikButton OnClick="@ShowPopup" Class="popup-target">Show the Popup</TelerikButton> |
| 85 | +
|
| 86 | +<TelerikPopup AnchorSelector=".popup-target" @ref="@PopupRef"> |
| 87 | + I am a Telerik Popup! |
| 88 | +</TelerikPopup> |
| 89 | +
|
| 90 | +@code { |
| 91 | + private TelerikPopup PopupRef { get; set; } |
| 92 | +
|
| 93 | + private void ShowPopup() |
| 94 | + { |
| 95 | + PopupRef.Show(); |
| 96 | + } |
| 97 | +} |
| 98 | +```` |
| 99 | + |
| 100 | +## Next Steps |
| 101 | + |
| 102 | +* [Explore the Popup Positioning and Collision Settings]({%slug popup-position-collision%}) |
| 103 | +* [Customize the Popup Animations]({%slug popup-animation%}) |
| 104 | + |
| 105 | +## See Also |
| 106 | + |
| 107 | +* [Live Popup Demos](https://demos.telerik.com/blazor-ui/popup/overview) |
| 108 | +* [Popup API Reference](/blazor-ui/api/Telerik.Blazor.Components.TelerikPopup) |
0 commit comments