# Setting up a Configuration Flow with Dynamic Selection Options

**Dynamic flows** enable you to populate field options in real-time by connecting to live data sources. Instead of using static values, you can fetch options from APIs or other flows, making your configuration adaptive and data-driven.

## **Configuring a Dynamic Selector**

For instance, if you’re building a configuration for a file picker widget, you might include:

* **Array variable (files)** – this represents the list of files that will appear dynamically through a selection flow.

{% hint style="info" %}
In an **array variable**, multiple options can be selected from the widget.\
If you want to allow **only a single option selection**, use an **object variable** instead.
{% endhint %}

> `files` can be defined as an array to allow multiple file selections, or as an object for single file selection.

* Open the three-dot menu next to the field and select **Options**.

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2FKZxE8iz4O2TkjXCTp7Xx%2Fimage.png?alt=media&#x26;token=63353085-52c7-415c-b6c6-80e54e8b07e9" alt=""><figcaption></figcaption></figure>

* Configure the following sections:

#### **Selections Section**

This is where you make the configuration dynamic:

* **Enable Selections** – Turn on dynamic option fetching.
* **Selection Type** – Choose **Dynamic**.
  * *Dynamic selections* fetch their options from another flow in real time (for example, a selection flow that retrieves a list of files).
* **Selection Flow** – Choose which **Selection Flow** will power this dynamic data (e.g., a flow named `getFiles`).

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2FgxnQvG9QhmtxPqBu9cmb%2Fimage.png?alt=media&#x26;token=7ba97d93-9ba8-44fd-b0ad-a7494ce13384" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Once selected, the data returned by that flow (like file names or IDs) will automatically appear in the file picker UI inside your widget.
{% endhint %}

### **Configure Pagination Rules**

For dynamic data sets that return large lists (such as files, customers, or records), define pagination logic within the **Selections** section.

#### **Pagination Settings**

* **Pagination Type:**
  * **Cursor** – Uses a pointer to fetch results in chunks.
  * **Offset** – Uses index-based offsets to load data progressively.

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2FfdyGHIMwC3tg2Mi9qPOG%2Fimage.png?alt=media&#x26;token=f7779104-0019-44db-a4a7-4b10736e4acb" alt=""><figcaption></figcaption></figure>

* **Limit:**\
  Defines the number of records to retrieve per chunk.\
  For example, setting a limit of `50` means results will be fetched in batches of 50.

The pagination ensures smoother UI performance and prevents timeouts when loading large data sets.

### **Link to a Selection Flow**

After configuring pagination, select the **Selection Flow** that will supply your data dynamically.\
For example:

* **Selection Flow:** A flow that defines the selection of your Google files.

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2FWNGsDn1acOsKo8hZKRed%2Fimage.png?alt=media&#x26;token=44c8f13e-0359-403a-8dd7-b0aa6cad770b" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
When you save this configuration, your widget’s file picker will use the `Gcsgetfiles` flow to fetch available files dynamically.
{% endhint %}

> Users will then see a **file picker UI** that allows them to select files based on live data returned by that selection flow.

### **How It Appears in the Widget?**

Once saved, the configuration flow appears inside your widget as a **file picker** (or equivalent dynamic component).

\
The widget automatically:

* Fetches available options using the connected selection flow.

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2FiLZXi3mFeu4gayNwvCCd%2Fimage.png?alt=media&#x26;token=3d347c03-0f80-4b7e-a11d-6866bdfbdc63" alt=""><figcaption></figcaption></figure>

* Applies pagination rules (Cursor/Offset + Limit).

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2FIZIy339HY5ZfAW560q5W%2Fimage.png?alt=media&#x26;token=c3eb8dfa-8a98-4040-b115-a1110fb142f6" alt=""><figcaption></figcaption></figure>

* Reflects the field behaviors you set (hidden, disabled, or dependent visibility).

<figure><img src="https://1255842839-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3iSr2Tx8FvvuoLPncziH%2Fuploads%2F1MuksetMCnYxWdE77cHf%2Fimage.png?alt=media&#x26;token=6b1be0bf-aa46-4a78-8361-4fd0b28cd490" alt=""><figcaption></figcaption></figure>

> This creates a seamless dynamic experience, allowing end-users to select real-time data (e.g., files, connectors, records) directly from your Fastn widget.
