Skip to content

Getting Started ​

Installation ​

bash
npm install @dynamicforms/vuetify-inputs

The components require Vuetify 4 (vuetify ^4.3.5).

In your main.ts

typescript
import { DynamicFormsInputs } from '@dynamicforms/vuetify-inputs';
import '@dynamicforms/vuetify-inputs/styles.css';

const app = createApp(MyApp);
app.use(vuetify);
app.use(DynamicFormsInputs);

The library's styles are in the cascade layer vuetify-overrides.dynamicforms-vuetify-inputs: they override Vuetify's component styles, and Vuetify's utility classes and the application's unlayered styles override them. Import vuetify/styles before Vuetify's components (The stylesheet).

Configuration describes the plugin options, among them the global registration of the components and of the Vuetify components they use, and the VuetifyComponents export.

Resolving a component by its tag ​

dfInputComponentsByTag holds every component of this library under its tag, for a rendering layer that looks a component up in a map instead of through Vue's resolver, e.g. one that renders a serialized layout naming df-select. DfInputComponentTag is the union of those tags.

typescript
import { dfInputComponentsByTag } from '@dynamicforms/vuetify-inputs';

const components = { ...dfInputComponentsByTag, ...myOwnComponents };

@dynamicforms/vuetify-modal-form-kit passes this map to its layout renderer. The map contains every component of the installed version.

Basic Usage ​

@dynamicforms/vuetify-inputs provides Vuetify-based input components that work with @dynamicforms/vue-forms for form state management.

Setting up the components ​

Import the components you need:

typescript
import { DfSelect, DfTextArea, DfFile } from '@dynamicforms/vuetify-inputs';

Using with DynamicForms ​

A component bound to a @dynamicforms/vue-forms element through control:

vue
<template>
  <form>
    <!-- Basic text area with DynamicForms integration -->
    <df-text-area
      :control="form.fields.description"
      label="Description"
      hint="Enter a detailed description"
      :rows="5"
      :max-rows="10"
    />
    
    <!-- Select field with choices -->
    <df-select
      :control="form.fields.category"
      :choices="categoryOptions"
      label="Category"
    />
  </form>
</template>

<script setup>
import { Group, Field } from '@dynamicforms/vue-forms';
import { DfTextArea, DfSelect } from '@dynamicforms/vuetify-inputs';

// Create a form group with fields
const form = new Group({
  description: new Field({ value: '' }),
  category: new Field({ value: null }),
});

// Define options for the select field
const categoryOptions = [
  { id: 1, text: 'Category 1' },
  { id: 2, text: 'Category 2' },
  { id: 3, text: 'Category 3' },
];
</script>

Using without DynamicForms ​

The components also work with v-model:

vue
<template>
  <df-text-area
    v-model="description"
    label="Description"
    hint="Enter a detailed description"
  />
  
  <df-select
    v-model="selectedCategory"
    :choices="categoryOptions"
    label="Category"
  />
</template>

<script setup>
import { ref } from 'vue';
import { DfTextArea, DfSelect } from '@dynamicforms/vuetify-inputs';

const description = ref('');
const selectedCategory = ref(null);
const categoryOptions = [
  { id: 1, text: 'Category 1' },
  { id: 2, text: 'Category 2' },
  { id: 3, text: 'Category 3' },
];
</script>

Available Components ​

The fields lists every component with what it is. InputBase describes the frame and the props they share.

Localisation ​

Localisation describes how the library's own strings, its errors and the date-fns locale of <df-date-time> follow the application's language.

Next Steps ​

The Examples section documents every component and feature.

Released under the MIT License.