GridInputTemplate
Default grid template for the input type.
System props
getLabel?()getCurrentValue()getErrorMessage?()fieldKey
Grid props
columns?: number
Specific props
hideEmptyMessageError?: boolean
Slots
input
Example
vue
<script setup lang="ts">
import { type InputTemplateProperties } from "@duplojs/form/vue";
import { computed } from "vue";
import { type GridTemplateLayoutProps } from "@duplojs/form/vueGrid";
type Props = (
& InputTemplateProperties["props"]
& GridTemplateLayoutProps
& {
hideEmptyMessageError?: boolean;
}
);
const props = defineProps<Props>();
defineSlots<InputTemplateProperties["slots"]>();
const selfStyles = computed(() => ({
"--DFV-grid-columns": props.columns,
}));
</script>
<template>
<div
class="DFV-grid-element DFV-grid-input"
:style="selfStyles"
>
<label
v-if="props.getLabel"
:for="props.fieldKey"
>
{{ props.getLabel() }}
</label>
<slot name="input" />
<small
v-if="
props.getErrorMessage
&& (
props.getErrorMessage() !== null ||
props.hideEmptyMessageError !== true
)
"
>
{{ props.getErrorMessage() }}
</small>
</div>
</template>What this template does
- displays the label above the field;
- renders the
inputslot; - displays the error area below the field.
