> For the complete documentation index, see [llms.txt](https://docs.carto.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.carto.com/carto-user-manual/maps/controls.md). Agents can also search and read this documentation through its [MCP server](https://docs.carto.com/~gitbook/mcp).

# Controls

**Controls** let viewers change what a Builder map shows. A viewer picks values in a control, and the layers and widgets on the linked source update. Controls can filter the data, like a list of states or a date range, or feed a value into a query, like a buffer distance or a threshold.

Viewers use controls in the bar above the map.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-f5edf58eefc1358b28936580cc2aa92c9907674e%2Fbuilder-controls-map.png?alt=media" alt="A map filtered by date, event type and state controls, with the date control open"><figcaption></figcaption></figure>

{% hint style="warning" %}
Controls are not currently supported for:

* Pre-generated tileset or raster sources.
* SQL placeholder controls on Databricks connections of the legacy REST type. Source column controls work on all Databricks connections.
  {% endhint %}

## Two ways to link a control

You choose how each control gets its values in its **Linking mode** setting:

* **Source column:** pick a data source and a column. The control reads its values from that column and filters the source, the same way a widget does. You don't write any SQL.
* **SQL placeholder:** the control feeds its value into your query through a placeholder like `{{name}}`, so the value can do anything SQL can do, not only filter.

|                                               | Source column           | SQL placeholder     |
| --------------------------------------------- | ----------------------- | ------------------- |
| Requires editing SQL                          | No                      | Yes                 |
| Values                                        | Read live from the data | Set in the control  |
| Number of values (text)                       | No limit                | Up to 1,000         |
| Control types                                 | Text, Date              | Text, Date, Numeric |
| Data sources                                  | Tables and SQL queries  | SQL queries         |
| Controls on the same source narrow each other | Yes                     | No                  |

Use **Source column** to filter by the values in a column, like a status, a region or a date. Use **SQL placeholder** when the value must change the query itself, like a buffer radius or a threshold. Both modes can live on the same map.

## Control types

* [**Text control**](https://docs.carto.com/carto-user-manual/maps/controls/text-control.md): viewers pick one or more values from a list. *E.g., choose POI types like 'Supermarket' or 'Restaurant'.*
* [**Date control**](https://docs.carto.com/carto-user-manual/maps/controls/date-control.md): viewers pick a date range. *E.g., analyze data for a specific month or the last 30 days.*
* [**Numeric control**](https://docs.carto.com/carto-user-manual/maps/controls/numeric-control.md): viewers pick a value or a range of numbers. SQL placeholder only. *E.g., control a buffer radius or a signal threshold.*

{% hint style="info" %}
Need support for other control types? [Let us know](https://cartohq.typeform.com/to/a4YHHwPS).
{% endhint %}

## The controls bar

Every control appears in the bar above the map, with its current value always visible. A control you change is highlighted in blue. Use its reset icon, or **Reset all** at the end of the bar, to go back to the defaults.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2Fgit-blob-dde028cc850daf11b3a614078dc48c461b6f85f8%2Fbuilder-controls-bar.png?alt=media" alt="The controls bar above the map"><figcaption></figcaption></figure>

**Source column controls on the same source narrow each other.** After picking Texas in a State control, a County control on the same source lists only counties in Texas.

## Example: build a map with controls

This example uses a public table of fires detected worldwide.

### Add a data source

* Go to "Add source from..."
* Choose "Custom SQL query"
* Select CARTO Data Warehouse
* Paste this example:

```sql
SELECT * FROM `carto-demo-data.demo_tables.fires_worldwide`
```

### Add a text control linked to a column

* In the **Controls** tab, click **Add control** and choose **Text**.
* Name it 'Day/Night'.
* Under **Linking mode**, select **Source column**, then your data source and the `daynight` column.

The control appears in the bar above the map, and the map updates when a viewer picks a value.

### Add a date control linked to a column

* Click **Add control** and choose **Date**.
* Name it 'Date'.
* Under **Linking mode**, select **Source column** and pick the `acq_date` column.
* Under **Default values**, keep **All dates** or choose a **Relative range**, like the last 30 days.

### Add a numeric control with a SQL placeholder

* Click **Add control** and choose **Numeric**.
* Name it 'Bright Temp' and, under **Selection**, choose **Range**.
* Enter the SQL names `{{bright_temp_from}}` and `{{bright_temp_to}}`, and the **min** and **max** values.

Open the SQL panel and add the placeholders to your query:

```sql
SELECT * FROM `carto-demo-data`.demo_tables.fires_worldwide
WHERE bright_ti4 >= {{bright_temp_from}} AND bright_ti4 <= {{bright_temp_to}}
```


---

# 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.carto.com/carto-user-manual/maps/controls.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.
