> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hyperwisor.com/llms.txt
> Use this file to discover all available pages before exploring further.

# storage

> Persist small values on the client from a script.

The `storage` global is a simple key/value store for small client-side values —
a user's last selection, a cached preference, a flag.

```js theme={null}
storage.set(key, value);     // store a value
const v = storage.get(key);  // read it back
storage.remove(key);         // delete one key
storage.clear();             // wipe everything this dashboard stored
```

## Example — remember a choice

```js theme={null}
// Restore the last selected mode on load
const last = storage.get('mode');
if (last) widget.setValue('modeSelector', last);

// Persist on change
widget.on('modeSelector', 'change', (value) => {
  storage.set('mode', value);
});
```

<Note>
  `storage` is for small UI state, not large datasets. For records, use
  [`db`](/script/database-api).
</Note>

<Card title="Next: db" icon="database" href="/script/database-api">
  Query and insert database records.
</Card>
