Skip to content

Instantly share code, notes, and snippets.

@eonist
Created June 8, 2025 22:37
Show Gist options
  • Save eonist/41eb622db5e99ccc6e90d10945e82726 to your computer and use it in GitHub Desktop.
Save eonist/41eb622db5e99ccc6e90d10945e82726 to your computer and use it in GitHub Desktop.
store2.md

Yes, Figma plugins have their own dedicated local storage system called figma.clientStorage, which is specifically designed for plugin data persistence[1].

How Figma Plugin Storage Works

Plugin-Specific Storage: Each plugin gets its own isolated storage space that other plugins cannot access[1]. The data is specific to your plugin ID, ensuring complete separation between different plugins[1].

Storage Capacity: Each plugin receives 5MB of total storage space[1]. You can estimate usage by adding the size of keys plus their JSON-converted values[1].

Asynchronous API: Unlike regular localStorage, Figma's clientStorage uses asynchronous methods[1]:

  • figma.clientStorage.setAsync(key, value) - Store data
  • figma.clientStorage.getAsync(key) - Retrieve data
  • figma.clientStorage.deleteAsync(key) - Remove data
  • figma.clientStorage.keysAsync() - List all stored keys

Key Differences from Regular localStorage

No Standard localStorage Access: Figma plugins cannot use regular localStorage or parent.localStorage as these are prohibited in the plugin environment[3].

Data Types Supported: The clientStorage API can store objects, arrays, strings, numbers, booleans, null, undefined, and Uint8Array values[1].

User-Specific: Data is stored locally on the user's machine and is not synchronized across different users[1]. Each user running your plugin will have their own separate storage[5].

Example Usage

// Store user preferences
await figma.clientStorage.setAsync('userPrefs', { theme: 'dark', autoSave: true });

// Retrieve stored data
const prefs = await figma.clientStorage.getAsync('userPrefs');

// Delete data
await figma.clientStorage.deleteAsync('userPrefs');

Important Limitations: The data can become inaccessible if your plugin ID changes, and users can clear this data by clearing their browser cache[1]. The storage is designed for stability rather than security[1].

[1] https://www.figma.com/plugin-docs/api/figma-clientStorage/ [2] https://story.vjy.me/making-figma-plugins-more-powerful-with-clientstorage-40 [3] https://forum.figma.com/ask-the-community-7/how-can-i-use-localstorage-in-a-plugin-20364 [4] https://forum.figma.com/ask-the-community-7/how-to-increase-local-storage-capacity-for-a-plugin-35790 [5] https://www.figma.com/plugin-docs/oauth-with-plugins/ [6] https://forum.figma.com/ask-the-community-7/how-do-i-clear-plugins-from-my-local-storage-11384 [7] https://www.reddit.com/r/FigmaDesign/comments/z6stlz/how_do_i_save_my_favorite_plugins/ [8] https://docs.tokens.studio/token-storage/local/figma-data-limit [9] https://www.reddit.com/r/FigmaDesign/comments/11bjh5u/hello_how_can_i_know_where_figma_store_cache_file/ [10] https://www.youtube.com/watch?v=cQR8sf39auU

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment