sfxcode / formkit-primevue

PrimeVue (v4, v3) support for the FormKit validation Framwork
https://sfxcode.github.io/formkit-primevue
MIT License
103 stars 9 forks source link
formkit forms nuxt3 outputs primevue primevue4 schema validation vite vue3

Formkit - Primevue

PrimeVue based FormKit Inputs for using FormKit with the PrimeVue UI Framework.

Main focus of this project is to provide configuration based forms with validation.

In addition, you can use the same pattern for data output from schema using PrimeOutputs.

PrimeVue Versions

Actual PrimeVue Version of the main branch is 4.x.

PrimeVue 3 is in the prime3 branch, but future development will only focus on PrimeVue 4

Build

CI

Netlify Status

Docs

Docs

Demo/Playground

Usage

Configuration

Add formkit.config.ts

import { defaultConfig, plugin } from '@formkit/vue'
import { primeInputs } from '@sfxcode/formkit-primevue'

app.use(plugin, defaultConfig({
  locales: { de, en },
  // Define the active locale
  locale: 'en',
  inputs: primeInputs, 
}))

or if using also the output part

import { defaultConfig, plugin } from '@formkit/vue'
import { primeInputs, primeOutputs } from '@sfxcode/formkit-primevue'

app.use(plugin, defaultConfig({
  locales: { de, en },
  // Define the active locale
  locale: 'en',
    inputs: { ...primeInputs, ...primeOutputs },
}))

Important: output elements depends on vue-i18n to style numbers, dates, ...

Nuxt

Important: use autoimport: false if using PrimeVue-FormKit validation and include or exclude not needed components as usual.

Autoimport true prevents elements lookup correctly.

Example:

  primevue: {
  autoImport: false,
    components: {
    exclude: ['Chart', 'Editor'],
  },
  options: {
    theme: {
      preset: Aura,
        options: {
        darkModeSelector: '.dark',
      },
    },
    ripple: true,
  },
},

Limitations

Prefixing of the PrimeVue component names is not supported.

Schema Helper Functions

useFormKitSchema provide functions to simplify the usage of elements, components, lists, ...

useInputEditorSchema provide functions for a component schema generation builder

Basic Styling

Basic styling is provided with the formkit-primevue.scss file or the corresponding css file in the package.

Features:

You can use it or take it as base for your own styling.

Extended Styling

Samples

Some samples for common tasks are available

Showcases

Demo Application

Nuxt 3 PrimeVue Starter and Vite PrimeVue Starter with Formkit support available.

Supported Inputs for PrimeVue 4