# useStorage API

> Auto-generated API reference for `useStorage` from @vuetify/v0 (Vuetify0).
> Source of truth: https://0.vuetifyjs.com/api/use-storage

## Related

- https://0.vuetifyjs.com/composables/plugins/use-storage
- https://0.vuetifyjs.com/composables/plugins/use-hydration
- https://0.vuetifyjs.com/guide/fundamentals/plugins

## Functions

### createStorage

Creates a new storage instance.

```ts
(options?: StorageOptions) => E
```

### createStorageContext

```ts
<_E>(_options?: StorageContextOptions | undefined) => ContextTrinity<_E>
```

### createStoragePlugin

```ts
(_options?: StorageContextOptions | undefined) => Plugin
```

### useStorage

```ts
<_E>(namespace?: string) => _E
```

## Options

| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| `adapter` | `StorageAdapter \| undefined` | — | no | The storage adapter to use. Defaults to localStorage in browser, MemoryStorageAdapter otherwise |
| `prefix` | `string \| undefined` | — | no | The prefix to use for all storage keys. Defaults to 'v0:' |
| `serializer` | `{ read: (value: string) => unknown; write: (value: unknown) => string; } \| undefined` | — | no | Custom serializer for reading and writing values. Defaults to JSON.parse/stringify |
| `ttl` | `number \| undefined` | — | no | Time-to-live in milliseconds. When set, expired entries return the default value on `get()` and `set()` automatically timestamps entries. |

## Methods

| Name | Type | Description |
|---|---|---|
| `has` | `(key: string) => boolean` | Check if a key exists in storage |
| `get` | `<T>(key: string, defaultValue?: T) => Ref<T>` | Get a reactive ref for a storage key |
| `set` | `<T>(key: string, value: T) => void` | Set a value for a storage key |
| `remove` | `(key: string) => void` | Remove a key accessed through this storage instance. Keys persisted by a previous session but never read here are not removed. |
| `clear` | `() => void` | Clear keys accessed through this storage instance. Keys persisted by a previous session but never read here are not removed. |
