Add intro for text field

This commit is contained in:
philipp lang 2024-09-12 11:10:01 +02:00
parent 54efebf12e
commit a4a2a2b3fd
2 changed files with 26 additions and 18 deletions

View File

@ -1,5 +1,5 @@
<template>
<v-text type="text" :required="field.required" :name="field.key" :label="field.name" :id="field.key" :hint="field.hint" v-model="inner"></v-text>
<v-text type="text" :required="field.required" :name="field.key" :label="field.name" :id="field.key" :hint="field.hint" :intro="field.intro" v-model="inner"></v-text>
</template>
<script setup>

View File

@ -1,21 +1,24 @@
<template>
<label class="w-full border border-solid border-gray-500 focus-within:border-primary rounded-lg relative flex">
<input
:id="id"
v-model="inner"
:name="name"
:min="min"
:max="presentMax"
:type="type"
placeholder=""
class="bg-white group-[.info]:bg-blue-200 rounded-lg focus:outline-none text-gray-600 text-left w-full py-1 @sm:py-2 @sm:group-[.box]:py-1 px-2 @sm:px-3 @sm:group-[.box]:px-2 text-sm @sm:text-base @sm:group-[.box]:text-sm"
@keypress="$emit('keypress', $event)"
/>
<div v-if="hint" class="absolute right-0 mr-2 flex items-center h-full">
<hint :value="hint"></hint>
</div>
<field-label :name="label" :required="required"></field-label>
</label>
<div>
<div class="text-sm text-gray-600 mb-4" v-text="intro" v-if="intro"></div>
<label class="w-full border border-solid border-gray-500 focus-within:border-primary rounded-lg relative flex">
<input
:id="id"
v-model="inner"
:name="name"
:min="min"
:max="presentMax"
:type="type"
placeholder=""
class="bg-white group-[.info]:bg-blue-200 rounded-lg focus:outline-none text-gray-600 text-left w-full py-1 @sm:py-2 @sm:group-[.box]:py-1 px-2 @sm:px-3 @sm:group-[.box]:px-2 text-sm @sm:text-base @sm:group-[.box]:text-sm"
@keypress="$emit('keypress', $event)"
/>
<div v-if="hint" class="absolute right-0 mr-2 flex items-center h-full">
<hint :value="hint"></hint>
</div>
<field-label :name="label" :required="required"></field-label>
</label>
</div>
</template>
<script setup>
@ -70,6 +73,11 @@ const props = defineProps({
validator: (value) => value === null || typeof value === 'string',
default: () => null,
},
intro: {
required: false,
validator: (value) => value === null || typeof value === 'string',
default: () => null,
},
});
const presentMax = computed(() => {