summaryrefslogtreecommitdiff
path: root/Pages/Component/Switch.razor
diff options
context:
space:
mode:
Diffstat (limited to 'Pages/Component/Switch.razor')
-rw-r--r--Pages/Component/Switch.razor5
1 files changed, 5 insertions, 0 deletions
diff --git a/Pages/Component/Switch.razor b/Pages/Component/Switch.razor
index ffb3543..d11ac81 100644
--- a/Pages/Component/Switch.razor
+++ b/Pages/Component/Switch.razor
@@ -3,6 +3,7 @@
<label>
<input
type="checkbox"
+ checked=@InitialValue
@onchange=@(e => OnToggle.InvokeAsync((e.Value as bool?) ?? false))
hidden/>
<div class="switch-outer">
@@ -11,5 +12,9 @@
</label>
@code {
+ [Parameter]
+ public bool InitialValue { get; set; } = false;
+
+ [Parameter]
public EventCallback<bool> OnToggle { get; set; }
}