|
1 | | -@page "/accordion" |
| 1 | +@attribute [Route(pageUrl)] |
2 | 2 |
|
3 | | -<PageTitle>@title</PageTitle> |
| 3 | +<PageMetaTags PageUrl="@pageUrl" Title="@metaTitle" Description="@metaDescription" ImageUrl="@imageUrl" /> |
4 | 4 |
|
5 | | -<MetaTags PageUrl="@pageUrl" Title="@title" Description="@description" ImageUrl="@imageUrl" /> |
6 | | - |
7 | | -<h1>Blazor Accordion</h1> |
8 | | -<div class="lead mb-3"> |
9 | | - Build vertically collapsing accordions in combination with our Collapse component. |
10 | | -</div> |
| 5 | +<PageHero Heading="@pageTitle"> |
| 6 | + <LeadSection>@pageDescription</LeadSection> |
| 7 | +</PageHero> |
11 | 8 |
|
12 | 9 | <CarbonAds /> |
13 | 10 |
|
14 | | -<SectionHeading Size="HeadingSize.H2" Text="How it works" PageUrl="@pageUrl" HashTagName="how-it-works" /> |
15 | | -<div class="mb-3"> |
16 | | - The <code>Accordion</code> component uses the <code>Collapse</code> component internally to make it collapsible. |
17 | | -</div> |
| 11 | +<Section Class="p-0" Size="HeadingSize.H2" Name="How it works" PageUrl="@pageUrl" Link="how-it-works"> |
| 12 | + <div class="mb-3"> |
| 13 | + The <code>Accordion</code> component uses the <code>Collapse</code> component internally to make it collapsible. |
| 14 | + </div> |
| 15 | +</Section> |
18 | 16 |
|
19 | 17 | <Callout Color="CalloutColor.Info"> |
20 | 18 | The animation effect of this component is dependent on the <code>prefers-reduced-motion</code> media query. <br /> |
21 | 19 | See the <a href="https://getbootstrap.com/docs/5.3/getting-started/accessibility/#reduced-motion" target="_blank">reduced motion section of our accessibility documentation</a>. |
22 | 20 | </Callout> |
23 | 21 |
|
24 | | -<SectionHeading Size="HeadingSize.H2" Text="Examples" PageUrl="@pageUrl" HashTagName="examples" /> |
25 | | -<div class="mb-3"> |
26 | | - Click the accordions below to expand/collapse the accordion content. |
27 | | -</div> |
28 | | -<Demo Type="typeof(Accordion_Demo_01_Examples)" Tabs="false" /> |
| 22 | +<Section Class="p-0" Size="HeadingSize.H2" Name="Examples" PageUrl="@pageUrl" Link="examples"> |
| 23 | + <div class="mb-3"> |
| 24 | + Click the accordions below to expand/collapse the accordion content. |
| 25 | + </div> |
| 26 | + <Demo Type="typeof(Accordion_Demo_01_Examples)" Tabs="false" /> |
| 27 | +</Section> |
29 | 28 |
|
30 | | -<SectionHeading Size="HeadingSize.H2" Text="Title with Icon" PageUrl="@pageUrl" HashTagName="title-with-icon" /> |
31 | | -<div class="mb-3"> |
32 | | - To customize the accordion title, use <code>TitleTemplate</code>, as shown in the below example. |
33 | | -</div> |
34 | | -<Demo Type="typeof(Accordion_Demo_02_Title_with_Icon)" Tabs="false" /> |
| 29 | +<Section Class="p-0" Size="HeadingSize.H2" Name="Title with Icon" PageUrl="@pageUrl" Link="title-with-icon"> |
| 30 | + <div class="mb-3"> |
| 31 | + To customize the accordion title, use <code>TitleTemplate</code>, as shown in the below example. |
| 32 | + </div> |
| 33 | + <Demo Type="typeof(Accordion_Demo_02_Title_with_Icon)" Tabs="false" /> |
| 34 | +</Section> |
35 | 35 |
|
36 | | -<SectionHeading Size="HeadingSize.H2" Text="Flush" PageUrl="@pageUrl" HashTagName="flush" /> |
37 | | -<div class="mb-3"> |
38 | | - Set the <code>Flush</code> parameter to <code>true</code> to remove borders and rounded corners to render accordions edge-to-edge with their parent container. |
39 | | -</div> |
40 | | -<Demo Type="typeof(Accordion_Demo_03_Flush)" Tabs="true" /> |
| 36 | +<Section Size="HeadingSize.H2" Name="Flush" PageUrl="@pageUrl" Link="flush"> |
| 37 | + <div class="mb-3"> |
| 38 | + Set the <code>Flush</code> parameter to <code>true</code> to remove borders and rounded corners to render accordions edge-to-edge with their parent container. |
| 39 | + </div> |
| 40 | + <Demo Type="typeof(Accordion_Demo_03_Flush)" Tabs="true" /> |
| 41 | +</Section> |
41 | 42 |
|
42 | | -<SectionHeading Size="HeadingSize.H2" Text="Set default active accordion item" PageUrl="@pageUrl" HashTagName="set-default-active-accordion-item" /> |
43 | | -<div class="mb-3"> |
44 | | - Set the <code>Active</code> parameter to <code>true</code> to keep the accordion item open by default. |
45 | | -</div> |
46 | | -<Demo Type="typeof(Accordion_Demo_04_Set_Default_Active)" Tabs="true" /> |
| 43 | +<Section Size="HeadingSize.H2" Name="Set default active accordion item" PageUrl="@pageUrl" Link="set-default-active-accordion-item"> |
| 44 | + <div class="mb-3"> |
| 45 | + Set the <code>Active</code> parameter to <code>true</code> to keep the accordion item open by default. |
| 46 | + </div> |
| 47 | + <Demo Type="typeof(Accordion_Demo_04_Set_Default_Active)" Tabs="true" /> |
| 48 | +</Section> |
47 | 49 |
|
48 | | -<SectionHeading Size="HeadingSize.H2" Text="Always open" PageUrl="@pageUrl" HashTagName="always-open" /> |
49 | | -<div class="mb-3"> |
50 | | - Set the <code>AlwaysOpen</code> parameter to <code>true</code> to keep accordion items open when another item is opened. |
51 | | -</div> |
52 | | -<Demo Type="typeof(Accordion_Demo_05_Always_Open)" Tabs="true" /> |
| 50 | +<Section Size="HeadingSize.H2" Name="Always open" PageUrl="@pageUrl" Link="always-open"> |
| 51 | + <div class="mb-3"> |
| 52 | + Set the <code>AlwaysOpen</code> parameter to <code>true</code> to keep accordion items open when another item is opened. |
| 53 | + </div> |
| 54 | + <Demo Type="typeof(Accordion_Demo_05_Always_Open)" Tabs="true" /> |
| 55 | +</Section> |
53 | 56 |
|
54 | | -<SectionHeading Size="HeadingSize.H2" Text="Show / hide individual accordion items" PageUrl="@pageUrl" HashTagName="show-hide-individual-accordion-items" /> |
55 | | -<div class="mb-3"> |
56 | | - You can show and hide individual accordion items in several ways. |
57 | | - <ul> |
58 | | - <li>To show an accordion item, use predefined methods <code>ShowFirstAccordionItemAsync</code>, <code>ShowLastAccordionItemAsync</code>, <code>ShowAccordionItemByNameAsync</code>, and <code>ShowAccordionItemByIndexAsync</code>.</li> |
59 | | - <li>To hide an accordion item, use predefined methods <code>HideFirstAccordionItemAsync</code>, <code>HideLastAccordionItemAsync</code>, <code>HideAccordionItemByNameAsync</code>, and <code>HideAccordionItemByIndexAsync</code>.</li> |
60 | | - </ul> |
61 | | -</div> |
62 | | -<Demo Type="typeof(Accordion_Demo_06_Show_Hide_Individual_AccordionItems)" Tabs="true" /> |
| 57 | +<Section Size="HeadingSize.H2" Name="Show / hide individual accordion items" PageUrl="@pageUrl" Link="show-hide-individual-accordion-items"> |
| 58 | + <div class="mb-3"> |
| 59 | + You can show and hide individual accordion items in several ways. |
| 60 | + <ul> |
| 61 | + <li>To show an accordion item, use predefined methods <code>ShowFirstAccordionItemAsync</code>, <code>ShowLastAccordionItemAsync</code>, <code>ShowAccordionItemByNameAsync</code>, and <code>ShowAccordionItemByIndexAsync</code>.</li> |
| 62 | + <li>To hide an accordion item, use predefined methods <code>HideFirstAccordionItemAsync</code>, <code>HideLastAccordionItemAsync</code>, <code>HideAccordionItemByNameAsync</code>, and <code>HideAccordionItemByIndexAsync</code>.</li> |
| 63 | + </ul> |
| 64 | + </div> |
| 65 | + <Demo Type="typeof(Accordion_Demo_06_Show_Hide_Individual_AccordionItems)" Tabs="true" /> |
| 66 | +</Section> |
63 | 67 |
|
64 | | -<SectionHeading Size="HeadingSize.H2" Text="Show / hide all accordion items" PageUrl="@pageUrl" HashTagName="show-hide-all-accordion-items" /> |
65 | | -<div class="mb-3"> |
66 | | - When the <code>AlwaysOpen</code> parameter is set to <code>true</code>, you can show all accordion items simultaneously using the <code>ShowAllAccordionItemsAsync</code> method. |
| 68 | +<Section Size="HeadingSize.H2" Name="Show / hide all accordion items" PageUrl="@pageUrl" Link="show-hide-all-accordion-items"> |
| 69 | + <div class="mb-3"> |
| 70 | + When the <code>AlwaysOpen</code> parameter is set to <code>true</code>, you can show all accordion items simultaneously using the <code>ShowAllAccordionItemsAsync</code> method. |
67 | 71 | The <code>HideAllAccordionItemsAsync</code> method will hide all accordion items, regardless of the value of <code>AlwaysOpen</code>. |
68 | | -</div> |
69 | | -<Demo Type="typeof(Accordion_Demo_07_Show_Hide_All_AccordionItems)" Tabs="true" /> |
| 72 | + </div> |
| 73 | + <Demo Type="typeof(Accordion_Demo_07_Show_Hide_All_AccordionItems)" Tabs="true" /> |
| 74 | +</Section> |
70 | 75 |
|
71 | | -<SectionHeading Size="HeadingSize.H2" Text="Events" PageUrl="@pageUrl" HashTagName="events" /> |
72 | | -<div class="mb-3"> |
73 | | - Blazor Bootstrap Accordion component exposes a few events for hooking into accordion functionality. |
74 | | - <table class="table"> |
75 | | - <thead> |
76 | | - <tr> |
77 | | - <th scope="col">Event Name</th> |
78 | | - <th scope="col">Description</th> |
79 | | - </tr> |
80 | | - </thead> |
81 | | - <tbody class="table-group-divider"> |
82 | | - <tr> |
83 | | - <th scope="row"><code>OnHiding</code></th> |
84 | | - <td>This event is fired immediately when the <code>hide</code> method has been called.</td> |
85 | | - </tr> |
86 | | - <tr> |
87 | | - <th scope="row"><code>OnHidden</code></th> |
88 | | - <td>This event is fired when a accordion item has been hidden from the user (will wait for CSS transitions to complete).</td> |
89 | | - </tr> |
90 | | - <tr> |
91 | | - <th scope="row"><code>OnShowing</code></th> |
92 | | - <td>This event fires immediately when the <code>show</code> method is called.</td> |
93 | | - </tr> |
94 | | - <tr> |
95 | | - <th scope="row"><code>OnShown</code></th> |
96 | | - <td>This event is fired when a accordion item has been made visible to the user (will wait for CSS transitions to complete).</td> |
97 | | - </tr> |
98 | | - </tbody> |
99 | | - </table> |
100 | | - <Callout Type="CalloutColor.Info"> |
101 | | - If no accordion item is active, then the <code>OnHiding</code> and <code>OnHidden</code> events will not be fired. |
102 | | - </Callout> |
103 | | -</div> |
104 | | -<Demo Type="typeof(Accordion_Demo_08_Events)" Tabs="true" /> |
| 76 | +<Section Size="HeadingSize.H2" Name="Events" PageUrl="@pageUrl" Link="events"> |
| 77 | + <div class="mb-3"> |
| 78 | + Blazor Bootstrap Accordion component exposes a few events for hooking into accordion functionality. |
| 79 | + <table class="table"> |
| 80 | + <thead> |
| 81 | + <tr> |
| 82 | + <th scope="col">Event Name</th> |
| 83 | + <th scope="col">Description</th> |
| 84 | + </tr> |
| 85 | + </thead> |
| 86 | + <tbody class="table-group-divider"> |
| 87 | + <tr> |
| 88 | + <th scope="row"><code>OnHiding</code></th> |
| 89 | + <td>This event is fired immediately when the <code>hide</code> method has been called.</td> |
| 90 | + </tr> |
| 91 | + <tr> |
| 92 | + <th scope="row"><code>OnHidden</code></th> |
| 93 | + <td>This event is fired when a accordion item has been hidden from the user (will wait for CSS transitions to complete).</td> |
| 94 | + </tr> |
| 95 | + <tr> |
| 96 | + <th scope="row"><code>OnShowing</code></th> |
| 97 | + <td>This event fires immediately when the <code>show</code> method is called.</td> |
| 98 | + </tr> |
| 99 | + <tr> |
| 100 | + <th scope="row"><code>OnShown</code></th> |
| 101 | + <td>This event is fired when a accordion item has been made visible to the user (will wait for CSS transitions to complete).</td> |
| 102 | + </tr> |
| 103 | + </tbody> |
| 104 | + </table> |
| 105 | + <Callout Type="CalloutColor.Info"> |
| 106 | + If no accordion item is active, then the <code>OnHiding</code> and <code>OnHidden</code> events will not be fired. |
| 107 | + </Callout> |
| 108 | + </div> |
| 109 | + <Demo Type="typeof(Accordion_Demo_08_Events)" Tabs="true" /> |
| 110 | +</Section> |
105 | 111 |
|
106 | 112 | @code { |
107 | | - private string pageUrl = "/accordion"; |
108 | | - private string title = "Blazor Accordion Component"; |
109 | | - private string description = "Build vertically collapsing accordions in combination with our Collapse component."; |
110 | | - private string imageUrl = "https://i.imgur.com/g4zpMXp.png"; |
| 113 | + private const string pageUrl = "/accordion"; |
| 114 | + private const string pageTitle = "Blazor Accordion"; |
| 115 | + private const string pageDescription = "Build vertically collapsing accordions in combination with our Collapse component."; |
| 116 | + private const string metaTitle = "Blazor Accordion Component"; |
| 117 | + private const string metaDescription = "Build vertically collapsing accordions in combination with our Collapse component."; |
| 118 | + private const string imageUrl = "https://i.imgur.com/g4zpMXp.png"; |
111 | 119 | } |
0 commit comments