Modes
A property with the current mode. Modes are used to understand the context in which the Plugin is being run, and adjust logic as needed. Learn more in the mode guide.
mode
Project
Information about the current Framer Project. Returns the display name of the Project as well as a hashed Project ID. This ID cannot be used to access the Project.
getProjectInfo()
getPublishInfo()
Selection
Functions for reading, setting, or listening to the current selection on the Canvas. The returned list can range from zero items to a very large list of items.
getSelection()
setSelection(nodeIds)
subscribeToSelection(callback)
Assets
A selection of functions for working with Images, Files, and SVGs. The high-level add and set functions are designed to work in most cases and automatically handle uploading for you. Learn more in the working with Assets guide.
addImage(imageAsset)
setImage(imageAsset)
uploadImage(imageAsset)
uploadImages(imageAsset[])
uploadFile(file)
uploadFiles(files[])
addSvg(svgString)
Components
Functions for utilising Components in your Plugin. Learn more in the Component guide.
addComponentInstance({ url, attributes })
addDetachedComponentLayers({ url, layout, attributes })
Text
A selection of functions for working with text layers and their content.
getText()
setText(text)
addText(text)
subscribeToText(callback)
Custom Code
With Custom Code your plugin can install code snippets in a user's Website via <script> tags. Custom Code added by a Plugin appears in a separate section of a Project’s site settings specifically for Plugins. This can be used to load external scripts on a site. Custom code should be valid HTML.
setCustomCode(options)
getCustomCode()
subscribeToCustomCode(callback)
When setting Custom Code, you must provide the html string, as well as a location.
The location property has the following values:
headStart- Injects the code snippet at the start of the HTML<head>tagheadEnd- Injects the code snippet at the end of the HTML<head>tagbodyStart- Injects the code snippet at the start of the<body>tagbodyEnd- injects the code snippet at the end of the<body>tag
Setting the html value back to null clears the installed code snippet.
Storing Data
Functions for storing data that your Plugin case use across users and sessions. Learn about the different ways to store data in our Data guide.
getPluginData(key)
setPluginData(key, value)
getPluginDataKeys()
Styles
A set of functions for creating, reading and manipulating the Color and Text Styles in a Project. Learn more in our Styles guide.
createColorStyle(attributes)
getColorStyle(id)
getColorStyles()
subscribeToColorStyles(callback)
createTextStyle(attributes)
getTextStyle(id)
getTextStyles()
subscribeToTextStyles(callback)
Fonts
Plugins can use typefaces available in the Font Picker to get information about specific fonts or to apply them to Text Styles.
getFont(family)
getFonts()
Unlike the Font Picker, which groups fonts by typeface, getFonts will list individual fonts for each weight and style. You can think these as separate font files.
To get a specific font from a family, use getFont and pass in the family name. This is not case sensitive. By default, this will return a font in the family that has a normal weight and style.
Make sure to check that a font exists before using it. If a font does not exist, getFont will return null.
Note: Custom Fonts are not available to Plugins
Nodes
Low-level API for working with Nodes. Useful for doing very specific tasks that may not be covered by the higher-level APIs. Learn more in our working with Nodes guide.
createFrameNode(attributes)
cloneNode(nodeId)
removeNode(nodeId)
getCanvasRoot()
subscribeToCanvasRoot(callback)
getNode(nodeId)
getParent(nodeId)
getChildren(nodeId)
getRect(nodeId)
setAttributes(nodeId, attributes)
setParent(nodeId, parentId)
getNodesWithType(type)
getNodesWithAttribute(attribute)
getNodesWithAttributeSet(attribute)
node.navigateTo(opts)
API Reference
A list of all functions and attributes available on the framer Plugin API.
Navigation API
Use the Navigation API to programmatically navigate the UI to a canvas node, a CMS collection item, or a code file. Plugins can optionally select targets, zoom to canvas layers, or focus a specific field in the item editor.
Navigate the Framer UI to a target by its ID
Pans and zooms the viewport to center a single or group of nodes
Plugin UI
A set of functions for opening and closing the Plugin itself, along with options setting a specific size for your Plugin. Plugins are able to run completely UI-less if desired.
Set a message to display while the plugin is hidden
Close and terminate the plugin.
When enabled, a modal confirmation will appear before close to confirm the action.
Show a context menu at a given location.
Information about the user that's interacting with the plugin.
Code File API
The CodeFile API allows plugins to create, read, update, and manage code files within a Framer project. A code file exports either overrides or code components.
Create a new code file in the project.
Get a specific code file by its ID.
Get all code files in the project.
Subscribe to changes in code files across the project.
Subscribe to changes in the Code Editor’s active file.
A class representing a code file in a Framer project.
The current content/source code of the file.
Array of exports available in this code file.
Get all versions/history of this code file.
The unique identifier of the code file.
The name of the code file (e.g., "MyComponent.tsx").
Get all versions/history of this code file.
The file system path of the code file.
Set the content of the code file.
Union type representing exports from a code file.
URL for inserting the component
Whether this is a default export
Export name
Discriminator
Represents a historical version of a code file.
Canvas APIs
Framer provides APIs to interact with our Canvas. These APIs range from directly editing Nodes, to Images, and Drag & Drop. Learn more about Nodes in our guide.
Allow any HTML element to become draggable.
An object that represents the data to be dragged.
A React component that makes it's child draggable.
A callback triggered when a drag finishes.
Allow any HTML element to become draggable.
Allow to get or edit node.
Controls how content that exceeds an element's box is handled.
Controls horizontal overflow behavior.
Controls vertical overflow behavior.
Width-to-height ratio
Background color in RGBA format or as a ColorStyle instance
Background gradient
Background image asset
Border properties
Border radius for rounded corners
Distance from bottom edge when using absolute/fixed positioning
Center anchor position as percentage
Center anchor position as percentage
Collection ID for the web page
Identifier of the component
Name of the component
Property control values for code components
Font selection for text
Spacing between items in a layout
Gesture state for component variants
How items are aligned within the grid
Number of columns in the grid
Minimum width of grid columns in pixels
Width of grid columns in pixels
Type of column width sizing
Number of columns to span
Whether to fill the grid cell height
Whether to fill the grid cell width
Horizontal alignment within grid cell
Number of rows to span
Vertical alignment within grid cell
Number of rows in the grid
Height of grid rows in pixels
Type of row height sizing
Height of the node
How images should be rendered when scaled
ID of the node this variant inherits from
Apply a text style preset
Whether this is a breakpoint
Whether this is the primary breakpoint
Whether this is the primary variant
Whether this is a component variant
Enables stack or grid layout
Distance from left edge when using absolute/fixed positioning
URL or internal page link
Whether to open link in new tab
Whether the node is locked for editing
Maximum height constraint
Maximum width constraint
Minimum height constraint
Minimum width constraint
The name of the node displayed in the layers panel
Opacity of the node
Inner spacing of a container with layout
URL path for the web page
Positioning behavior of the node
Distance from right edge when using absolute/fixed positioning
Rotation angle in degrees
How items are aligned perpendicular to the stack direction
Direction of items in a stack layout
How items are distributed in a stack layout
Whether items should wrap to the next line
SVG markup content
Distance from top edge when using absolute/fixed positioning
Whether the node is visible on the canvas
Width of the node
Specifies the maximum number of lines a text node can display before being truncated with an ellipsis
Sets the stacking order of positioned elements. Higher values appear on top of lower values.
CMS APIs
Framer provides APIs to interact with our CMS. Collections can be either user-created (Unmanaged) or controlled by a Plugin (Managed). The Collection types share similar API structures and Plugin authors can choose which Collection type works best for their use-case. Reference the latest APIs below or learn more with the CMS guide.
Retrieve the Collection currently active (selected) in the Framer UI.
Retrieve the currently active managed Collection from the UI.
Get all Collections in the project. Both Managed and Unmanaged.
Retrieve Collections that are managed by the current Plugin.
A Collection that is not controlled by a Plugin.
Returns who manages the Collection
Whether a Collection is read-only.
Remove fields from a Collection by their IDs.
Remove Items from a Collection by their IDs.
Set the Collection as active.
Reorder the Fields in a Collection based on an array of Field IDs.
Reorder the Items in a Collection based on an array of Item IDs.
The ID of the Field the slug is based on.
The name of the Field used as the slug.
Add a new CMS Collection.
A class for a CMS item in a Collection or ManagedCollection.
The fields and corresponding values of the Collection item.
A unique identifier for a Collection item.
Navigate the UI to this collection item
Set the values of the fields of the CMS item.
Slug value of the CMS item.
An Enum Case for an Enum Field.
A unique identifier for the Enum Case.
The name of the Enum Case.
Localized values for the name of the Enum Case.
Remove the Enum Case.
Update the attributes of the Enum Case.
An enum field.
A CMS Collection that is controlled by a Plugin.
Add a new plugin-managed CMS Collection.
Retrieve all Item IDs in a Managed Collection.
Remove CMS items by their ID.
Open this Collection in the Editor.
Arrange CMS items in a specific order.
Localization API
Framer provides APIs to interact with our Localization functionality. The key pieces of Localization in Framer are Locales, Localization Groups, and Localization Sources. Locales are a language paired with an optional region, like English or English (Canada). Localization groups are things like pages or CMS items that contain one or more Localization sources. Localization sources are the strings from your site, along with their localized values.
Get the currently active Locale.
Get the default locale of the project.
Get all Locales in the project.
Get all Localization Groups in the project.
Update localization data.
A Locale in your project.
The language code of the Locale.
The ID of the fallback Locale.
A unique identifier for a Locale.
The name of the Locale.
Slug value of the Locale.
A group of Localization Sources.
A unique identifier for a Localization Group.
The name of a Localization Group.
The Localization Sources in the Localization Group.
The status of the Localization Group in each Locale.
Whether a Localization Group supports the "excluded" status.
The type of a Localization Group.
A localizable string on your site.
A localizable string on your site.
A unique identifier for a Localization Source.
The name of a Localization Source.
The type of value for this Localization Source.
The current value of the Localization Source in the default locale.
Localized values and metadata for each Locale.
The localized value and associated metadata for a Locale.
The localized value and associated metadata for a Locale.
The time the Localized Value was last edited at.
Whether the value is read only and therefore cannot be updated.
The status of the Localization Value.
The actual text of the Localization Value
A warning about the Localization Value.
Settings APIs
Framer provides APIs to interact with our Site Settings functionality. Redirects, currently the primary feature supported by these APIs, allow you to permanently route traffic from an old path to a new URL.
Add Redirects to your project.
Get all Redirects in the project.
Remove Redirects from your project.
Sets the order of the Redirects in the list
A redirect from one path to another.
Whether the Redirect is expanded to all locales.
The source path of the Redirect.
A unique identifier for the Redirect.
Set the attributes of a Redirect.
The destination path of the Redirect.
Permissions
Plugins can do only what the user can. These APIs let you find out if the methods you need are available to the user, and potentially disable certain functions of your Plugin if not. Learn more with the Permission guide.
Find out if user's permissions allow them to execute methods.
Subscribe to changes in whether the user is allowed to execute methods.
Find out if user's permissions allow them to execute methods, in hook form.