DynamicForms Vuetify InputsForm fields with one layout
Vuetify input components with one density and variant system — set globally, injected per section, overridden per field, with an inline mode that fits a table cell.
A set of Vuetify fields that share one base, so a row mixing a text field, a select, a checkbox and a date picker is aligned. The layout is set on two axes: density, the vertical compactness of a field (default, comfortable, compact, or inline for a table cell), and variant, the seven Vuetify visual styles. Both are resolved by the same code for every component; a change to either applies to every field.
A field bound to a @dynamicforms/vue-forms element takes the value, the validation, the enabled state and the visibility from the element and renders them. Every component also works with a plain v-model, or with no binding. The density and variant system, the inline mode and passthroughAttrs apply in all three cases. See Using them without vue-forms.
<template> <div> <df-select :control="form.fields.country" :choices="countries" label="Select a country" /> <df-text-area :control="form.fields.description" label="Description" :rows="5" :max-rows="10" /> <pre>{{ form.value }}</pre> </div></template><script setup>import { Field, Group } from '@dynamicforms/vue-forms';import { DfSelect, DfTextArea } from '@dynamicforms/vuetify-inputs';// Create a form with fieldsconst form = new Group({ country: new Field({ value: null }), description: new Field({ value: '' }),});// Define countries for selectconst countries = [ { id: 'us', text: 'United States' }, { id: 'ca', text: 'Canada' }, { id: 'uk', text: 'United Kingdom' }, // more countries...];</script>
Neither field sets a density or a variant, so both take the application's configured values, and both render at the same height with their labels on the same line.