
Collapse
The content area is contained by the collapsed panel
Multiple panels can be expanded at the same time, with no effect between panels
Demo
Only one panel can be expanded at a time
Demo
Each panel sets a different color
Demo
The CollapseItems
is set by conditional logic
Demo
Show icon in header
Demo
Attributes
@page "/collapses"
@inject IStringLocalizer<Collapses> Localizer
<h3>Collapse</h3>
<h4>The content area is contained by the collapsed panel</h4>
<DemoBlock Title="Basic usage" Introduction="Multiple panels can be expanded at the same time, with no effect between panels" Name="Normal" Demo="typeof(Demos.Collapse.CollapseNormal)" />
<DemoBlock Title="Accordion effect" Introduction="Only one panel can be expanded at a time" Name="Accordion" Demo="typeof(Demos.Collapse.CollapseAccordion)" />
<DemoBlock Title="The child title color" Introduction="Each panel sets a different color" Name="Color" Demo="typeof(Demos.Collapse.CollapseColor)" />
<DemoBlock Title="Dynamic updates" Introduction="The <code>CollapseItems</code> is set by conditional logic" Name="Items" Demo="typeof(Demos.Collapse.CollapseItems)" />
<DemoBlock Title="Icon" Introduction="Show icon in header" Name="Icon" Demo="typeof(Demos.Collapse.CollapseIcon)" />
<AttributeTable Items="@GetAttributes()" />
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/
namespace BootstrapBlazor.Shared.Samples;
/// <summary>
/// Collapses
/// </summary>
public sealed partial class Collapses
{
/// <summary>
/// 获得属性方法
/// </summary>
/// <returns></returns>
private IEnumerable<AttributeItem> GetAttributes() => new AttributeItem[]
{
// TODO: 移动到数据库中
new AttributeItem() {
Name = "CollapseItems",
Description = Localizer["CollapseItems"],
Type = "RenderFragment",
ValueList = " — ",
DefaultValue = " — "
},
new AttributeItem() {
Name = "IsAccordion",
Description = Localizer["IsAccordion"],
Type = "bool",
ValueList = "true|false",
DefaultValue = "false"
},
new AttributeItem() {
Name = "OnCollapseChanged",
Description = Localizer["OnCollapseChanged"],
Type = "Func<CollapseItem, Task>",
ValueList = " — ",
DefaultValue = " — "
}
};
}