> For the complete documentation index, see [llms.txt](https://help.felt.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.felt.com/developers/extensions.md).

# Extensions

Describe an interactive tool and Felt AI builds it as a custom extension on your map, such as a panel that responds to clicks.

{% hint style="success" %}
Available on the Business and Enterprise plans. [Compare plans](https://felt.com/pricing#compare)
{% endhint %}

Add an extension to give people interactive tools on your map, such as a panel that responds to clicks or a filter they draw. Describe what you want the extension to do, and Felt AI generates the code. Felt hosts the extension with the map.

Anyone viewing the map can use an extension, without a seat or extra access.

{% embed url="<https://youtu.be/0bB6JY-3SCc>" %}

## What a custom extension can do

A custom extension can do anything the [JavaScript SDK](https://developers.felt.com/js-sdk-api-reference/) supports on the map where it runs. For example, it can:

* Respond when someone clicks a feature, draws a shape, or moves the map.
* Read features and their attributes from the map's layers.
* Show, hide, filter, and restyle layers.
* Draw temporary lines, points, or areas, which aren't saved to the map's layers.
* Add panels, buttons, dropdowns, and text inputs to the map.
* Request data from other web services.

Felt has no built-in story maps, saved views, bookmarks, or tours, but a custom extension or the [JavaScript SDK](/developers/javascript-sdk.md) can build a story-map-like experience.

Custom extensions run in a sandbox: a web worker in the browser of each person viewing the map. Extension code has no `window` or `document`, can't access the surrounding page, and can't call the Felt REST API as that person. The REST API can't add extensions to a map.

You can load third-party JavaScript libraries, such as Turf for spatial calculations, from a URL with `importScripts`. Libraries that draw into the page, such as most charting and mapping libraries, don't work. Build panels and controls with the JavaScript SDK instead.

{% hint style="warning" %}
Anyone who can open the map can read the extension's code, including any API key in it. Use only keys that are meant to be public, such as a Mapbox public access token.
{% endhint %}

## Examples

### Neighborhood comparison

A panel compares two neighborhoods.

<figure><img src="https://217108486-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmRfGitkyjOEMvVsEyGWN%2Fuploads%2F9KJ3zPqydDmw67RimosP%2F686ecfd33bdd674450f5fd6d_neighborhood-comparison.gif?alt=media&amp;token=b10c2ce7-4ac6-4090-bec7-67da64e15dc5" alt="Neighborhood Comparison panel comparing Nob Hill and North Beach in San Francisco, with land use parcels shaded on the map."><figcaption></figcaption></figure>

### River animation

The Mississippi River network glows at a speed you set.

<figure><img src="https://217108486-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmRfGitkyjOEMvVsEyGWN%2Fuploads%2FP6vHmfQaUWfgoZ6iR1OI%2F686ecfe47189a44fb1cc30ed_river-animation.gif?alt=media&amp;token=73a26854-89d2-4949-b51a-8c63a7cf0687" alt="Mississippi River Basin animation panel with an Animation Speed setting, and the river network glowing on a dark map."><figcaption></figcaption></figure>

### Commuter flows

Clicking a county draws lines to its commuters' destinations.

<figure><img src="https://217108486-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmRfGitkyjOEMvVsEyGWN%2Fuploads%2Fo3qg1zv1o84NsVgLKXLo%2F686ecfa63bdd560ae06dcd55_commuter-flows.gif?alt=media&amp;token=9b238686-938d-4b20-9ca0-c4653c381961" alt="Lines from Cook County, Illinois, to commuter destination counties, with a panel of commuters by mode, travel mode, and flow direction."><figcaption></figcaption></figure>

## Create a custom extension with Felt AI

1. On the map, click **Edit map**.
2. In the toolbar, click **Developer Platform** > **Custom extension**. The Extension editor opens.
3. In the **Felt AI** tab, describe what the extension should do and press **Enter**. Felt AI writes the code.
4. Click **Run**. The **Preview** shows the map with the extension running.
5. Optional: Ask Felt AI for changes or edit the code yourself, then click **Run** again.
6. Optional: In the name field at the top of the code editor, enter a name.
7. Click **Save**. The extension appears in the **Extensions** section of the legend.

Example descriptions:

* "When someone clicks a point, show a popup with the nearest 3 schools."
* "Create a story map about the seven wonders of the world."

For more ways to phrase a request, see [Prompting tips](/felt-ai/prompting-tips.md).

If the extension has errors, click the **Felt AI** tab, then **Fix errors**. The **Console** tab shows every log and error from the preview.

<figure><img src="https://217108486-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmRfGitkyjOEMvVsEyGWN%2Fuploads%2Fgit-blob-d56e5636366f268622cf51885d5124301bf6663f%2Fextension-editor.png?alt=media" alt="Extension editor with the code editor at the top left, the Felt AI and Console tabs below it, and the Preview map on the right."><figcaption></figcaption></figure>

## Where extensions run

Extensions run in view mode, including in [embeds](/share/embed-a-map.md) and on public maps. In edit mode, they're listed but inactive. Click **Done** to try one, or use the Extension editor's **Preview**.

## Manage extensions

In edit mode, click an extension in the **Extensions** section of the legend to edit it, or drag it to change its position in the list. The **···** menu on an extension has **Copy**, **Duplicate**, and **Delete**. To reuse a custom extension on another map, click **Copy**, open the other map in edit mode, and press **Cmd+V** (Mac) or **Ctrl+V** (Windows).

## Built-in map tools

[Search](/tools/search.md), [Measure](/tools/measure.md), Table, and Compare are tools every map has, not extensions.


---

# 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://help.felt.com/developers/extensions.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.
