@@ -27,6 +27,10 @@ const props = defineProps({
2727 disabled: {
2828 type: Boolean ,
2929 default: false
30+ },
31+ invalidMessage: {
32+ type: String ,
33+ default: ' '
3034 }
3135})
3236
@@ -44,39 +48,45 @@ const model = computed({
4448})
4549 </script >
4650<template >
47- <div class =" relative flex items-start" >
48- <div class =" flex h-6 items-center" >
49- <input
50- :id =" componentId"
51- v-model =" model"
52- :aria-describedby =" componentId + '-description'"
53- :disabled =" disabled"
54- class =" h-5 w-5 rounded border-gray-300 text-primary-700 focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 focus:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-500 dark:text-primary-500 dark:focus:ring-primary-300 dark:focus:ring-offset-primary-950 sm:h-4 sm:w-4"
55- type =" checkbox"
56- v-bind =" $attrs"
57- />
58- </div >
59- <div class =" ml-3 text-sm leading-6" >
60- <!-- show label prop or default slot -->
61- <label
62- :class =" [
63- 'font-medium text-gray-700 dark:text-gray-50',
64- { 'cursor-not-allowed opacity-50': disabled }
65- ]"
66- :for =" disableSelectOnLabel ? '' : componentId"
67- >
68- <slot >{{ label }}</slot >
69- </label >
70- <span v-if =" $slots.tooltip" class =" ml-2" >
71- <slot name =" tooltip" ></slot >
72- </span >
73- <div
74- v-if =" $slots.description"
75- :id =" componentId + '-description'"
76- class =" text-gray-500 dark:text-gray-400"
77- >
78- <slot name =" description" />
51+ <div >
52+ <div class =" relative flex items-start" >
53+ <div class =" flex h-6 items-center" >
54+ <input
55+ :id =" componentId"
56+ v-model =" model"
57+ :aria-describedby =" componentId + '-description'"
58+ :disabled =" disabled"
59+ class =" h-5 w-5 rounded border-gray-300 text-primary-700 focus:ring-2 focus:ring-primary-500 focus:ring-offset-2 focus:ring-offset-white disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-500 dark:text-primary-500 dark:focus:ring-primary-300 dark:focus:ring-offset-primary-950 sm:h-4 sm:w-4"
60+ type =" checkbox"
61+ v-bind =" $attrs"
62+ />
63+ </div >
64+ <div class =" ml-3 text-sm leading-6" >
65+ <!-- show label prop or default slot -->
66+ <label
67+ :class =" [
68+ 'font-medium text-gray-700 dark:text-gray-50',
69+ { 'cursor-not-allowed opacity-50': disabled }
70+ ]"
71+ :for =" disableSelectOnLabel ? '' : componentId"
72+ >
73+ <slot >{{ label }}</slot >
74+ </label >
75+ <span v-if =" $slots.tooltip" class =" ml-2" >
76+ <slot name =" tooltip" ></slot >
77+ </span >
78+ <div
79+ v-if =" $slots.description"
80+ :id =" componentId + '-description'"
81+ class =" text-gray-500 dark:text-gray-400"
82+ >
83+ <slot name =" description" />
84+ </div >
7985 </div >
8086 </div >
87+ <!-- invalid message -->
88+ <p v-if =" invalidMessage" class =" mt-2 text-sm text-rose-700 dark:text-rose-400" >
89+ {{ invalidMessage }}
90+ </p >
8191 </div >
8292</template >
0 commit comments