@ng-forge/dynamic-forms-bootstrap
v0.1.3
Published
Bootstrap 5 integration for @ng-forge/dynamic-forms. Pre-built Bootstrap form components.
Maintainers
Readme
@ng-forge/dynamic-forms-bootstrap
Bootstrap 5 field components for @ng-forge/dynamic-forms.
Experimental API Notice: This library uses Angular's experimental Signal Forms API. Angular may introduce breaking changes in patch releases. Check the compatibility matrix below.
Compatibility
| @ng-forge/dynamic-forms-bootstrap | @ng-forge/dynamic-forms | Angular | | --------------------------------- | ----------------------- | ------------- | | 0.1.1+ | 0.1.1+ | >=21.0.2 | | 0.1.0 | 0.1.0 | 21.0.0-21.0.1 |
Installation
npm install @ng-forge/dynamic-forms @ng-forge/dynamic-forms-bootstrap bootstrapSetup
// styles.scss
@import 'bootstrap/dist/css/bootstrap.min.css';// app.config.ts
import { provideDynamicForm } from '@ng-forge/dynamic-forms';
import { withBootstrapFields } from '@ng-forge/dynamic-forms-bootstrap';
export const appConfig: ApplicationConfig = {
providers: [provideDynamicForm(...withBootstrapFields())],
};Usage
import { DynamicForm, type FormConfig, type InferFormValue } from '@ng-forge/dynamic-forms';
@Component({
imports: [DynamicForm],
template: `<form [dynamic-form]="config" (submitted)="onSubmit($event)"></form>`,
})
export class MyFormComponent {
config = {
fields: [
{ key: 'email', type: 'input', value: '', label: 'Email', required: true, email: true, props: { floatingLabel: true } },
{ type: 'submit', key: 'submit', label: 'Submit', props: { variant: 'primary' } },
],
} as const satisfies FormConfig;
onSubmit(value: InferFormValue<typeof this.config.fields>) {
console.log('Form submitted:', value);
}
}Global Configuration
provideDynamicForm(
...withBootstrapFields({
floatingLabel: true,
size: 'lg',
variant: 'primary',
}),
);Field Types
Input, Select, Checkbox, Toggle, Button, Submit, Next, Previous, Textarea, Radio, Multi-Checkbox, Datepicker, Slider
Documentation
Changelog
See GitHub Releases.
Contributing
Contributions are welcome! Please read our Contributing Guide.
License
MIT © ng-forge
