# @yuuvis/client-framework/object-form

Secondary entry point of `@yuuvis/client-framework`. It can be used by importing from `@yuuvis/client-framework/object-form`.

Components for rendering object forms. These forms are generated from object types (OT) or secondary object types (SOT). Each property of the type will be presented with a matching form field base on the property definition.

## Extending a form

The `object-form` component can be provided with extensions for certain fields. To do so, you have to create a component that extends `ObjectFormElementExtension`, which will give you access to the form, the fields value an an API to interact with the form:

```ts
import { ObjectFormElementExtension } from '@yuuvis/client-framework/object-form';

@Component({
  selector: 'form-extension',
  imports: [],
  templateUrl: './form-extension.component.html',
  styleUrl: './form-extension.component.scss'
})
export class FormExtensionComponent extends ObjectFormElementExtension {
    // implement your extension logic
}
```

You need to be aware that the component you create will be rendered beside the connected form control within the form. So make sure to respect the size (height in particular) of the form field.

Once you implemented your extension, you have to add it to the form:

```ts
import { IObjectFormElementExtension } from '@yuuvis/client-framework/object-form';


formExtensions: IObjectFormElementExtension[] = [
    {
        // name of the object type mproperty to connect the extension to
        property: 'name',
        // the extension component
        cmp: FormExtensionComponent
    }
];
```

```html
<yuv-object-form [elementExtensions]="formExtensions" [formOptions]="fo"></yuv-object-form>
```

