blob: 9ba9c56c5810f1950cf3d455bf13e90fdb804f84 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
<script>
export let checked
export let onChange
console.log(document.body.dir)
</script>
<input class={document.body.dir} {...$$restProps} bind:checked on:change={onChange} type="checkbox" />
<style>
input[type="checkbox"] {
appearance: none;
-moz-appearance: none;
-webkit-appearance: none;
width: 46px;
height: 24px;
background-color: var(--light-grey);
border-radius: 50px;
transition: 0.4s;
cursor: pointer;
}
input[type="checkbox"]:checked {
background-color: var(--active);
}
input[type="checkbox"]::before {
content: "";
display: inline-block;
width: 18px;
height: 18px;
box-sizing: border-box;
position: relative;
top: 3px;
left: 3.5px;
background-color: white;
border-radius: 50%;
transition: 0.3s;
}
input[type="checkbox"]:checked::before {
left: 24px;
}
input[type="checkbox"].rtl::before {
left: auto;
right: 3.5px;
}
input[type="checkbox"].rtl:checked::before {
left: auto;
right: 24px;
}
</style>
|