anki/ts/deckoptions/Switch.svelte

27 lines
659 B
Svelte
Raw Normal View History

2021-06-12 10:25:11 +02:00
<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
export let value: boolean;
export let disabled = false;
</script>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" bind:checked={value} {disabled} />
</div>
<style lang="scss">
.form-check-input {
-webkit-appearance: none;
height: 1.6em;
/* otherwise the switch circle shows slightly off-centered */
margin-top: 0;
.form-switch & {
width: 3em;
margin-left: 1.5em;
}
}
</style>