> For the complete documentation index, see [llms.txt](https://docs.uibakery.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uibakery.io/concepts/components/work-with-components/field-types-and-types-recognition/select-tag-field-utilizing-tag-mapper.md).

# Select/Tag field: Utilizing Tag mapper

Let's say you have a Table with a Select/Tag column, and you want the items that have already been selected and are displayed in the table to not show in the dropdown. It may be useful, for example, when you don't want users to select one item multiple times.

In this case, you can use the **Tag mapper** setting for this field type. Here's an example how you can configure it in your app:

1. Create an action that will **return your table data** - select the *JavaScript Code* type and specify your data in the code, for example:

```javascript
[
  {"id": 1, "tag": 0},
  {"id": 2, "tag": 2},
  {"id": 3, "tag": 1},
]
```

{% hint style="info" %}
We've specified tag values here that match their titles.
{% endhint %}

2. Assign this action to the table.
3. Next, create another action that will **return all available tag options** - select the *JavaScript Code* type and specify the options in the code, for example:

```javascript
return [
  { value: 0, title: 'Innovate' },
  { value: 1, title: 'Synergy' },
  { value: 2, title: 'Dynamic' },
  { value: 3, title: 'Strategic' },
  { value: 4, title: 'Sustainable' },
  ];
```

4. Add this action to the Select/Tag column's **Options** field in the JS mode:

```javascript
{{actions.availableOptions.data}}
```

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2F1hdKKqAvbH8jiPbe5rCR%2FCleanShot%202025-05-26%20at%2013.41.16%402x-min.png?alt=media&amp;token=7ffcf881-f933-4cac-b371-777002f9c4c9" alt=""><figcaption></figcaption></figure>

Or, alternatively, you can specify there the following code to additionally display the selected value in the *Edit mode*:

```javascript
const options = [...{{actions.availableOptions.data}}];
if ({{value}}) {
  const valueOption = {{actions.allOptions.data.find(o => o.value === value)}};
  options.unshift(valueOption);
}
return options;
```

5. Finally, create an action that will **return only the options NOT selected** - select the *JavaScript Code* type and specify your code, for example:

```javascript
return {{actions.allOptions.data}}?.filter((option) => {
  return !{{ui.table.value}}.find(item => item.tag === option.value);
});
```

{% hint style="warning" %}
Make sure to toggle on **Reactive trigger, run on components' changes** in the *Setup* step of this action.
{% endhint %}

<figure><img src="https://837703843-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUX6zPRMFFK0yrTghj7cY%2Fuploads%2FRmyNNmrJdXo7srRCvZpW%2FCleanShot%202025-05-26%20at%2013.45.16%402x-min.png?alt=media&amp;token=158ce969-001b-4726-a104-acdf4822220c" alt=""><figcaption></figcaption></figure>

6. Now, click the Select/Tag column and open its **View settings** section.
7. Locate the **Tag mapper** field and specify the following code to return the values not selected in the table:

```javascript
{{actions.allOptions.data.find(i => value === i.value).title}}
```

Now, when you select a value from the dropdown, it will be added to the table and will no longer be available for selection.

{% @arcade/embed flowId="pQPVAmHJMjl7B95rf1go" url="<https://app.arcade.software/share/pQPVAmHJMjl7B95rf1go>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.uibakery.io/concepts/components/work-with-components/field-types-and-types-recognition/select-tag-field-utilizing-tag-mapper.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
