Framer Controller

npm install framer-controller

👉 Click here to download an example project with demos for each controller.

Introduction

The framer-controller library provides tools for managing state in Framer X overrides.

The library includes Controller, a class that provides an interface for setting the values of a Framer X Data object. As in React classes, the controller's setState method will merge the provided values into the controller's state. Because the Controller's state is stored in a Data object, changing its state will refresh overrides with the new values.

Controlled state simplifies many things that would otherwise take plenty of boilerplate. For example, Controller now supports a simple animate method that works with animejs, animating props and setting state automatically.

While Controller might already be a useful pattern, the class is really just a starting point for building more task- and component-specific controllers. By extending Controller, a designer can create an interface of methods related to a certain component or state management pattern.

The library comes with several such controllers:

The library also includes controllers for Framer X's Page and Scroll components.

Hooks

As of Framer X v24, overrides can also include React hooks. Newer versions of this library will replace the controllers above with more efficient hooks-based controllers. As a preview, see:

Installation

The easiest way to install framer-controller is to install the Framer Controller package from the Framer X Store. Installing the package will also install this library.

To install manually, run npm install framer-controller from your project's Project Folder.

Usage

  1. In an Overrides file, import the desired controllers from framer-controller.
  2. Create an instance of your controller.
  3. Assign its properties and methods to components using Overrides.

See each controller's documentation for information on how to use the controller and examples.

Extension

For help creating your own controllers, see the Build Your Own section.


Made with ✨by @steveruizok