> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mainly.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# KVSelect

> A dropdown control that loads options dynamically from a remote JSON source.

```
KVSelect(source, placeholder="Select a value", type="secret")
```

# Example

```python theme={null}
from mirmod.controls import KVSelect

@wob.receiver("value", "api_key", control=KVSelect(source="https://api.example.com/keys", placeholder="Select an API key", type="secret"))
def receive_key(self, key):
  self.api_key = key
```

# How It Works

The `source` URL should return a JSON array of objects with `key` and `value` properties:

```json theme={null}
[
  { "key": "Option 1", "value": "opt1" },
  { "key": "Option 2", "value": "opt2" }
]
```

When the user types in the search box, a `?search=<query>` parameter is appended to the source URL, enabling server-side filtering.

# Parameters

| Name        | Type   | Description                                                                |
| ----------- | ------ | -------------------------------------------------------------------------- |
| source      | string | **Required.** URL to a JSON endpoint returning key-value options.          |
| placeholder | string | Hint text displayed when no option is selected. Default: "Select a value". |
| type        | string | Data type: `"secret"` or `"model"`. Default: "secret".                     |
