# Add "options" to custom field type

**URL:** https://forum.litium.com/t/add-options-to-custom-field-type/1882
**Category:** Questions
**Tags:** field-framework, litium-7
**Created:** [February 15, 2021, 3:21pm UTC](https://forum.litium.com/t/add-options-to-custom-field-type/1882 "2021-02-15T15:21:48Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![adam.clettborn](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/adam.clettborn/32/956_2.png) [@adam.clettborn](https://forum.litium.com/u/adam.clettborn)
#### Post date: [February 15, 2021, 3:21pm UTC](https://forum.litium.com/t/add-options-to-custom-field-type/1882/1 "2021-02-15T15:21:49Z")

</div>

Hi,

I’m creating a custom field type by following [this guide](https://docs.litium.com/documentation/architecture/field-framework/creating-a-custom-field-type). Now, I want to add some customization to the field by providing similar “options” as the TextOption field, where you can add your own options to the dropdown with a label and a value.

How do I do this for my custom field? The IEditFieldTypeConverter class contains a function, “CreateOptionsModel”, which I guess has something to do with it, but there’s no documentation what to do with this function or if its the right one.

Any pointer would be of help! 🙂

Litium version: 7.6.1

---

<div class="post-metadata">

### Author: ![adam.clettborn](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/adam.clettborn/32/956_2.png) [@adam.clettborn](https://forum.litium.com/u/adam.clettborn)
#### Post date: [February 15, 2021, 5:17pm UTC](https://forum.litium.com/t/add-options-to-custom-field-type/1882/2 "2021-02-15T17:17:09Z")

</div>

Progress…

I found some ancient examples where `new TextOption();` was returned in the `CreateOptionsModel()` which partially works. The “options” collapsible is now visible in the backoffice when configuring the field. However, it looks like I have to rebuild the whole “TextOption” options view?

When inspecting the html code of normal TextOption field when configuring it, I can see that a directive is used, `field-editor-text-option-setting`, but there’s no documentation for this as well.

I created a plain angular component and included it in the “declarations” array in the extensions.ts file, and then set the name of `SettingsComponentName` to `Accelerator#TestSettings` which showed the settings component. But, I’d rather not rebuild the TextOption settings view, if possible.

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/bc0454b41a31640749c3f39a4b8f0f90ece34844.png)

---

<div class="post-metadata">

### Author: ![NilsN](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/nilsn/32/302_2.png) [@NilsN](https://forum.litium.com/u/NilsN)
#### Post date: [February 16, 2021, 8:19am UTC](https://forum.litium.com/t/add-options-to-custom-field-type/1882/3 "2021-02-16T08:19:57Z")

</div>

I think you could re-use the standard settings component, try using `FieldEditorTextOptionSetting` as your `SettingsComponentName`.

---

<div class="post-metadata">

### Author: ![adam.clettborn](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/adam.clettborn/32/956_2.png) [@adam.clettborn](https://forum.litium.com/u/adam.clettborn)
#### Post date: [February 16, 2021, 10:22am UTC](https://forum.litium.com/t/add-options-to-custom-field-type/1882/4 "2021-02-16T10:22:55Z")

</div>

Worked great.

Another question, is it possible to translate website strings in the component? I can’t find any documentation for this as well.

---

<div class="post-metadata">

### Author: ![NilsN](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/nilsn/32/302_2.png) [@NilsN](https://forum.litium.com/u/NilsN)
#### Post date: [February 16, 2021, 11:03am UTC](https://forum.litium.com/t/add-options-to-custom-field-type/1882/5 "2021-02-16T11:03:11Z")

</div>

Yes, keys and translations can be added to the resource files in the Accelerator to use translated strings in your field component. You can see in the FilterField from the Accelerator:

```auto
    <div title>
        {{ 'dialog.sortDialog.fields.title' | translate }}
    </div>

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)
#### Post date: [March 16, 2021, 11:03am UTC](https://forum.litium.com/t/add-options-to-custom-field-type/1882/6 "2021-03-16T11:03:49Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
