--- title: Auto Form Components group: Component Gallery --- ## AutoForm The `AutoForm` component is a generic form component that can be used to create and wire a traditional Form for any Request DTO definition where successful responses can be handled the `@success` event, e.g: ```html

Results

```

Results

These Auto Form components are customizable with the [declarative C# UI Attributes](/locode/declarative#ui-metadata-attributes) where you can override the form's **heading** with `[Description]` and include a **subHeading** with `[Notes]` which supports rich HTML markup. **AutoForm Properties** Alternatively they can be specified in the components properties: ```ts defineProps<{ type: string|InstanceType|Function modelValue?: ApiRequest|any heading?: string subHeading?: string showLoading?: boolean jsconfig?: string //= eccn,edv configureField?: (field:InputProp) => void /* Default Styles */ formClass?: string //= shadow sm:rounded-md innerFormClass?: string bodyClass?: string headerClass?: string //= p-6 buttonsClass?: string //= mt-4 px-4 py-3 bg-gray-50 dark:bg-gray-900 sm:px-6 flex justify-between headingClass?: string //= text-lg font-medium leading-6 text-gray-900 dark:text-gray-100 subHeadingClass?: string submitLabel?: string //= Submit }>() ``` Both `@success` and `@error` events are fired after each API call, although built-in validation binding means it's typically unnecessary to manually handle error responses. ```ts defineEmits<{ (e:'success', response:any): void (e:'error', error:ResponseStatus): void (e:'update:modelValue', model:any): void }>() ``` **Model Binding** Forms can be bound to a Request DTO model where it can be used to pre-populate the Forms default values and Request DTO whereby specifying a **type** is no longer necessary: ```ts ```
## Create Form `AutoCreateForm` can be used to create an automated form based on a [AutoQuery CRUD](/autoquery/crud) Create Request DTO definition which can be rendered in a traditional inline Form with **card** formStyle option, e.g: ```html ```
By default Auto Forms are rendered in a `SlideOver` dialog: ```html ``` These Auto Forms are powered by the rich [App Metadata](/vue/use-metadata) surrounding your APIs, which contain all the necessary metadata to invoke the API and bind any contextual validation errors adjacent to the invalid field inputs. ## Edit Form `AutoEditForm` can be used to render an automated form based on Update and Delete [AutoQuery CRUD](/autoquery/crud) APIs which also makes use of **heading** and **sub-heading** customization options: ```html ``` The same form rendered in a traditional inline form with a **card** formStyle with some more advanced customization examples using rich markup in custom `