Skip to content

GridSectionTemplate

Default grid template for the section type.

System props

  • fieldKey
  • getCurrentValue()
  • title?

Grid props

  • columns?: number
  • maxColumns?: number
  • gap?: number

Slots

  • formField

Example

vue
vue
<script setup lang="ts">
import { type SectionTemplateProperties } from "@duplojs/form/vue";
import { computed } from "vue";
import { type GridTemplateLayoutContainerProps } from "@duplojs/form/vueGrid";

type Props = (
	& SectionTemplateProperties["props"]
	& GridTemplateLayoutContainerProps
);

const props = defineProps<Props>();
defineSlots<SectionTemplateProperties["slots"]>();

const selfStyles = computed(() => ({
	"--DFV-grid-columns": props.columns,
}));
</script>

<template>
	<div
		class="DFV-grid-element"
		:style="selfStyles"
	>
		<label
			v-if="props.title"
			:for="props.fieldKey"
		>
			{{ props.title }}
		</label>

		<slot name="formField" />
	</div>
</template>

What this template does

  • displays a section title when present;
  • wraps the content in a grid-compatible block.

Released under the MIT License.