@formique/semantq 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
- # Formique-Semantq
1
+ Here's the updated README with the new HTML feature section and a navigable table of contents:
2
2
 
3
+ # Formique-Semantq
3
4
 
4
5
  <div align="center">
5
6
  <p align="center">
@@ -12,29 +13,38 @@
12
13
  </p>
13
14
  </div>
14
15
 
15
-
16
-
17
-
18
- <!--
19
- [![npm downloads](https://img.shields.io/npm/dm/formique-semantq.svg?style=for-the-badge)](https://www.npmjs.com/package/formique-semantq)
20
-
21
- [![npm](https://img.shields.io/npm/dt/formique-semantq.svg?style=for-the-badge)](https://www.npmjs.com/package/formique-semantq)
22
-
23
- [![Coverage Status](https://img.shields.io/coveralls/github/Gugulethu-Nyoni/formique-semantq/master?style=for-the-badge)](https://coveralls.io/github/Gugulethu-Nyoni/formique-semantq?branch=master)
24
- -->
25
-
26
-
27
16
  <img src="https://github.com/Gugulethu-Nyoni/formique/blob/main/images/formique-js-form-builder-anyframework.png" alt="Formique JS Form Builder Example">
28
17
 
18
+ ## Table of Contents
19
+
20
+ - [About Formique Semantq](#about-formique-semantq)
21
+ - [Features](#features)
22
+ - [Installation](#how-to-install-formique-in-semantq)
23
+ - [Quick Start](#demo-creating-a-new-route-in-semantq-for-formique)
24
+ - [Form Schema Guide](#form-schema-guide)
25
+ - [Standard Input Fields](#standard-input-fields)
26
+ - [Radio & Checkbox Groups](#radio--checkbox-groups)
27
+ - [Select Dropdowns](#select-dropdowns)
28
+ - [Dynamic Single Select](#dynamic-single-select)
29
+ - [HTML Content Blocks ✨ New](#html-content-blocks)
30
+ - [Conditional Logic](#conditional-logic)
31
+ - [Styling Guide](#-1-styling-the-form)
32
+ - [Built-in Themes](#available-built-in-themes)
33
+ - [Custom Theme Colors](#fine-grained-theme-control)
34
+ - [Container Sizing](#2-styling-and-sizing-the-form-container)
35
+ - [Complete CSS Classes](#-complete-list-of-formique-scoped-css-classes)
36
+ - [Email Forms](#-3-contact-form-quick-setup)
37
+ - [Domain Verification](#⚠️-domain-verification-for-email-submissions)
29
38
 
30
39
  ## About Formique Semantq
31
40
 
32
- Formique Semantq is a native Semantq JS framework Schema Defintion Language (SDL) and Formique Form Definition Language (Low Code). The library is a robust and elegant Web Content Accessibility Guidelines (WCAG) and Web Accessibility Initiative – Accessible Rich Internet Applications (WAI-ARIA) compliant form-building library tailored for JavaScript enthusiasts. It supports a wide array of input types, features JavaScript-driven themes, and offers advanced functionalities like nested conditional logic and dynamic dropdowns. Highly customizable and extensible, Formique is built for the Semantq JS Framework but integrates seamlessly with Vanilla JS, Semantq, Semantq, and Vue. This guide covers implementing Formique in Semantq.
41
+ Formique Semantq is a native Semantq JS framework Schema Definition Language (SDL) and Formique Form Definition Language (Low Code). The library is a robust and elegant Web Content Accessibility Guidelines (WCAG) and Web Accessibility Initiative – Accessible Rich Internet Applications (WAI-ARIA) compliant form-building library tailored for JavaScript enthusiasts. It supports a wide array of input types, features JavaScript-driven themes, and offers advanced functionalities like nested conditional logic and dynamic dropdowns. Highly customizable and extensible, Formique is built for the Semantq JS Framework but integrates seamlessly with Vanilla JS, Semantq, and Vue. This guide covers implementing Formique in Semantq.
33
42
 
34
43
  ## Features
35
44
 
36
45
  - **Declarative Syntax**: Define forms using a simple and intuitive schema.
37
46
  - **Wide Range of Inputs**: Supports text, email, number, password, date, time, file uploads, and more.
47
+ - **HTML Content Blocks**: Insert custom HTML or plain text anywhere in your form.
38
48
  - **Validation and Attributes**: Easily specify validation rules and attributes for each form field.
39
49
  - **Dynamic Form Generation**: Generate forms dynamically based on your schema.
40
50
  - **Framework Agnostic**: Currently works with Semantq and Vanilla JS (more frameworks to be added).
@@ -53,116 +63,90 @@ Formique Semantq is a native Semantq JS framework Schema Defintion Language (SDL
53
63
  Create a new Semantq project using the following commands:
54
64
 
55
65
  ```bash
56
- # create a new project in the current directory
57
- npx sv create
66
+ # install semantq globally
67
+ npm i -g semantq
58
68
 
59
69
  # create a new project in my-app
60
- npx sv create my-app
70
+ semantq create my-app
61
71
  ```
62
72
 
63
- > **Note:** Always refer to the latest official Semantq guide on how to create a Semantq app, as this may change. [Semantq Documentation: Creating a Project](https://Semantq.dev/docs/kit/creating-a-project)
73
+ > **Note:** Always refer to the latest official Semantq guide on how to create a Semantq app, as this may change. [Semantq Documentation: Creating a Project](https://github.com/Gugulethu-Nyoni/semantq)
64
74
 
65
-
66
- ## Developing
75
+ ### Step 2: Install Formique
67
76
 
68
77
  ```bash
69
- npm run dev
70
-
71
- # or start the server and open the app in a new browser tab
72
- npm run dev
78
+ npm i @formique/semantq
73
79
  ```
74
80
 
81
+ ### Step 3: CSS Styling (Optional)
75
82
 
76
- ## Demo: Creating a New Route in Semantq for Formique
77
-
78
- ### Step 1: Create a New Route
79
-
80
- For demo purposes, let's create a new route (page) in `src/routes/registration`.
81
-
82
- 1. **Create the Route**:
83
- - Create a new directory for the route:
84
- ```bash
85
- mkdir src/routes/registration
86
- ```
87
-
88
- 2. **Create the Semantq Page**:
89
- - Inside the route directory, create a new Semantq page:
90
- ```bash
91
- touch src/routes/registration/+page.Semantq
92
- ```
83
+ Formique now **automatically injects its internal styles** by default - no additional CSS files needed! The library handles styling internally with built-in themes and CSS variables.
93
84
 
94
- ## Step 2: Add the CSS (Optional)
85
+ #### Using Built-in Styles (Default)
95
86
 
96
- The NPM option:
87
+ Formique automatically applies its styling system. Just use the `theme` or `themeColor` options in your `formSettings`:
97
88
 
98
89
  ```javascript
99
- npm i formique-css
90
+ const formSettings = {
91
+ theme: 'midnight-blush', // Apply a built-in theme
92
+ // OR use a custom color:
93
+ themeColor: '#4338ca' // Override with your own hex color
94
+ };
100
95
  ```
101
96
 
97
+ #### Disabling Default Styles
98
+
99
+ If you prefer to use your **own custom CSS**, you can disable Formique's internal styles:
100
+
102
101
  ```javascript
103
- import 'formique-css';
102
+ const formSettings = {
103
+ disableStyles: true, // Prevents internal CSS injection
104
+ // Now you can provide your own CSS file or styles
105
+ };
104
106
  ```
105
107
 
106
- The CDN Option:
107
-
108
- Include this inside the @head .. @end block of page layout file: `@layout.smq`
108
+ When `disableStyles: true` is set, Formique will not inject any styles, giving you complete control over the form's appearance. You can then link your own CSS file:
109
109
 
110
110
  ```html
111
- <link rel="stylesheet" href="https://unpkg.com/formique-css@1.0.11/formique-css.css" />
111
+ <!-- Your custom CSS -->
112
+ <link rel="stylesheet" href="/path/to/your-custom-form-styles.css" />
112
113
  ```
113
114
 
115
+ #### Why This Change?
114
116
 
115
- **Note:** The provided Formique CSS is optional. Formique will function fully without it, allowing you full flexibility to apply your own styles. However, for convenience, a set of default class names is available to help you quickly style form containers, form elements, and input types. See the sections below for a complete list of available class names.
117
+ - **Zero configuration**: Forms look great out of the box
118
+ - **Reduced dependencies**: No need to manage separate CSS packages
119
+ - **Better performance**: Styles are injected efficiently
120
+ - **Theming flexibility**: Built-in themes and CSS variables work seamlessly
121
+ - **Opt-out option**: Full control when you need it
122
+ - **Eliminates FOUC (Flash of Unstyled Content)**: Styles are injected before form rendering, ensuring the form appears fully styled immediately
116
123
 
117
- ## Step 3: Install `@formique/semantq`
118
-
119
- To use Formique in your Semantq application, you need to install the `formique-semantq` package.
124
+ ## Demo: Creating a New Route in Semantq for Formique
120
125
 
126
+ ### Step 1: Create a New Route
121
127
 
122
128
  ```bash
123
- npm i @formique/semantq
129
+ semantq make:route registration
124
130
  ```
125
131
 
126
- ### Step 4: Implement the Form in `+page.Semantq`
127
-
128
- Add the following code to +page.Semantq:
132
+ ### Step 2: Implement the Form
129
133
 
130
-
131
- ```Semantq
132
- <script>
133
- import { onMount } from 'Semantq';
134
+ ```
135
+ @script
134
136
  import Formique from '@formique/semantq';
135
137
 
136
- // Define the form schema
137
138
  const formSchema = [
138
139
  ['text', 'name', 'Name', { required: true }],
139
140
  ['text', 'surname', 'Surname', { required: true }],
140
141
  ['email', 'email', 'Email', { required: true }],
141
- ['singleSelect', 'title', 'Title', { required: true }, { dependents: ['status'] },
142
- [
143
- { value: 'mr', label: 'Mr' },
144
- { value: 'ms', label: 'Ms' },
145
- { value: 'mrs', label: 'Mrs' },
146
- { value: 'dr', label: 'Dr' },
147
- { value: 'prof', label: 'Prof' }
148
- ]
149
- ],
150
- ['singleSelect', 'status', 'Status', { required: true }, { dependsOn: 'title', condition: 'prof' },
151
- [
152
- { value: 'full professor', label: 'Full Professor' },
153
- { value: 'associate professor', label: 'Associate Professor' }
154
- ]
155
- ],
156
142
  ['submit', 'submit', 'Submit', {}, { style: 'width: 100%;' }],
157
143
  ];
158
144
 
159
- // Define form parameters
160
145
  const formParams = {
161
146
  id: "regForm",
162
147
  method: "POST",
163
148
  };
164
149
 
165
- // Define form settings
166
150
  const formSettings = {
167
151
  submitOnPage: true,
168
152
  theme: "midnight-blush",
@@ -170,27 +154,228 @@ Add the following code to +page.Semantq:
170
154
  placeholders: true,
171
155
  };
172
156
 
173
- // Initialize the form on component mount
174
- onMount(() => {
157
+ $onMount(() => {
175
158
  const form = new Formique(formSchema, formParams, formSettings);
176
159
  });
177
- </script>
160
+ @end
178
161
 
179
- <!-- Target element where the form will be inserted -->
162
+ @html
180
163
  <div id="formique"></div>
181
164
  ```
182
- ## Step 5: View the Form
183
165
 
184
- To see the form in your browser, run the following command:
166
+ ## Form Schema Guide
185
167
 
186
- ```bash
187
- npm run dev
168
+ Formique uses a simple, intuitive array-based schema to define forms. Each field follows this format:
169
+
170
+ ```javascript
171
+ [type, name, label, validation, attributes, options]
172
+ ```
173
+
174
+ ### Standard Input Fields
175
+
176
+ ```javascript
177
+ [
178
+ ['text', 'username', 'Username', { required: true, minlength: 3 }],
179
+ ['email', 'user_email', 'Email Address', { required: true }],
180
+ ['password', 'user_pass', 'Password', { required: true, minlength: 8 }],
181
+ ['number', 'age', 'Age', { min: 18, max: 99 }],
182
+ ['tel', 'phone', 'Phone Number', { pattern: '[0-9]{3}-[0-9]{3}-[0-9]{4}' }],
183
+ ['date', 'dob', 'Date of Birth'],
184
+ ['time', 'appointment', 'Appointment Time'],
185
+ ['color', 'fav_color', 'Favorite Color', {}, { value: '#ff0056' }],
186
+ ['file', 'avatar', 'Profile Picture', { accept: 'image/*' }],
187
+ ['textarea', 'bio', 'Biography', { maxlength: 500 }, { rows: 5 }],
188
+ ['url', 'website', 'Personal Website'],
189
+ ['search', 'search', 'Search'],
190
+ ]
191
+ ```
192
+
193
+ ### Radio & Checkbox Groups
194
+
195
+ ```javascript
196
+ // Radio buttons (single selection)
197
+ [
198
+ 'radio', 'gender', 'Gender', { required: true }, {}, [
199
+ { value: 'male', label: 'Male' },
200
+ { value: 'female', label: 'Female' },
201
+ { value: 'other', label: 'Other' }
202
+ ]
203
+ ],
204
+
205
+ // Checkbox group (multiple selection)
206
+ [
207
+ 'checkbox', 'interests', 'Interests', {}, {}, [
208
+ { value: 'coding', label: 'Coding', selected: true },
209
+ { value: 'design', label: 'Design' },
210
+ { value: 'music', label: 'Music' }
211
+ ]
212
+ ]
213
+ ```
214
+
215
+ ### Select Dropdowns
216
+
217
+ ```javascript
218
+ // Single select
219
+ [
220
+ 'singleSelect', 'country', 'Country', { required: true }, {}, [
221
+ { value: 'us', label: 'United States', selected: true },
222
+ { value: 'uk', label: 'United Kingdom' },
223
+ { value: 'ca', label: 'Canada' }
224
+ ]
225
+ ],
226
+
227
+ // Multiple select
228
+ [
229
+ 'multipleSelect', 'skills', 'Skills', { required: true }, {}, [
230
+ { value: 'js', label: 'JavaScript' },
231
+ { value: 'python', label: 'Python' },
232
+ { value: 'java', label: 'Java' }
233
+ ]
234
+ ]
235
+ ```
236
+
237
+ ### Dynamic Single Select
238
+
239
+ Create cascading dropdowns where options in the second select depend on the first selection:
240
+
241
+ ```javascript
242
+ [
243
+ 'dynamicSingleSelect', // Field type
244
+ 'programming', // Field name
245
+ 'Programming Languages', // Label
246
+ { required: true }, // Validation
247
+ {}, // Attributes
248
+ [ // Main categories (appear in first dropdown)
249
+ {
250
+ id: 'frontend',
251
+ label: 'Front End',
252
+ options: [
253
+ { value: 'javascript', label: 'JavaScript' },
254
+ { value: 'react', label: 'React' },
255
+ { value: 'vue', label: 'Vue' }
256
+ ]
257
+ },
258
+ {
259
+ id: 'backend',
260
+ label: 'Back End',
261
+ options: [
262
+ { value: 'nodejs', label: 'Node.js' },
263
+ { value: 'python', label: 'Python' },
264
+ { value: 'java', label: 'Java' }
265
+ ]
266
+ }
267
+ ]
268
+ ]
269
+ ```
270
+
271
+ ### HTML Content Blocks ✨ New
272
+
273
+ Insert custom HTML or plain text anywhere in your form. Perfect for section headers, instructional text, warnings, or embedded content:
274
+
275
+ ```javascript
276
+ [
277
+ 'html', // Field type
278
+ 'div', // HTML element to render (div, p, span, section, etc.)
279
+ 'Your content here', // Content (HTML or plain text)
280
+ {}, // Validation (not used for HTML blocks -but do keep the empty {})
281
+ { // Attributes for the HTML element
282
+ id: 'section-header',
283
+ class: 'info-message highlight',
284
+ style: 'color: #4338ca; padding: 1rem; background: #f5f3ff;',
285
+ 'data-type': 'instructional'
286
+ }
287
+ ]
288
+ ```
289
+
290
+ #### Examples:
291
+
292
+ **Plain text paragraph:**
293
+ ```javascript
294
+ ['html', 'p', 'Please fill out all required fields marked with *', {}, {
295
+ class: 'instruction-text',
296
+ style: 'font-style: italic;'
297
+ }]
298
+ ```
299
+
300
+ **Section header with custom styling:**
301
+ ```javascript
302
+ ['html', 'h3', 'Personal Information', {}, {
303
+ class: 'form-section-header',
304
+ style: 'border-bottom: 2px solid #4338ca; margin-top: 2rem;'
305
+ }]
306
+ ```
307
+
308
+ **Warning message:**
309
+ ```javascript
310
+ ['html', 'div', '⚠️ Your session will expire in 5 minutes', {}, {
311
+ class: 'warning-banner',
312
+ role: 'alert'
313
+ }]
314
+ ```
315
+
316
+ **Complex HTML with nested elements:**
317
+ ```javascript
318
+ ['html', 'div', `
319
+ <div class="info-box">
320
+ <strong>Note:</strong>
321
+ <span>All fields are required unless marked optional</span>
322
+ </div>
323
+ `, {}, {
324
+ class: 'custom-wrapper'
325
+ }]
326
+ ```
327
+
328
+ **Resulting HTML structure:**
329
+ ```html
330
+ <div class="form-group" id="section-header-block">
331
+ <div id="section-header" class="info-message highlight" style="color: #4338ca; padding: 1rem;">
332
+ Your content here
333
+ </div>
334
+ </div>
188
335
  ```
189
336
 
190
- Once the server is running, you can view the form at:
337
+ Each HTML block is automatically wrapped in a `form-group` div for consistent spacing and layout with form fields.
191
338
 
192
- http://localhost:5173/registration
339
+ ### Conditional Logic
193
340
 
341
+ Show/hide fields based on other field values:
342
+
343
+ ```javascript
344
+ // Parent field with dependents
345
+ [
346
+ 'singleSelect', 'role', 'Role',
347
+ { required: true },
348
+ { dependents: ['topic', 'mode'] }, // Fields that depend on this
349
+ [
350
+ { value: 'attendee', label: 'Attendee' },
351
+ { value: 'presenter', label: 'Presenter' }
352
+ ]
353
+ ],
354
+
355
+ // Dependent field with string condition
356
+ [
357
+ 'text', 'topic', 'Presentation Topic',
358
+ {},
359
+ {
360
+ dependsOn: 'role',
361
+ condition: 'presenter' // Shows when role = 'presenter'
362
+ }
363
+ ],
364
+
365
+ // Dependent field with function condition
366
+ [
367
+ 'singleSelect', 'mode', 'Presentation Mode',
368
+ { required: true },
369
+ {
370
+ dependsOn: 'role',
371
+ condition: (value) => value === 'presenter' // Function condition
372
+ },
373
+ [
374
+ { value: 'virtual', label: 'Virtual' },
375
+ { value: 'physical', label: 'Physical' }
376
+ ]
377
+ ]
378
+ ```
194
379
 
195
380
  ## ✨ 1. Styling the Form
196
381
 
@@ -223,7 +408,7 @@ const formSettings = {
223
408
  theme: 'indigo'
224
409
  };
225
410
  ```
226
- If no theme is set, Formique will default to the dark theme.
411
+ If no theme is set, Formique will default to the light theme.
227
412
 
228
413
  ### Fine-Grained Theme Control
229
414
 
@@ -237,18 +422,17 @@ const formSettings = {
237
422
 
238
423
  ### Custom Styling
239
424
 
240
- Formique’s form classes are exposed for complete customization. You can target the form using `.formique`, and inputs with classes like `.formique-input`, `.formique-label`, `.formique-submit`. See section below.
425
+ Formique’s form classes are exposed for complete customization. You can target the form using `.formique`, and inputs with classes like `.form-input`, `.form-label`, `.form-submit-btn`. See section below.
241
426
 
242
427
  Example:
243
428
 
244
429
  ```css
245
- .formique-input {
430
+ .form-input {
246
431
  border-radius: 5px;
247
432
  padding: 10px;
248
433
  }
249
434
  ```
250
435
 
251
-
252
436
  ## 2. Styling and Sizing the Form Container
253
437
 
254
438
  Formique renders inside a container `<div>` that you specify by ID.
@@ -259,7 +443,7 @@ Formique renders inside a container `<div>` that you specify by ID.
259
443
  <div id="formique" class=""></div>
260
444
  ```
261
445
 
262
- ### ⚙Custom Container ID
446
+ ### ⚙ Custom Container ID
263
447
 
264
448
  You can use any custom container ID by declaring it in your `formSettings`:
265
449
 
@@ -277,10 +461,10 @@ And in your HTML:
277
461
 
278
462
  ### Built-in Container Size Classes
279
463
 
280
- Formique includes several responsive width utility classes that can be used directly on your form container:
464
+ Formique includes several responsive width utility classes:
281
465
 
282
466
  | Class Name | Description |
283
- | -- | -- |
467
+ |----------------|-------------------|
284
468
  | `width-full` | 100% width |
285
469
  | `width-half` | 50% width |
286
470
  | `width-medium` | 600px fixed width |
@@ -294,7 +478,7 @@ Example:
294
478
 
295
479
  ### Custom Inline Style Control
296
480
 
297
- If you want precise control over the container styling, use the `formContainerStyle` setting:
481
+ For precise container control:
298
482
 
299
483
  ```js
300
484
  const formSettings = {
@@ -302,17 +486,9 @@ const formSettings = {
302
486
  };
303
487
  ```
304
488
 
305
- > This will override the container’s `style` attribute directly.
306
-
307
-
308
-
309
-
310
- ## ✅ Complete List of `.formique`-Scoped CSS Classes
311
-
312
- Here is a clean, alphabetically grouped list of **all unique CSS class selectors** used in your Formique stylesheet:
313
-
314
- ### 📦 Container & Layout
489
+ ## Complete List of `.formique`-Scoped CSS Classes
315
490
 
491
+ ### Container & Layout
316
492
  * `.formique`
317
493
  * `.formique-form`
318
494
  * `.width-full`
@@ -321,8 +497,7 @@ Here is a clean, alphabetically grouped list of **all unique CSS class selectors
321
497
  * `.width-small`
322
498
  * `.width-custom`
323
499
 
324
- ### 🏷️ Labels & Inputs
325
-
500
+ ### Labels & Inputs
326
501
  * `.form-label`
327
502
  * `.form-input`
328
503
  * `.form-control`
@@ -331,15 +506,15 @@ Here is a clean, alphabetically grouped list of **all unique CSS class selectors
331
506
  * `.form-select-input`
332
507
  * `.form-radio-input`
333
508
  * `.form-checkbox-input`
509
+ * `.form-color-input`
334
510
 
335
- ### 📚 Input Wrappers
336
-
511
+ ### Input Wrappers
337
512
  * `.input-block`
338
513
  * `.radio-group`
339
514
  * `.checkbox-group`
515
+ * `.form-group`
340
516
 
341
- ### 🎨 Themes
342
-
517
+ ### Themes
343
518
  * `.custom-theme`
344
519
  * `.dark-theme`
345
520
  * `.light-theme`
@@ -357,73 +532,66 @@ Here is a clean, alphabetically grouped list of **all unique CSS class selectors
357
532
  * `.brown-theme`
358
533
  * `.orange-theme`
359
534
 
360
- ### 🚀 Button
361
-
535
+ ### Button
362
536
  * `.form-submit-btn`
363
537
 
364
- ### 🔁 Loading
365
-
538
+ ### Loading
366
539
  * `#formiqueSpinner`
367
540
  * `.formique-spinner`
368
541
  * `.formique-spinner .message`
369
542
 
370
543
  ### Status Messages
371
-
372
544
  * `.formique-success`
373
545
  * `.formique-error`
374
546
 
547
+ ## 3. Contact Form Quick Setup
375
548
 
549
+ Formique supports plug-and-play email contact forms.
376
550
 
377
- ## 📬 3. Contact Form Quick Setup
378
-
379
- Formique supports plug-and-play email contact forms using `@formique/semantq`.
380
-
381
- ### 🔧 Basic Email Contact Setup
551
+ ### Basic Email Contact Setup
382
552
 
383
553
  ```js
384
554
  const formSettings = {
385
555
  submitMode: 'email', // Required
386
556
  submitOnPage: true, // Required
387
- successMessage: 'Survey filled successfully', // Optional
388
- errorMessage: 'Something went wrong', // Optional
389
- sendTo: ['contacts@yourwebsite.com'] // Your actual email
557
+ successMessage: 'Message sent successfully!',
558
+ errorMessage: 'Something went wrong',
559
+ sendTo: ['contacts@yourwebsite.com'] // Recipient email(s)
390
560
  };
391
561
  ```
392
562
 
393
- ### 📑 Defining a Form Schema
394
-
395
- Create your form fields using a simple schema array:
563
+ ### Complete Contact Form Example
396
564
 
397
- ```js
565
+ ```javascript
398
566
  const formSchema = [
399
- ['text', 'name', 'Name', { required: true }],
400
- ['text', 'surname', 'Surname', { required: true }],
401
- ['email', 'email', 'Email', { required: true }, { style: 'color: red' }],
402
- ['textarea', 'message', 'Your Message here', { required: true }]
567
+ ['html', 'h3', 'Get in Touch', {}, {
568
+ class: 'form-section',
569
+ style: 'margin-top: 0;'
570
+ }],
571
+ ['text', 'name', 'Your Name', { required: true }],
572
+ ['email', 'email', 'Email Address', { required: true }],
573
+ ['text', 'subject', 'Subject', { required: true }],
574
+ ['textarea', 'message', 'Message', { required: true, minlength: 20 }, { rows: 5 }],
575
+ ['html', 'p', 'We\'ll respond within 24 hours', {}, {
576
+ class: 'form-note',
577
+ style: 'font-size: 0.9rem; color: #666;'
578
+ }],
579
+ ['submit', 'submit', 'Send Message']
403
580
  ];
404
- ```
405
-
406
- ### Schema Syntax Recap
407
581
 
408
- Each form field follows this format:
409
-
410
- ```js
411
- ['field type', 'field name', 'Label', { inlineValidation }, { inputAttributes }, [options]]
582
+ const formSettings = {
583
+ submitMode: 'email',
584
+ submitOnPage: true,
585
+ sendTo: ['hello@yourwebsite.com'],
586
+ theme: 'blue',
587
+ requiredFieldIndicator: true
588
+ };
412
589
  ```
413
590
 
414
- Examples:
415
-
416
- * `text`, `email`, `textarea`, `select`, `checkbox`, `radio`
417
- * Inline validation can include `{ required: true }`
418
- * Additional HTML attributes (like `style`, `placeholder`, etc.) are supported.
419
-
420
-
421
591
  ## ⚠️ Domain Verification for Email Submissions
422
592
 
423
593
  To enable email submissions, ensure your domain is **registered on your [useformique.com](https://useformique.com) account**.
424
594
 
425
595
  This is required for sender verification and spam protection.
426
596
 
427
-
428
- For more comprehensive details on Formique's features and usage and options visit the [Formique GitHub Repository](https://github.com/Gugulethu-Nyoni/formique).
429
-
597
+ For more comprehensive details on Formique's features and options, visit the [Formique GitHub Repository](https://github.com/Gugulethu-Nyoni/formique).