This repository has been archived on 2024-04-04. You can view files and clone it, but cannot push or open issues or pull requests.
tailwindui/vue/components/application-ui/forms/toggles/with_right_label.vue

19 lines
974 B
Vue
Raw Normal View History

2024-01-24 19:02:44 +08:00
<template>
<SwitchGroup as="div" class="flex items-center">
<Switch v-model="enabled" :class="[enabled ? 'bg-indigo-600' : 'bg-gray-200', 'relative inline-flex h-6 w-11 flex-shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2']">
<span aria-hidden="true" :class="[enabled ? 'translate-x-5' : 'translate-x-0', 'pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out']" />
</Switch>
<SwitchLabel as="span" class="ml-3 text-sm">
<span class="font-medium text-gray-900">Annual billing</span>
{{ ' ' }}
<span class="text-gray-500">(Save 10%)</span>
</SwitchLabel>
</SwitchGroup>
</template>
<script setup>
import { ref } from 'vue'
import { Switch, SwitchGroup, SwitchLabel } from '@headlessui/vue'
const enabled = ref(false)
</script>