mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
24 lines
459 B
Vue
24 lines
459 B
Vue
<script setup lang="ts">
|
|
const colorMode = useColorMode()
|
|
|
|
const isDark = computed({
|
|
get () {
|
|
return colorMode.value === 'dark'
|
|
},
|
|
set (value) {
|
|
colorMode.preference = value ? 'dark' : 'light'
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<div class="flex items-center">
|
|
<USwitch
|
|
v-model="isDark"
|
|
:checked-icon="isDark ? 'i-lucide-moon' : ''"
|
|
:unchecked-icon="!isDark ? 'i-lucide-sun' : ''"
|
|
class="mr-2"
|
|
/>
|
|
</div>
|
|
</template>
|