Some form generator stuff
This commit is contained in:
44
ui/src/components/form/FormInput.vue
Normal file
44
ui/src/components/form/FormInput.vue
Normal file
@@ -0,0 +1,44 @@
|
||||
<script setup>
|
||||
import {
|
||||
FormControl,
|
||||
FormDescription,
|
||||
FormField,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} from '@/components/ui/form'
|
||||
import Input from '../ui/input/Input.vue';
|
||||
|
||||
const props = defineProps({
|
||||
name: {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
label: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
readOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<FormField :name="props.name" v-slot="{ value, handleChange }">
|
||||
<FormItem>
|
||||
<FormLabel>{{ props.label }}</FormLabel>
|
||||
<FormDescription>{{ props.description }}</FormDescription>
|
||||
<FormControl>
|
||||
<Input :model-value="value" @update:model-value="handleChange" :disabled="props.readOnly" />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
</FormField>
|
||||
</template>
|
||||
Reference in New Issue
Block a user