Skip to content

Commit 60de175

Browse files
Merge dimodi-popover-2575 into production (#2582)
* docs(popover) * Improve Popover Position article --------- Co-authored-by: Dimo Dimov <961014+dimodi@users.noreply.github.com>
1 parent 5161f0e commit 60de175

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

components/popover/overview.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ The Blazor Popover provides parameters to configure the component. Also check th
6969
| `AnimationDuration` | `int` | The duration of the animation in milliseconds. [Read more about Popover animations...]({%slug popover-animation%}) |
7070
| `AnimationType` | `AnimationType` enum <br /> (`SlideDown`) | The type of animation when the component displays and hides. [Read more about Popover animations...]({%slug popover-animation%}) |
7171
| `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%}) |
72-
| `Offset` | `double ` | The space between the Popover and its anchor in pixels. |
72+
| `Offset` | `double ` | The [space between the Popover and its anchor]({%slug popover-position-collision%}#offset) in pixels. The component ignores its callout when applying this setting. |
7373
| `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%}) |
7474
| `ShowCallout` | `bool` <br /> (`true`) | Defines if the callout is rendered. |
7575
| `ShowOn` | `PopOverShowOn?` enum <br /> (`null`) | The browser event that will display the Popover (`MouseEnter` or `Click`) without the need to [use component methods](#popover-reference-and-methods). When you set the `ShowOn` parameter to `Click`, the Popover will hide when the user clicks outside the component. If the parameter value is `MouseEnter`, the Popover will hide when the mouse pointer leaves. |

components/popover/position-collision.md

+20-8
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ position: 10
1212

1313
This article outlines the available settings which enable you to control the position of the Popover based on its anchor and dictate how the component responds to insufficient screen space.
1414

15+
The [example](#example) below lets you customize the Popover `Position`, `Offset`, and `Collision` parameters and see how they affect the component.
16+
1517
## Position
1618

1719
To customize how the popover aligns with its anchor element, use the `Position` parameter and set its value to a member of the `PopoverPosition` enum:
@@ -21,7 +23,9 @@ To customize how the popover aligns with its anchor element, use the `Position`
2123
* `Left`
2224
* `Right`
2325

24-
The [example](#example) below lets you customize the available `Position` parameters and see how they affect the Popover component.
26+
## Offset
27+
28+
The `Offset` moves the Popover further away from its anchor in the direction that is consistent with the `Position` parameter value. For example, the Popover will move further down when the `Position` is set to `Bottom`.
2529

2630
## Collision
2731

@@ -34,13 +38,21 @@ To define how the Popover reacts to insufficient screen space, set the `Collisio
3438

3539
The following example lets you experiment with the available settings that control the position and collision behavior of the Popover. It starts with the default component behavior.
3640

41+
>caption Popover Position and Collision
42+
3743
````CSHTML
3844
<div>
3945
<label>
4046
Popover Position
4147
<TelerikDropDownList @bind-Value="@PopoverPositionType" Data="@PopoverPositions" Width="200px" />
4248
</label>
4349
</div>
50+
<div>
51+
<label>
52+
Offset
53+
<TelerikNumericTextBox @bind-Value="@PopoverOffset" Width="200px" />
54+
</label>
55+
</div>
4456
<div>
4557
<label>
4658
Popover Collision Type
@@ -49,14 +61,15 @@ The following example lets you experiment with the available settings that contr
4961
</div>
5062
5163
<TelerikPopover @ref="@PopoverRef"
52-
AnchorSelector=".popover-target"
64+
AnchorSelector=".popover-target"
5365
Collision="@PopoverCollisionType"
66+
Offset="@PopoverOffset"
5467
Position="@PopoverPositionType">
5568
<PopoverContent>
5669
I am a Telerik Popover
5770
</PopoverContent>
5871
<PopoverActions>
59-
<TelerikButton OnClick="@(() => PopoverRef.Hide())" Icon="@SvgIcon.X">Close</TelerikButton>
72+
<TelerikButton OnClick="@(() => PopoverRef?.Hide())" Icon="@SvgIcon.X">Close</TelerikButton>
6073
</PopoverActions>
6174
</TelerikPopover>
6275
@@ -65,20 +78,19 @@ The following example lets you experiment with the available settings that contr
6578
</div>
6679
6780
@code{
68-
private TelerikPopover PopoverRef { get; set; }
81+
private TelerikPopover? PopoverRef { get; set; }
6982
private PopoverCollision PopoverCollisionType { get; set; } = PopoverCollision.Fit;
83+
private int PopoverOffset { get; set; } = 0;
7084
private PopoverPosition PopoverPositionType { get; set; } = PopoverPosition.Top;
7185
72-
private List<PopoverPosition> PopoverPositions { get; set; } = new List<PopoverPosition>()
73-
{
86+
private List<PopoverPosition> PopoverPositions { get; set; } = new List<PopoverPosition>() {
7487
PopoverPosition.Top,
7588
PopoverPosition.Left,
7689
PopoverPosition.Right,
7790
PopoverPosition.Bottom,
7891
};
7992
80-
private List<PopoverCollision> PopoverCollisionTypes { get; set; } = new List<PopoverCollision>()
81-
{
93+
private List<PopoverCollision> PopoverCollisionTypes { get; set; } = new List<PopoverCollision>() {
8294
PopoverCollision.Fit,
8395
PopoverCollision.Flip
8496
};

0 commit comments

Comments
 (0)