summaryrefslogtreecommitdiff
path: root/Pages/Component/Switch.razor
blob: 526409468693ba27b718339e693e9cd53938ab74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<label>
  <input
      type="checkbox"
      checked=@InitialValue
      @onchange=@(e => OnToggle.InvokeAsync((e.Value as bool?) ?? false))
      hidden/>
  <div class="switch-outer">
    <div class="switch-inner"/>
  </div>
</label>

@code {
    [Parameter]
    public bool InitialValue { get; set; } = false;

    [Parameter]
    public EventCallback<bool> OnToggle { get; set; }
}