Getting started

The Felt SDK allows you to control your Felt maps and build powerful, interactive custom applications. You can control many aspects of the Felt UI and map contents, as well as receive notifications of events happening in the map such as clicks, selections, and more.

This feature is available to customers on the Enterprise plan. All new accounts automatically include a 7-day trial of Enterprise plan features.

See our examples page to explore what you can build with the SDK.

There are two main ways to use the Felt SDK:

  1. Extensions

  2. Embedded Maps

Extensions

Write code directly within Felt using our Extensions feature. Extensions run directly within the Felt environment, giving you immediate access to all SDK functionality without embedding or connection steps.

When creating an extension, you automatically have access to a FeltController object with no setup required. This controller provides all the methods you need to interact with your Felt map, including getViewport, createElement, setLayerStyle, and many more.

// In a Felt extension, the controller is automatically available
const layers = await felt.getLayers();
const elements = await felt.getElements();

// Listen for map events
felt.onSelectionChange((selection) => {
  console.log('Selection changed:', selection);
});

Embedded Maps

Embed Felt maps in your own applications and control them remotely. This approach requires connecting to a map embed.

Installation

Install the SDK using your preferred package manager:

npm install @feltmaps/js-sdk

Create an HTML page with a container element:

<html>
  <body>
    <div id="container"></div>
  </body>
</html>

Embed a Felt map in your container element and use the SDK to control it:

import { Felt } from "@feltmaps/js-sdk";

const map = await Felt.embed(
  document.querySelector("#container"),
  "FELT_MAP_ID",
);

const layers = await map.getLayers();
const elements = await map.getElements();

For more information on how to control a map, see Controlling maps.

React Integration

If you are building a React application, you can use the Felt SDK React Starter Repo to get started quickly.

You can also read our guide on Integrating with React to learn more about how to use the Felt SDK with React.

Last updated

Was this helpful?