You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Nuxt 3 PrimeVue Starter](https://github.com/sfxcode/nuxt3-primevue-starter) and [Vite PrimeVue Starter](https://github.com/sfxcode/vite-primevue-starter) with Formkit support available
50
+
[Nuxt 3 PrimeVue Starter](https://github.com/sfxcode/nuxt3-primevue-starter) and [Vite PrimeVue Starter](https://github.com/sfxcode/vite-primevue-starter) with Formkit support available.
This example takes parts of the FormKit validation demo and replace the formkit library elements with the one found in this framework.
38
+
39
+
The working version can be found at the [formkit-primevue-demo](https://formkit-primevue.netlify.app/). There are also some samples for all wrapped PrimeVue form elements.
40
+
41
+
```vue
42
+
<script setup lang='ts'>
43
+
import { ref, reactive } from 'vue'
44
+
45
+
const options = [
46
+
{ label: 'Every page load', value: 'refresh' },
47
+
{ label: 'Ever hour', value: 'hourly' },
48
+
{ label: 'Every day', value: 'daily' },
49
+
]
50
+
51
+
const schema = reactive(
52
+
[
53
+
{
54
+
$el: 'h2',
55
+
children: ['Register ', '$email'],
56
+
},
57
+
{
58
+
$el: 'h3',
59
+
children: 'Header Text H3',
60
+
},
61
+
{
62
+
$formkit: 'primeInputText',
63
+
name: 'email',
64
+
label: 'Email',
65
+
help: 'This will be used for your account.',
66
+
validation: 'required|email',
67
+
},
68
+
{
69
+
$formkit: 'primeTextarea',
70
+
name: 'myText',
71
+
label: 'Text',
72
+
validation: '',
73
+
rows: '3',
74
+
},
75
+
{
76
+
$formkit: 'primeEditor',
77
+
name: 'myEditor',
78
+
label: 'Editor',
79
+
style: 'height: 160px;',
80
+
},
81
+
{
82
+
$formkit: 'primeInputText',
83
+
name: 'password',
84
+
label: 'Password',
85
+
help: 'Enter your new password.',
86
+
validation: 'required|length:5,16',
87
+
},
88
+
{
89
+
$formkit: 'primeInputText',
90
+
name: 'password_confirm',
91
+
label: 'Confirm password',
92
+
help: 'Enter your new password again.',
93
+
validation: 'required|confirm',
94
+
validationLabel: 'password confirmation',
95
+
},
96
+
{
97
+
$formkit: 'primeCheckbox',
98
+
name: 'eu_citizen',
99
+
id: 'eu',
100
+
label: 'Are you a european citizen?',
101
+
},
102
+
{
103
+
$formkit: 'primeDropdown',
104
+
if: '$get(eu).value', // 👀 Oooo, conditionals!
105
+
name: 'cookie_notice',
106
+
label: 'Cookie notice frequency',
107
+
options,
108
+
help: 'How often should we display a cookie notice?',
**formkit-primevue** combines the [PrimeVue](https://www.primefaces.org/primevue) component framework with the validation power of [Formkit](https://formkit.com/) in your Vue/Nuxt application.
4
4
5
+
The main motivation for this project is to use Formkit Validation by Schema with form elements provided by PrimeVue..
FormKit's schema is a JSON-serializable data format for storing DOM structures and component implementations, including FormKit forms. Although created specifically for implementing and generating forms, the format is capable of generating any HTML markup or using any third-party components.
14
+
:::
15
+
16
+
PrimeVue inputs are prefixed with prime and try to use as many properties as possible from their definition.
PrimeVue has a lot of styling possiblities and the structure of a formkit form gives you all possibilities needed for advanced styling.
4
+
5
+
## Basic Styling
6
+
7
+
Basic styling is provided with the **formkit-primevue.scss** file.
8
+
9
+
Features:
10
+
11
+
- Width of all text and dropdown elements is set to 100%
12
+
- Error Color by variable (--formkit-error-color)
13
+
- Some margins, font sizes ...
14
+
15
+
You can use it or take it as base for your own styling.
16
+
17
+
## Extended Styling
18
+
19
+
- All inputs are wrapped in a div with a **p-formkit** class
20
+
- Most Prime Components have access to class / styles attributes
21
+
- PT and PTOptions are available ([https://primevue.org/passthrough/](https://primevue.org/passthrough/))
22
+
-[Styling](https://formkit-primevue.netlify.app/demo/styling), [Grid](https://formkit-primevue.netlify.app/demo/grid) and [PT](https://formkit-primevue.netlify.app/demo/passThrough) demo available
0 commit comments