ant-design-blazor/components/switch/Switch.razor
Andrzej Bakun 555fdb9a43 fix(module: checkbox & switch): Checked parameter binding (#1394)
* fix(module:checkbox): allow binding to Checked parameter

* fix(module:switch): allow binding to Checked parameter

* fix(modules): checkbox & switch get AntInputBoolComponentBase class

* test(module:switch): add tests

* test(module:checkbox): add tests

* test(module:divider): simplify by using id:ignore

* docs(module:checkbox): bind example

* docs(module:switch): bind example

* fix(module:switch): add Control + docs + tests

* feat(module:checkboxgroup): add layout and mixed mode

* fix: review comments + tests

* fix(module:checkboxgroup): parameter name should be MixedMode

added more tests

* fix demo

* fix(module:checkboxgroup): allow toggling between modes

Co-authored-by: James Yeung <shunjiey@hotmail.com>
2021-04-25 01:04:21 +08:00

42 lines
1.1 KiB
C#

@namespace AntDesign
@inherits AntInputBoolComponentBase
<button type="button" role="switch"
aria-checked="@(CurrentValue?"true":"false")"
disabled="@(Disabled||Loading)"
class="@ClassMapper.Class"
style="@Style"
autofocus=@AutoFocus
ant-click-animating="@(_clickAnimating?"true":"false")"
@onmouseover="HandleMouseOver"
@onmouseout="HandleMouseOut"
@onclick="HandleClick"
@ref="Ref">
<div class="@($"{_prefixCls}-handle")">
@if (Loading)
{
<Icon Type="loading" Class="@($"{_prefixCls}-loading-icon")" />
}
</div>
<span class="@($"{_prefixCls}-inner")">
@if (CurrentValue)
{
if (CheckedChildrenTemplate != null)@CheckedChildrenTemplate else @CheckedChildren
}
else
{
if (UnCheckedChildrenTemplate != null)@UnCheckedChildrenTemplate else @UnCheckedChildren
}
</span>
<!--animation-->
@if (CurrentValue)
{
<div class="ant-click-animating-node"></div>
}
else
{
<div class="ant-click-animating-node"></div>
}
</button>