2023-05-27 09:19:35 -07:00
|
|
|
<div x-data="{ switchOn: false }" class="flex items-center justify-center space-x-2">
|
|
|
|
<input id="thisId" type="checkbox" name="switch" class="hidden" :checked="switchOn">
|
2023-05-24 05:29:02 -07:00
|
|
|
|
|
|
|
<button
|
|
|
|
x-ref="switchButton"
|
|
|
|
type="button"
|
|
|
|
@click="switchOn = ! switchOn"
|
|
|
|
:class="switchOn ? 'bg-blue-600' : 'bg-neutral-200'"
|
|
|
|
class="relative inline-flex h-6 py-0.5 ml-4 focus:outline-none rounded-full w-10"
|
|
|
|
x-cloak>
|
2023-05-27 09:19:35 -07:00
|
|
|
<span :class="switchOn ? 'translate-x-[18px]' : 'translate-x-0.5'" class="w-5 h-5 duration-200 ease-in-out bg-white rounded-full shadow-md"></span>
|
2023-05-24 05:29:02 -07:00
|
|
|
</button>
|
|
|
|
|
|
|
|
<label @click="$refs.switchButton.click(); $refs.switchButton.focus()" :id="$id('switch')"
|
|
|
|
:class="{ 'text-blue-600': switchOn, 'text-gray-400': ! switchOn }"
|
|
|
|
class="text-sm select-none"
|
|
|
|
x-cloak>
|
|
|
|
Enable Feature
|
|
|
|
</label>
|
|
|
|
</div>
|