2026-03-19 12:44:31 +00:00
|
|
|
<template>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
role="switch"
|
|
|
|
|
:aria-checked="modelValue"
|
2026-07-14 06:42:08 -04:00
|
|
|
:aria-label="ariaLabel"
|
|
|
|
|
:disabled="disabled"
|
2026-03-31 01:41:24 +01:00
|
|
|
tabindex="-1"
|
|
|
|
|
data-controller-ignore
|
2026-03-19 12:44:31 +00:00
|
|
|
class="w-10 h-6 rounded-full shrink-0 transition-colors relative"
|
2026-07-14 06:42:08 -04:00
|
|
|
:class="[modelValue ? 'bg-orange-500' : 'bg-white/15', disabled ? 'opacity-40 cursor-not-allowed' : '']"
|
2026-03-19 12:44:31 +00:00
|
|
|
@click="$emit('update:modelValue', !modelValue)"
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
class="absolute top-1 w-4 h-4 rounded-full bg-white shadow transition-transform"
|
|
|
|
|
:class="modelValue ? 'translate-x-5' : 'translate-x-1'"
|
|
|
|
|
/>
|
|
|
|
|
</button>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
defineProps<{
|
|
|
|
|
modelValue: boolean
|
2026-07-14 06:42:08 -04:00
|
|
|
disabled?: boolean
|
|
|
|
|
ariaLabel?: string
|
2026-03-19 12:44:31 +00:00
|
|
|
}>()
|
|
|
|
|
|
|
|
|
|
defineEmits<{
|
|
|
|
|
'update:modelValue': [value: boolean]
|
|
|
|
|
}>()
|
|
|
|
|
</script>
|