Skip to content

Commit f5b1d44

Browse files
docs(animationContainer): breaking change in controlling visibility
1 parent 629b4f2 commit f5b1d44

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

components/animationcontainer/overview.md

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,25 @@ To use the animation container, add the `TelerikAnimationContainer` tag.
2121
@using Telerik.Blazor.Components.Button
2222
@using Telerik.Blazor
2323
24-
<TelerikAnimationContainer Top="300px" Width="100px" Height="100px" Visible="@Shown" AnimationType="AnimationType.ZoomOut" Class="k-popup">
24+
<TelerikAnimationContainer @ref="myPopupRef" Top="300px" Width="100px" Height="100px" AnimationType="AnimationType.ZoomOut" Class="k-popup">
2525
My content goes here. The "k-popup" class adds some background and borders which you can define through your own styles instead.
2626
</TelerikAnimationContainer>
2727
2828
<TelerikButton OnClick="@ToggleContainer">Toggle Animation Container</TelerikButton>
2929
3030
@code {
31-
public bool Shown { get; set; } = false;
31+
Telerik.Blazor.Components.AnimationContainer.TelerikAnimationContainer myPopupRef;
3232
3333
public void ToggleContainer()
3434
{
35-
Shown = !Shown;
36-
StateHasChanged();
35+
myPopupRef.Toggle();
3736
}
3837
}
3938
````
4039

41-
The animation container exposes the following properties:
40+
The animation container exposes the following properties and methods:
4241

43-
* `Visible` - to control whether the container is shown.
42+
* `Show()`, `Hide()` and `Toggle()` - to control whether the container is shown.
4443
* `Width` and `Height` - to control its size.
4544
* `Top` and `Left` - to control its offset from its parent with special positioning (`relative`, `absolute`, `fixed`).
4645
* `AnimationType` and `AnimationDuration` to control the way it is shown and hidden. The animation duration is in milliseconds (defaults to `300`), and the type is of the `Telerik.Blazor.AnimationType` enum with the following options:
@@ -61,13 +60,14 @@ The animation container exposes the following properties:
6160

6261
>caption Explore the animation options
6362
64-
````
63+
````CSHTML
6564
@using Telerik.Blazor.Components.AnimationContainer
6665
@using Telerik.Blazor.Components.Button
6766
@using Telerik.Blazor
6867
69-
<TelerikAnimationContainer Top="300px" Width="100px" Height="100px" Visible="@Shown" AnimationType="@AnimType" Class="my-popup">
70-
My content goes here.
68+
<TelerikAnimationContainer @ref="myPopup" Top="300px" Width="200px" Height="200px" AnimationType="@AnimType" Class="my-popup">
69+
My content goes here.<br />
70+
<TelerikButton OnClick="@HideContainer">Hide Animation Container</TelerikButton>
7171
</TelerikAnimationContainer>
7272
7373
<select @bind="AnimType">
@@ -77,15 +77,20 @@ The animation container exposes the following properties:
7777
}
7878
</select>
7979
80-
<TelerikButton OnClick="@ToggleContainer">Toggle Animation Container</TelerikButton>
80+
<TelerikButton OnClick="@ShowContainer">Show Animation Container</TelerikButton>
8181
8282
@code {
83-
public bool Shown { get; set; } = false;
83+
TelerikAnimationContainer myPopup;
8484
public AnimationType AnimType { get; set; } = AnimationType.Fade;
85-
public void ToggleContainer()
85+
86+
public void ShowContainer()
87+
{
88+
myPopup.Show();
89+
}
90+
91+
public void HideContainer()
8692
{
87-
Shown = !Shown;
88-
StateHasChanged();
93+
myPopup.Hide();
8994
}
9095
}
9196

0 commit comments

Comments
 (0)