# Best way to save a list of presets?

**URL:** <https://forums.creativeclouddeveloper.com/t/best-way-to-save-a-list-of-presets/3040>\
**Category:** UXP Plugin API\
**Created:** [June 6, 2021, 12:00pm UTC](https://forums.creativeclouddeveloper.com/t/best-way-to-save-a-list-of-presets/3040 "2021-06-06T12:00:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndreasResch](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/andreasresch/32/1423_2.png) [@AndreasResch](https://forums.creativeclouddeveloper.com/u/AndreasResch)\
**Post date:** [June 6, 2021, 12:00pm UTC](https://forums.creativeclouddeveloper.com/t/best-way-to-save-a-list-of-presets/3040/1 "2021-06-06T12:00:56Z")

</div>

Hello.

What is the best way to save multiple presets (basically the states of all the elements of a plugin - checkboxes, radio.buttons, sliders, textfields, … ) between sessions and even between plugin updates?

In the end I want to have a dropdown menu where I can pick different entries and all the UI elements are set accordingly.

Cheers.

---

<div class="post-metadata">

**Author:** ![Maher](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/maher/32/1432_2.png) [@Maher](https://forums.creativeclouddeveloper.com/u/Maher)\
**Post date:** [June 6, 2021, 12:40pm UTC](https://forums.creativeclouddeveloper.com/t/best-way-to-save-a-list-of-presets/3040/2 "2021-06-06T12:40:25Z")

</div>

first store your presets in an object  
stringify the object and store the JSON file to local disk (plugin folder) if security is not a concern.  
another option is to store the JSON string in local storage .

you will need two functions:

**the saver function**  
to loop through element and store their settings inside an object then stringify it and store it.

**the loader function**  
to parse the JSON and loop through properties and set settings of element accordingly

---

<div class="post-metadata">

**Author:** ![AndreasResch](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/andreasresch/32/1423_2.png) [@AndreasResch](https://forums.creativeclouddeveloper.com/u/AndreasResch)\
**Post date:** [June 6, 2021, 12:44pm UTC](https://forums.creativeclouddeveloper.com/t/best-way-to-save-a-list-of-presets/3040/3 "2021-06-06T12:44:10Z")

</div>

Thanks for the reply.

Will the localstorage option stay intact after updating the plugin or after uninstalling and installing it again?

---

<div class="post-metadata">

**Author:** ![Maher](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/maher/32/1432_2.png) [@Maher](https://forums.creativeclouddeveloper.com/u/Maher)\
**Post date:** [June 6, 2021, 12:52pm UTC](https://forums.creativeclouddeveloper.com/t/best-way-to-save-a-list-of-presets/3040/4 "2021-06-06T12:52:59Z")

</div>

> Provides a local key-value store useful for setting preferences and other kinds of data. **This data is technically persistent** , but can be cleared in a variety of ways, so you should not store data using `localStorage` that you cannot otherwise reconstruct.

[Source](https://www.adobe.io/photoshop/uxp/uxp/reference-js/Global%20Members/Data%20Storage/LocalStorage/)

you may also wanna take a look at [secureStorage](https://www.adobe.io/photoshop/uxp/uxp/reference-js/Modules/uxp/Key-Value%20Storage/SecureStorage/) for sensitive data

it maybe better to use a dedicated folder on local disk for presets, might be easier to share and backup too. and from what I can read local storage

> can be cleared in a variety of ways
