@ng-forge/dynamic-forms-bootstrap 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,83 @@
|
|
|
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-bootstrap
|
|
6
|
+
|
|
7
|
+
Bootstrap 5 field components for ng-forge dynamic forms.
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/@ng-forge/dynamic-forms-bootstrap)
|
|
10
|
+
[](https://opensource.org/licenses/MIT)
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @ng-forge/dynamic-forms @ng-forge/dynamic-forms-bootstrap bootstrap
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Setup
|
|
19
|
+
|
|
20
|
+
```scss
|
|
21
|
+
// styles.scss
|
|
22
|
+
@import 'bootstrap/dist/css/bootstrap.min.css';
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
// app.config.ts
|
|
27
|
+
import { provideDynamicForm } from '@ng-forge/dynamic-forms';
|
|
28
|
+
import { withBootstrapFields } from '@ng-forge/dynamic-forms-bootstrap';
|
|
29
|
+
|
|
30
|
+
export const appConfig: ApplicationConfig = {
|
|
31
|
+
providers: [provideDynamicForm(...withBootstrapFields())],
|
|
32
|
+
};
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { DynamicForm, type FormConfig, type InferFormValue } from '@ng-forge/dynamic-forms';
|
|
39
|
+
|
|
40
|
+
@Component({
|
|
41
|
+
imports: [DynamicForm],
|
|
42
|
+
template: `<form [dynamic-form]="config" (submitted)="onSubmit($event)"></form>`,
|
|
43
|
+
})
|
|
44
|
+
export class MyFormComponent {
|
|
45
|
+
config = {
|
|
46
|
+
fields: [
|
|
47
|
+
{ key: 'email', type: 'input', value: '', label: 'Email', required: true, email: true, props: { floatingLabel: true } },
|
|
48
|
+
{ type: 'submit', key: 'submit', label: 'Submit', props: { variant: 'primary' } },
|
|
49
|
+
],
|
|
50
|
+
} as const satisfies FormConfig;
|
|
51
|
+
|
|
52
|
+
onSubmit(value: InferFormValue<typeof this.config.fields>) {
|
|
53
|
+
console.log('Form submitted:', value);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Global Configuration
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
provideDynamicForm(
|
|
62
|
+
...withBootstrapFields({
|
|
63
|
+
floatingLabel: true,
|
|
64
|
+
size: 'lg',
|
|
65
|
+
variant: 'primary',
|
|
66
|
+
}),
|
|
67
|
+
);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Field Types
|
|
71
|
+
|
|
72
|
+
Input, Select, Checkbox, Toggle, Button, Submit, Next, Previous, Textarea, Radio, Multi-Checkbox, Datepicker, Slider
|
|
73
|
+
|
|
74
|
+
## Documentation
|
|
75
|
+
|
|
76
|
+
- [Bootstrap Integration](https://ng-forge.com/dynamic-forms/ui-libs-integrations/bootstrap)
|
|
77
|
+
- [Field Types](https://ng-forge.com/dynamic-forms/core/field-types)
|
|
78
|
+
- [Validation](https://ng-forge.com/dynamic-forms/core/validation)
|
|
79
|
+
- [Conditional Logic](https://ng-forge.com/dynamic-forms/core/conditional-logic)
|
|
80
|
+
|
|
81
|
+
## License
|
|
82
|
+
|
|
83
|
+
MIT © ng-forge
|