ant-design-blazor/components/segmented/Segmented.razor
James Yeung e892f343de
feat(module: segmented): add new component segmented (#2503)
* add basic segmented

* add more demos

* add animation

* change value first

* fix duplicate selected

* fix doc
2022-06-25 20:56:51 +08:00

32 lines
958 B
C#

@namespace AntDesign
@inherits AntDomComponentBase
@typeparam TValue
<div class="@ClassMapper.Class" style="@Style" @ref="@Ref" id="@Id">
<div class="ant-segmented-group">
@if (_sliding)
{
<div class="@_slidingCls" style="@_slidingStyle"></div>
}
<CascadingValue Value="this" IsFixed>
@if (ChildContent != null)
{
@ChildContent
}
else if (Options?.Any() == true)
{
@foreach (var option in Options)
{
<SegmentedItem TValue="TValue" Label="@option.Label" Value="@option.Value" @key="option.Value" Disabled="@(option.Disabled || Disabled)"></SegmentedItem>
}
}
else if (Labels?.Any() == true)
{
@foreach (var label in Labels)
{
<SegmentedItem TValue="TValue" Label="@label.ToString()" Value="@label" @key="label" Disabled="Disabled"></SegmentedItem>
}
}
</CascadingValue>
</div>
</div>