# Blazor Popup Overview

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.

## Creating Blazor Popup

1. Add the `<TelerikPopup>` tag to a Razor file.
2. Set the `AnchorSelector` parameter to a CSS selector, which points to the HTML element that the Popup will align with.
3. [Obtain the Popup reference](https://www.telerik.com/blazor-ui/documentation/components/popup/overview#popup-reference-and-methods) to show and hide the component programmatically.
4. (optional) Set `HideOnOutsideClick` to `true` if you want the Popup to close automatically when the user clicks somewhere outside the Popup and the anchor. In this case, also handle the [`OnHide` event](https://www.telerik.com/blazor-ui/documentation/components/popup/events) if you want to track the Popup state.
5. (optional) Set the Popup `Width` and `Height`, or configure animations.

> caption Basic Telerik Popup for Blazor

<demo metaUrl="client/popup/overview/basic/"></demo>

## Positioning and Collision

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...](https://www.telerik.com/blazor-ui/documentation/components/popup/position-collision)

## Animations

Use the available parameters to customize the animation type and its duration. [Read more about the Blazor Popup animations...](https://www.telerik.com/blazor-ui/documentation/components/popup/animation).

## Events

The [Popup exposes events](https://www.telerik.com/blazor-ui/documentation/components/popup/events) that enable your app to react to user actions.

## Popup Parameters

The Blazor Popup provides parameters to configure the component. Also check the [Popup API Reference](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.telerikpopup) for a full list of properties, methods and events.

<style>
    .article table {
        table-layout: auto;
        word-break: normal;
    }
</style>

| Parameter               | Type                                              | Description                                                                                                                                                                                                                         |
| ----------------------- | ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `AnchorHorizontalAlign` | `PopupAnchorHorizontalAlign` enum <br /> (`Left`) | Defines how the anchor aligns with the Popup component on the horizontal plane. [Read more about Popup Positioning.](https://www.telerik.com/blazor-ui/documentation/components/popup/position-collision)                           |
| `AnchorSelector`        | `string`                                          | The CSS selector for the anchor element of the Popup.                                                                                                                                                                               |
| `AnchorVerticalAlign`   | `PopupAnchorVerticalAlign` enum <br /> (`Bottom`) | Defines how the anchor aligns with the Popup on the vertical plane. [Read more about Popup Positioning.](https://www.telerik.com/blazor-ui/documentation/components/popup/position-collision).                                      |
| `AnimationDuration`     | `int`                                             | The duration of the animation in milliseconds. [Read more about Popup animations.](https://www.telerik.com/blazor-ui/documentation/components/popup/animation)                                                                      |
| `AnimationType`         | `AnimationType` enum <br /> (`SlideDown`)         | The type of animation when the component displays and hides. [Read more about Popup animations.](https://www.telerik.com/blazor-ui/documentation/components/popup/animation)                                                        |
| `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.](https://www.telerik.com/blazor-ui/documentation/components/popup/position-collision)                              |
| `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.](https://www.telerik.com/blazor-ui/documentation/components/popup/position-collision)  |
| `HorizontalOffset`      | `double`                                          | The horizontal space between the Popup and its anchor in pixels.                                                                                                                                                                    |
| `VerticalAlign`         | `PopupVerticalAlign ` enum <br /> (`Top`)         | Determines if the Popup will touch the anchor with its top, bottom, or center. [Read more about Popup Positioning.](https://www.telerik.com/blazor-ui/documentation/components/popup/position-collision)                            |
| `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.](https://www.telerik.com/blazor-ui/documentation/components/popup/position-collision) |
| `VerticalOffset`        | `double`                                          | The vertical space between the Popup and its anchor in `pixels`.                                                                                                                                                                    |

### Styling and Appearance

The following parameters enable you to customize the appearance of the Blazor Popup:

| Parameter | Type     | Description                                                                                                                                                                                                                       |
| --------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Class`   | `string` | The custom CSS class to be rendered on the `<div>` element, which wraps the component `ChildContent`. Use for [styling customizations](https://www.telerik.com/blazor-ui/documentation/styling-and-themes/override-theme-styles). |
| `Height`  | `string` | The height of the Popup.                                                                                                                                                                                                          |
| `Width`   | `string` | The width of the Popup. If not set, the component width will match the anchor width.                                                                                                                                              |

## Popup Reference and Methods

To execute Popup methods, obtain a reference to the component instance with `@ref`.

| Method    | Description                                                                                                                                                                                                                                                                            |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Refresh` | Re-renders the Popup. <br /> The Popup renders 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 ensures that the Popup content is up-to-date. |
| `Show`    | Displays the Popup.                                                                                                                                                                                                                                                                    |
| `Hide`    | Closes the Popup.                                                                                                                                                                                                                                                                      |

<demo metaUrl="client/popup/overview/methods/"></demo>

## Next Steps

* [Explore the Popup Positioning and Collision Settings](https://www.telerik.com/blazor-ui/documentation/components/popup/position-collision)
* [Customize the Popup Animations](https://www.telerik.com/blazor-ui/documentation/components/popup/animation)

## See Also

* [Live Popup Demos](https://demos.telerik.com/blazor-ui/popup/overview)
* [Popup API Reference](https://www.telerik.com/blazor-ui/documentation/api/telerik.blazor.components.telerikpopup)
* [Comparison between All Popup Components](https://www.telerik.com/blazor-ui/documentation/knowledge-base/common-popup-component-comparison)
