|
6 | 6 |
|
7 | 7 | <h1>Blazor Offcanvas</h1>
|
8 | 8 | <div class="lead mb-3">
|
9 |
| - Build hidden sidebars into your project for navigation, shopping carts, and more with a offcanvas component. |
| 9 | + Build hidden sidebars into your project for navigation, shopping carts, and more with a offcanvas component. |
10 | 10 | </div>
|
11 | 11 |
|
12 | 12 | <CarbonAds />
|
|
19 | 19 | <SectionHeading Size="HeadingSize.H2" Text="Dynamic component as offcanvas" PageUrl="@pageUrl" HashTagName="dynamic-component-as-offcanvas" />
|
20 | 20 | <div class="mb-3">Render different components dynamically within the offcanvas without iterating through possible types or using conditional logic.</div>
|
21 | 21 | <div class="mb-3">
|
22 |
| - If dynamically-rendered components have component parameters, pass them as an <code>IDictionary</code>. The <code>string</code> is the parameter's name, and the <code>object</code> is the parameter's value. |
| 22 | + If dynamically-rendered components have component parameters, pass them as an <code>IDictionary</code>. The <code>string</code> is the parameter's name, and the <code>object</code> is the parameter's value. |
23 | 23 | </div>
|
24 | 24 | <Demo Type="typeof(Offcanvas_Demo_02_A_Show_Dynamic_Component)" />
|
25 | 25 | <b>EmployeeDemoComponent1.razor</b>
|
|
28 | 28 | <SectionHeading Size="HeadingSize.H2" Text="Pass event callbacks to a dynamic component" PageUrl="@pageUrl" HashTagName="pass-event-callbacks-to-a-dynamic-component" />
|
29 | 29 | <div class="mb-3">Event callbacks <code>(EventCallback)</code> can be passed in its parameter dictionary.</div>
|
30 | 30 | <div class="mb-3">
|
31 |
| - In the following parent component example, the <code>ShowDTMessage</code> method assigns a string with the current time to <code>message</code>, and the value of <code>message</code> is rendered. |
32 |
| - The parent component passes the callback method, ShowDTMessage in the parameter dictionary: |
33 |
| - <ul style="disc"> |
34 |
| - <li>The <code>string</code> key is the callback method's name, <code>OnClickCallback</code>.</li> |
35 |
| - <li>The <code>object</code> value is created by <code>EventCallbackFactory.Create</code> for the parent callback method, <code>ShowDTMessage</code>.</li> |
36 |
| - </ul> |
| 31 | + In the following parent component example, the <code>ShowDTMessage</code> method assigns a string with the current time to <code>message</code>, and the value of <code>message</code> is rendered. |
| 32 | + The parent component passes the callback method, ShowDTMessage in the parameter dictionary: |
| 33 | + <ul style="disc"> |
| 34 | + <li>The <code>string</code> key is the callback method's name, <code>OnClickCallback</code>.</li> |
| 35 | + <li>The <code>object</code> value is created by <code>EventCallbackFactory.Create</code> for the parent callback method, <code>ShowDTMessage</code>.</li> |
| 36 | + </ul> |
37 | 37 | </div>
|
38 | 38 | <Demo Type="typeof(Offcanvas_Demo_02_B_Pass_Event_Callback_to_a_Dynamic_Component)" />
|
39 | 39 | <b>EmployeeDemoComponent2.razor</b>
|
|
45 | 45 |
|
46 | 46 | <Callout Type="CalloutColor.Info">Default placement for the offcanvas component is right.</Callout>
|
47 | 47 |
|
48 |
| -<SectionHeading Size="HeadingSize.H2" Text="Static backdrop" PageUrl="@pageUrl" HashTagName="static-backdrop" /> |
49 |
| -<div class="mb-3">When <b>UseStaticBackdrop</b> is set to <b>true</b>, the offcanvas will not close when clicking outside of it.</div> |
50 |
| -<Demo Type="typeof(Offcanvas_Demo_04_Static_Backdrop)" Tabs="true" /> |
| 48 | +<SectionHeading Size="HeadingSize.H2" Text="Backdrop options" PageUrl="@pageUrl" HashTagName="backdrops" /> |
| 49 | +<div class="mb-3">When <b>Backdrop</b> is set to <b>Offcanvas.BackdropType.Static</b>, the offcanvas will not close when clicking outside of it.</div> |
| 50 | +<Demo Type="typeof(Offcanvas_Demo_04_Backdrops)" Tabs="true" /> |
51 | 51 |
|
52 | 52 | <SectionHeading Size="HeadingSize.H2" Text="Sizes" PageUrl="@pageUrl" HashTagName="sizes" />
|
53 | 53 | <div class="mb-3">Set the size of the <code>Offcanvas</code> with the Size parameter. The default value is <code>OffcanvasSize.Regular</code>.</div>
|
|
58 | 58 | <div class="mb-3">Blazor Bootstrap offcanvas component exposes a few events for hooking into offcanvas functionality.</div>
|
59 | 59 | <Demo Type="typeof(Offcanvas_Demo_06_Events)" Tabs="true" />
|
60 | 60 |
|
| 61 | +<SectionHeading Size="HeadingSize.H2" Text="Scrollable" PageUrl="@pageUrl" HashTagName="static-backdrop" /> |
| 62 | +<div class="mb-3">When <b>IsScrollable</b> to <b>true</b> the page will be scrollable and interactable below the offcanvas backdrop.</div> |
| 63 | +<div class="mb-3"> |
| 64 | + <Alert Color="AlertColor.Warning">Note: This demo does not work because the main viewport has <code>overflow: hidden</code> set in the CSS.</Alert> |
| 65 | +</div> |
| 66 | +<Demo Type="typeof(Offcanvas_Demo_07_Scrollable)" Tabs="true" /> |
| 67 | + |
| 68 | +<SectionHeading Size="HeadingSize.H2" Text="Bind IsVisible" PageUrl="@pageUrl" HashTagName="static-backdrop" /> |
| 69 | +<div class="mb-3">You can read <code>IsVisible</code> to get the current status and use <code>@@bind-IsVisible</code> to toggle the offcanvas with a switch.</div> |
| 70 | +<Demo Type="typeof(Offcanvas_Demo_08_Bind_IsVisible)" Tabs="true" /> |
| 71 | + |
| 72 | + |
61 | 73 | @code {
|
62 |
| - private string pageUrl = "/offcanvas"; |
63 |
| - private string title = "Blazor Offcanvas Component"; |
64 |
| - private string description = "Build hidden sidebars into your project for navigation, shopping carts, and more with Blazor Bootstrap offcanvas component."; |
65 |
| - private string imageUrl = "https://i.imgur.com/1vNz5Ci.jpg"; |
| 74 | + private string pageUrl = "/offcanvas"; |
| 75 | + private string title = "Blazor Offcanvas Component"; |
| 76 | + private string description = "Build hidden sidebars into your project for navigation, shopping carts, and more with Blazor Bootstrap offcanvas component."; |
| 77 | + private string imageUrl = "https://i.imgur.com/1vNz5Ci.jpg"; |
66 | 78 | }
|
0 commit comments