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

# Embed options

`Felt.embed()` takes an optional third argument that controls how the embedded map looks and behaves:

```typescript
const felt = await Felt.embed(container, FELT_MAP_ID, {
  uiControls: {
    showLegend: false,
    cooperativeGestures: false,
  },
  initialViewport: {
    center: { latitude: 40.7128, longitude: -74.006 },
    zoom: 10,
  },
});
```

## UI controls

All `uiControls` options are booleans:

| Option                | Default | Description                                                                                                                                                                                                                           |
| --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `showLegend`          | `true`  | Whether the legend is shown.                                                                                                                                                                                                          |
| `cooperativeGestures` | `true`  | Adjusted gesture behavior for embeds: on mobile, one-finger drag scrolls the page while two fingers pan the map; on desktop, scroll-to-zoom requires holding Ctrl/Cmd. Disable for app-like embeds where the map is the main content. |
| `fullScreenButton`    | `true`  | Shows a button that opens the map in a new tab or window.                                                                                                                                                                             |
| `geolocation`         | `false` | Shows a geolocation button that plots and tracks the visitor's position.                                                                                                                                                              |
| `zoomControls`        | `true`  | Shows the zoom controls (bottom right). Hiding them does not prevent zooming.                                                                                                                                                         |
| `scaleBar`            | `true`  | Shows the scale bar.                                                                                                                                                                                                                  |

You can change these after the map has loaded with [`updateUiControls`](https://developers.felt.com/js-sdk-api-reference/ui/uicontroller#updateuicontrols):

```typescript
felt.updateUiControls({ showLegend: false });
```

## Initial viewport

`initialViewport` overrides the map's saved viewport with a center and zoom for this embed:

```typescript
initialViewport: {
  center: { latitude: 40.7128, longitude: -74.006 },
  zoom: 10,
}
```

## Embedding private maps

Public and unlisted maps embed with no extra configuration. To embed a **private** map for visitors who aren't logged into Felt, generate a short-lived embed token server-side with the REST API and pass it as the `token` option:

1. Your server calls [`POST /api/v2/maps/{map_id}/embed_token?user_email=…`](https://felt.com/api/v2/openapi.json), using your [API token](/rest-api/authentication.md). The visitor's `user_email` is a required **query parameter**, not a body field, and that address should belong to a member of your workspace. The response contains a token valid for 15 minutes.
2. Your page passes that token to `Felt.embed`:

```typescript
const felt = await Felt.embed(container, FELT_MAP_ID, {
  token: embedTokenFromYourServer,
});
```

Never call the embed token endpoint from the browser — that would expose your API token. Generate embed tokens on your server and hand only the short-lived token to the client.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.felt.com/js-sdk/embed-options.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
