@ng-forge/dynamic-forms-material 0.1.0

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 ADDED
@@ -0,0 +1,86 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/ng-forge/ng-forge/main/logo-light.svg" alt="ng-forge logo" width="400"/>
3
+ </p>
4
+
5
+ # @ng-forge/dynamic-forms-material
6
+
7
+ Material Design field components for ng-forge dynamic forms.
8
+
9
+ [![npm version](https://img.shields.io/npm/v/@ng-forge/dynamic-forms-material.svg)](https://www.npmjs.com/package/@ng-forge/dynamic-forms-material)
10
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install @ng-forge/dynamic-forms @ng-forge/dynamic-forms-material @angular/material
16
+ ```
17
+
18
+ ## Setup
19
+
20
+ ```typescript
21
+ // app.config.ts
22
+ import { provideDynamicForm } from '@ng-forge/dynamic-forms';
23
+ import { withMaterialFields } from '@ng-forge/dynamic-forms-material';
24
+
25
+ export const appConfig: ApplicationConfig = {
26
+ providers: [provideDynamicForm(...withMaterialFields())],
27
+ };
28
+ ```
29
+
30
+ ## Usage
31
+
32
+ ```typescript
33
+ import { DynamicForm, type FormConfig, type InferFormValue } from '@ng-forge/dynamic-forms';
34
+
35
+ @Component({
36
+ imports: [DynamicForm],
37
+ template: `<form [dynamic-form]="config" (submitted)="onSubmit($event)"></form>`,
38
+ })
39
+ export class ContactFormComponent {
40
+ config = {
41
+ fields: [
42
+ { key: 'name', type: 'input', value: '', label: 'Name', required: true, props: { appearance: 'outline' } },
43
+ {
44
+ key: 'email',
45
+ type: 'input',
46
+ value: '',
47
+ label: 'Email',
48
+ required: true,
49
+ email: true,
50
+ props: { appearance: 'outline', prefixIcon: 'email' },
51
+ },
52
+ { type: 'submit', key: 'submit', label: 'Send', props: { color: 'primary' } },
53
+ ],
54
+ } as const satisfies FormConfig;
55
+
56
+ onSubmit(value: InferFormValue<typeof this.config.fields>) {
57
+ console.log('Form submitted:', value);
58
+ }
59
+ }
60
+ ```
61
+
62
+ ## Global Configuration
63
+
64
+ ```typescript
65
+ provideDynamicForm(
66
+ ...withMaterialFields({
67
+ appearance: 'outline',
68
+ subscriptSizing: 'dynamic',
69
+ }),
70
+ );
71
+ ```
72
+
73
+ ## Field Types
74
+
75
+ Input, Textarea, Select, Checkbox, Radio, Datepicker, Slider, Toggle, Multi-Checkbox, Button, Submit, Next, Previous
76
+
77
+ ## Documentation
78
+
79
+ - [Material Integration](https://ng-forge.com/dynamic-forms/ui-libs-integrations/material)
80
+ - [Field Types](https://ng-forge.com/dynamic-forms/core/field-types)
81
+ - [Validation](https://ng-forge.com/dynamic-forms/core/validation)
82
+ - [Conditional Logic](https://ng-forge.com/dynamic-forms/core/conditional-logic)
83
+
84
+ ## License
85
+
86
+ MIT © ng-forge