> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/flow/tutorials/components/visual-picker/limit-and-preselect-visual-picker-choices.md).

# Limit and pre-select Visual Picker choices

Let users pick several Visual Picker cards in a screen flow, between a minimum and a maximum, with one card already selected when the screen opens.

A customer success rep plans a new customer's onboarding. The package includes two to three training modules, and every customer gets Account Setup. The screen shows the five modules as cards, starts with Account Setup ticked, stops the rep at three, and refuses to continue with fewer than two.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FyHIBHRvDPr9rUVgO75gK%2Fvisual-picker-limit-and-preselect-visual-picker-choices-result.png?alt=media" alt="Visual Picker with five onboarding module cards, three ticked and the other two greyed out because the maximum is reached"><figcaption><p>At three picks, the remaining modules are locked.</p></figcaption></figure>

## Before you start

* The [Avonni Flow Screen Components](https://docs.avonnicomponents.com/flow/getting-started/installation-and-licenses-management.md) package is installed and you have its permission set.
* You can add Visual Picker items by hand. [Build Visual Picker items by hand](https://docs.avonnicomponents.com/flow/tutorials/components/visual-picker/build-visual-picker-items.md) walks through it.

## Steps

{% stepper %}
{% step %}

### Add the five modules

Open a **Screen** element, drag the Avonni **Visual Picker** onto it and give it the API Name `Onboarding_Modules`. In the **Properties** tab, set **Label** to `Onboarding modules (2 to 3)`.

Set **Data Source** to **Manual** and add five **Items**:

| **Figure Title**       | **Value**       |
| ---------------------- | --------------- |
| Account Setup          | `account-setup` |
| Data Import            | `data-import`   |
| Reports and Dashboards | `reports`       |
| Mobile App             | `mobile`        |
| Integrations           | `integrations`  |

Card titles do not wrap: a long one is cut with an ellipsis. Set **Size** to **X-Large** and **Ratio** to **16-by-9** so "Reports and Dashboards" fits.
{% endstep %}

{% step %}

### Allow several picks

Set **Type** to **Checkbox**. With the default, **Radio**, a second click replaces the first pick.

Switching to **Checkbox** also swaps **Value** for **Value Collection** in the panel, and adds **Min** and **Max**.
{% endstep %}

{% step %}

### Pre-select Account Setup

In **Value Collection**, add one entry: `account-setup`. The screen opens with that card already ticked. The rep can still untick it. If the rep leaves it as is, it still reaches the **Value** output after **Next**.

Enter the item's **Value**, not its title. To pre-select from data instead, map **Value Collection** to a Text collection variable.
{% endstep %}

{% step %}

### Set the minimum and the maximum

The panel has two **Advanced Options** toggles: the first opens the image settings. Click the second one to show **Min** and **Max**:

* **Min**: `2`. With fewer picks, **Next** shows an error under the picker and the flow stays on the screen.
* **Max**: `3`. Once three cards are ticked, the other cards are disabled until the rep unticks one.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FK7lHkXV4jEbGzMljIZj8%2Fvisual-picker-limit-and-preselect-visual-picker-choices-properties.png?alt=media" alt="Visual Picker properties with Type set to Checkbox, Value Collection holding account-setup, and Advanced Options open with Min 2 and Max 3" width="375"><figcaption><p>Checkbox, one pre-selected value, and Min and Max under Advanced Options.</p></figcaption></figure>

The pre-selected card counts. Account Setup plus one more already meets the minimum.
{% endstep %}

{% step %}

### Decide whether you need Required

**Required** blocks **Next** when nothing is picked. Here **Min** `2` already blocks an empty selection, so leave **Required** off.

Turn on **Required** when one pick is enough and you set no **Min**.
{% endstep %}

{% step %}

### Read the picks after the screen

Two outputs carry the selection:

* **Value Collection**: a Text collection, one entry per ticked card. Loop over `{!Onboarding_Modules.valueCollection}` to create one record per module.
* **Value**: the same values in one text, separated by semicolons (`account-setup;reports`). This is the format of a multi-select picklist field. See [Save multiple picks to a picklist field](https://docs.avonnicomponents.com/flow/tutorials/components/visual-picker/save-multiple-picks-to-a-picklist-field.md).
  {% endstep %}

{% step %}

### Save and test

Save the flow and click **Debug**. Account Setup is ticked when the screen opens. Tick Reports and Dashboards and Mobile App: the two remaining cards turn gray and can't be clicked.

Untick Mobile App: they come back. Leave only Account Setup ticked and click **Next**: an error appears under the picker and the flow does not move on.
{% endstep %}
{% endstepper %}

## Troubleshooting

<details>

<summary>Min and Max are not in the panel</summary>

**Type** is still **Radio**. Both settings exist only for **Checkbox**. Once **Type** is **Checkbox**, look under **Advanced Options**.

</details>

<details>

<summary>No card is pre-selected</summary>

**Value Collection** holds the card's title (`Account Setup`) instead of its **Value** (`account-setup`). The picker matches on **Value** only.

</details>

<details>

<summary>With Max at 1, a new click replaces the pick</summary>

That is how **Max** `1` works: the picker behaves like **Radio**, except that the rep can untick the card and leave the selection empty.

</details>

## Related tutorials

* [Save multiple picks to a picklist field](https://docs.avonnicomponents.com/flow/tutorials/components/visual-picker/save-multiple-picks-to-a-picklist-field.md): write the ticked cards into a multi-select picklist field.
* [Build Visual Picker items by hand](https://docs.avonnicomponents.com/flow/tutorials/components/visual-picker/build-visual-picker-items.md): icons, tags and locked cards.
* [Visual Picker](https://docs.avonnicomponents.com/flow/flow-components/visual-picker.md): every property and output variable.


---

# 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.avonnicomponents.com/flow/tutorials/components/visual-picker/limit-and-preselect-visual-picker-choices.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.
