ant-design-blazor/components/select/SelectOption.razor
James Yeung 1b8a9c3a93
fix(module: select): DropdownRender doesn't pass original content into renderfargment (#3675)
* fix(module: select): dropdown render doesn't pass original content into renderfargment

* fix select box width

* fix aria-label
2024-02-08 12:58:16 +08:00

39 lines
1.1 KiB
C#

@using AntDesign.Select.Internal
@namespace AntDesign
@inherits AntDomComponentBase
@typeparam TItemValue
@typeparam TItem
<div @ref="Ref"
@key="@this"
class="@ClassMapper.Class"
role="option"
aria-selected="@IsSelected"
aria-label="@InternalLabel"
style="@InnerStyle"
@onclick="@OnClick"
@onmouseenter="@OnMouseEnter">
<div class="@ClassPrefix-content">
@if (ItemTemplate != null)
{
@ItemTemplate(Model.Item)
}
else
{
@InternalLabel
}
</div>
@switch (SelectParent.SelectMode)
{
case SelectMode.Default:
<span class="@ClassPrefix-state" unselectable="on" aria-hidden="true" style="user-select: none;"></span>
break;
default:
if (IsSelected)
{
<span unselectable="on" aria-hidden="true" style="user-select: none;" class="@ClassPrefix-state">
<Icon Type="check"></Icon>
</span>
}
break;
}
</div>