Skip to content

Commit 046d779

Browse files
svdimitrikoevskadimodi
authored
Popup docs (#1877)
* docs(popup): first commit * chore(popup): finalize overview * chore(popup): add animations article * docs(popup): add position and collision: * Update components/popup/animation.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/animation.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/animation.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/position-collision.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/animation.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/animation.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/animation.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/position-collision.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/position-collision.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/position-collision.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/position-collision.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/position-collision.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/position-collision.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/position-collision.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/position-collision.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/position-collision.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/overview.md Co-authored-by: Dimo Dimov <[email protected]> * Update components/popup/overview.md Co-authored-by: Dimo Dimov <[email protected]> * Update components/popup/overview.md Co-authored-by: Dimo Dimov <[email protected]> * Update components/popup/position-collision.md Co-authored-by: Dimo Dimov <[email protected]> * Update components/popup/position-collision.md Co-authored-by: Dimo Dimov <[email protected]> * Update components/popup/animation.md Co-authored-by: Dimo Dimov <[email protected]> * Update components/popup/animation.md Co-authored-by: Dimo Dimov <[email protected]> * Update components/popup/position-collision.md Co-authored-by: Dimo Dimov <[email protected]> * chore(popup): remove standard html elements and use our components and enhance the refresh description * chore(popup): add the popup in config file * polishing * add See Also sections * Update components/popup/position-collision.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * Update components/popup/animation.md Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> * typo --------- Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]> Co-authored-by: Dimo Dimov <[email protected]> Co-authored-by: Iva Stefanova Koevska-Atanasova <[email protected]>
1 parent fe6dfd8 commit 046d779

File tree

4 files changed

+414
-0
lines changed

4 files changed

+414
-0
lines changed

_config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,8 @@ navigation:
273273
title: "AIPrompt"
274274
"*appbar":
275275
title: "AppBar"
276+
"*popup":
277+
title: "Popup"
276278
"*autocomplete":
277279
title: "AutoComplete"
278280
"*avatar":
@@ -633,6 +635,7 @@ intro_columns:
633635
"Progress Bar": "progressbar-overview"
634636
"Chunk Progress Bar": "chunkprogressbar-overview"
635637
"Tooltip": "tooltip-overview"
638+
"Popup": "popup-overview"
636639
-
637640
title: "Documents"
638641
items:

components/popup/animation.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
---
2+
title: Animation
3+
page_title: Popup Animation
4+
description: Explore the animation settings of the Popup for Blazor. Discover how to adjust the way the Popup appears and disappears on the screen.
5+
slug: popup-animation
6+
tags: telerik,blazor,popup,animation
7+
published: True
8+
position: 35
9+
---
10+
11+
# Popup Animation
12+
13+
This article outlines how to customize the animations when the Popup displays and hides.
14+
15+
## Type
16+
17+
You can change the way the Popup component shows and hides by setting the `AnimationType` parameter to a member of the `AnimationType` enum:
18+
19+
* `None`
20+
* `Fade`
21+
* `PushUp`
22+
* `PushDown`
23+
* `PushLeft`
24+
* `PushRight`
25+
* `RevealVertical`
26+
* `SlideUp`
27+
* `SlideIn`
28+
* `SlideDown` (default)
29+
* `SlideRight`
30+
* `SlideLeft`
31+
* `ZoomIn`
32+
* `ZoomOut`
33+
34+
See the [example](#example) below to customize the available parameters and see how they affect the Popup component.
35+
36+
## Duration
37+
38+
Set the `AnimationDuration` parameter in milliseconds as `int` to control how long the animation will take until the component is fully displayed.
39+
40+
See the [example](#example) below to customize the available parameters and see how they affect the Popup component.
41+
42+
## Example
43+
44+
The following example lets you experiment with the available settings that control the animation in the Popup. It starts with the default component behavior.
45+
46+
````CSHTML
47+
<label>
48+
Animation Type:
49+
<TelerikDropDownList Data="@AnimationTypes"
50+
Value="@SelectedAnimationType"
51+
ValueChanged="@( (AnimationType newValue) => OnDropDownValueChanged(newValue) )"
52+
Width="160px" />
53+
</label>
54+
<label>
55+
Animation Duration:
56+
<TelerikNumericTextBox @bind-Value="@SelectedAnimationDuration"
57+
Min="0"
58+
Max="7000"
59+
Width="100px" />
60+
</label>
61+
62+
<TelerikButton OnClick="@(() => PopupRef.Show())">Show Popup</TelerikButton>
63+
<TelerikButton OnClick="@(() => PopupRef.Hide())">Hide Popup</TelerikButton>
64+
65+
<TelerikPopup @ref="@PopupRef"
66+
AnchorSelector=".popup-target"
67+
AnimationType="@SelectedAnimationType"
68+
AnimationDuration="@SelectedAnimationDuration"
69+
Width="300px">
70+
<div style="padding: 1em; color: #fff; background: #282f89; text-align: center;">
71+
Telerik Blazor Animation Container
72+
</div>
73+
</TelerikPopup>
74+
75+
<div class="popup-target styled-container">
76+
77+
</div>
78+
79+
@code {
80+
private TelerikPopup PopupRef { get; set; }
81+
82+
private List<AnimationType> AnimationTypes { get; set; }
83+
84+
private AnimationType SelectedAnimationType { get; set; } = AnimationType.SlideDown;
85+
86+
private int SelectedAnimationDuration { get; set; } = 300;
87+
88+
private void OnDropDownValueChanged(AnimationType newAnimationType)
89+
{
90+
PopupRef.Hide();
91+
92+
SelectedAnimationType = newAnimationType;
93+
94+
PopupRef.Show();
95+
}
96+
97+
protected override void OnInitialized()
98+
{
99+
AnimationTypes = new List<AnimationType>();
100+
101+
foreach (AnimationType animation in Enum.GetValues(typeof(AnimationType)))
102+
{
103+
AnimationTypes.Add(animation);
104+
}
105+
106+
base.OnInitialized();
107+
}
108+
}
109+
110+
<style>
111+
.styled-container {
112+
width: 200px;
113+
height: 30px;
114+
background-color: yellowgreen;
115+
margin-top: 20px;
116+
}
117+
</style>
118+
````
119+
120+
## See Also
121+
122+
* [Live Popup Demos](https://demos.telerik.com/blazor-ui/popup/overview)
123+
* [Popup API Reference](/blazor-ui/api/Telerik.Blazor.Components.TelerikPopup)

components/popup/overview.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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

Comments
 (0)