summaryrefslogtreecommitdiff
path: root/Pages/Component/Switch.razor
blob: d11ac814ead3a7fee0d5164d31a24a4c9a671965 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<link rel="stylesheet" href="@(nameof(HyperBooru)).styles.css"/>

<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; }
}