-
Notifications
You must be signed in to change notification settings - Fork 81
kb(window): Revamp Minimize Window KB and create a new example #2720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5661677
kb(window): Revamp Minimize Window KB and create a new example
dimodi 33007bc
Update knowledge-base/window-modal-minimize-popup.md
dimodi cea11fe
Update knowledge-base/window-modal-minimize-popup.md
dimodi 14f5c51
Update knowledge-base/window-modal-minimize-popup.md
dimodi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,120 +1,131 @@ | ||
| --- | ||
| title: How to minimize a popup window to the bottom of the page? | ||
| description: Is there any way to collapse a window to the bottom of a page and how to create a responsive modal that can be minimized? | ||
| title: Minimize a Window to the Bottom Right of the Page | ||
| description: Learn how to to collapse a Window to the bottom of a page and create a responsive popup that is a chat bubble? | ||
| type: how-to | ||
| page_title: How to minimize a popup window to the bottom of the page? | ||
| page_title: How to Minimize a Popup Window to the Bottom Right of the Page | ||
| slug: window-modal-minimize-popup | ||
| position: | ||
| tags: window,modal,popup,collapse,minimize | ||
| ticketid: 1542823 | ||
| tags: blazor, window, minimize | ||
| ticketid: 1542823, 1676477 | ||
| res_type: kb | ||
| --- | ||
|
|
||
| ## Environment | ||
|
|
||
| <table> | ||
| <tbody> | ||
| <tr> | ||
| <td>Product</td> | ||
| <td>Window for Blazor</td> | ||
| </tr> | ||
| </tbody> | ||
| <tbody> | ||
| <tr> | ||
| <td>Product</td> | ||
| <td>Window for Blazor</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
|
|
||
|
|
||
| ## Description | ||
| Is there any way to collapse a window to the bottom of a page? How to create a responsive modal that can be minimized? How to minimize Modal Window as a chat for messages? | ||
|
|
||
| ## Solution | ||
| To implement a responsible popup that can be minimized to the bottom of the page: | ||
|
|
||
| 1. Set the `Top` and `Left` parameters to control the position of the modal. | ||
| 2. Use boolean flags to show and hide the popup. | ||
| 3. Use the [MediaQuery](slug://mediaquery-overview) component to make the modal window responsive. | ||
| This KB article answers the following questions: | ||
|
|
||
| >caption The result from the code snippet below on a big screen. | ||
| * How to minimize the Telerik Window for Blazor to the bottom right? | ||
| * How to collapse a Window to the bottom of a page? | ||
| * How to create a responsive modal Window that can be minimized? | ||
| * How to minimize a modal Window as a chat for messages? | ||
|
|
||
|  | ||
| ## Solution | ||
|
|
||
| >caption The result from the code snippet below on a small screen. | ||
| ### Minimize Window to the Bottom Right | ||
|
|
||
|  | ||
| To minimize the Window at the bottom-right corner of the viewport: | ||
dimodi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ````Razor | ||
| @*Responsive minimizable popup.*@ | ||
| 1. Set a custom CSS class to the Window with the `Class` parameter, for example, `minimized-at-bottom`. | ||
| 1. Apply the following styles to the `.k-window-minimized.minimized-at-bottom` CSS combinator: | ||
| * `top` and `left` must be `auto !important` | ||
| * `bottom` and `right` must be zero or an arbitrary some small value | ||
dimodi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * `transform` must be `none` | ||
|
|
||
| <TelerikMediaQuery Media="(max-width: 960px)" OnChange="((changed) => Small = changed)"></TelerikMediaQuery> | ||
| ````RAZOR | ||
| <TelerikButton OnClick="@( () => WindowVisible = !WindowVisible )">Toggle Window</TelerikButton> | ||
| <TelerikWindow Class="@myClass" Modal="@isModal" | ||
| Top="@TopPosition" | ||
| Left="@LeftPosition" | ||
| @bind-Visible="@isModalVisible"> | ||
| <TelerikWindow @bind-Visible="@WindowVisible" | ||
| Class="minimized-at-bottom"> | ||
| <WindowActions> | ||
| <WindowAction Name="Minimize" /> | ||
| <WindowAction Name="Close" /> | ||
| </WindowActions> | ||
| <WindowTitle> | ||
| <strong>@Title</strong> | ||
| Window Title | ||
| </WindowTitle> | ||
| <WindowContent> | ||
| @if (isModal) | ||
| { | ||
| @Content | ||
| } | ||
| Window Content | ||
| </WindowContent> | ||
| </TelerikWindow> | ||
| <style> | ||
| .k-window-minimized.minimized-at-bottom { | ||
| top: auto !important; | ||
| left: auto !important; | ||
| bottom: 1em; | ||
| right: 1em; | ||
| transform: none; | ||
| } | ||
| </style> | ||
| @code { | ||
| private bool WindowVisible { get; set; } = true; | ||
| } | ||
| ```` | ||
|
|
||
| ### Create Responsive Chat Window | ||
|
|
||
| To configure a responsive popup Window that transforms to a chat bubble on small screens: | ||
|
|
||
| 1. Use the [MediaQuery component](slug://mediaquery-overview) to make the Window responsive and change its configuration, depending on the browser viewport size. | ||
| 1. Use custom CSS classes and styles to tweak the Window appearance and make it look like a bubble when minimized. | ||
|
|
||
| ````RAZOR | ||
| <TelerikMediaQuery Media="(max-width: 960px)" | ||
| OnChange="@( (bool matches) => IsSmallScreen = matches )" /> | ||
| <TelerikWindow Class="@WindowClass" | ||
| MinWidth="140px" | ||
| @bind-State="@WindowState" | ||
| ThemeColor="@ThemeConstants.Window.ThemeColor.Primary" | ||
| Visible="true"> | ||
| <WindowTitle>@WindowTitle</WindowTitle> | ||
| <WindowContent> | ||
| <p>The Window title changes, depending on the browser viewport size.</p> | ||
| <p>Reduce the browser width and minimize the Window to minimize it as a chart bubble at the bottom-right.</p> | ||
| </WindowContent> | ||
| <WindowActions> | ||
| <WindowAction Name="MyMinimizer" Hidden="@(!isModal)" Icon="@SvgIcon.WindowMinimize" OnClick="@MyCustomMinimize" /> | ||
| <WindowAction Name="MyExpander" Hidden="@isModal" Icon="@SvgIcon.Window" OnClick="@MyCustomExpand" /> | ||
| <WindowAction Name="Minimize" /> | ||
| </WindowActions> | ||
| </TelerikWindow> | ||
| @code { | ||
| bool isModalVisible { get; set; } = true; | ||
| bool isModal { get; set; } = true; | ||
| private bool Small { get; set; } | ||
| string Title => Small == true && !isModal ? "M" : "My Responsive Popup"; | ||
| string Content = "---------- Welcome to our Minimized/Collapsed popup! ----------"; | ||
| string TopPosition => Small == true && !isModal ? "100px" : Top; | ||
| string LeftPosition => Small == true && !isModal ? "300px" : Left; | ||
| string Top = "40%"; | ||
| string Left = "40%"; | ||
| string myClass => Small == true && !isModal ? "minimized" : ""; | ||
| public void MyCustomMinimize() | ||
| { | ||
| Top = "90%"; | ||
| Left = "15%"; | ||
| isModal = false; | ||
| StateHasChanged(); | ||
| <style> | ||
| .k-window-minimized.minimized-at-bottom { | ||
| top: auto !important; | ||
| left: auto !important; | ||
| bottom: 1em; | ||
| right: 1em; | ||
| transform: none; | ||
| } | ||
| public void MyCustomExpand() | ||
| { | ||
| Top = "40%"; | ||
| Left = "40%"; | ||
| isModal = true; | ||
| StateHasChanged(); | ||
| .chat-bubble-window { | ||
| min-height: auto !important; | ||
| padding: var(--kendo-spacing-4); | ||
| border-radius: var(--kendo-border-radius-full); | ||
| background-color: var(--kendo-color-primary); | ||
| color: var(--kendo-color-on-primary); | ||
| } | ||
| } | ||
| </style> | ||
| @code { | ||
| private string WindowClass => IsSmallScreen && WindowState == WindowState.Minimized ? "minimized-at-bottom chat-bubble-window" : ""; | ||
| private WindowState WindowState { get; set; } = WindowState.Default; | ||
| private string WindowTitle => IsSmallScreen ? "Chat" : "Customer Support Chat"; | ||
| @if (!isModal) | ||
| { | ||
| <style> | ||
| .k-window-content:last-child { | ||
| display: none; | ||
| } | ||
| .k-window-titlebar { | ||
| border-style: none; | ||
| } | ||
| .minimized { | ||
| background-color: #ff6358; | ||
| color: white; | ||
| display: inline; | ||
| padding: 14px; | ||
| border-bottom-left-radius: 65%; | ||
| border-bottom-right-radius: 65%; | ||
| border-top-left-radius: 65%; | ||
| border-top-right-radius: 65%; | ||
| } | ||
| </style> | ||
| private bool IsSmallScreen { get; set; } | ||
| } | ||
| ```` | ||
|
|
||
| ## See Also | ||
|
|
||
| * [Window Position](slug://components/window/position) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.