import {Meta} from '@storybook/addon-docs/blocks'

<Meta title='@dxtmisha/en/figma/Composables/useFigmaStorage - Storage management'/>

# `useFigmaStorage`

Composable for managing data in Figma's `PluginData`. It uses a singleton pattern to ensure that multiple calls with the same key and node return the same `FigmaStorage` instance.

**Parameters:**
- `name: string` — the unique key name for the storage item.
- `item?: PluginDataMixin` — (Optional) the Figma node where the data is stored. Defaults to `figma.root`.
- `cache?: number` — (Optional) cache time in seconds (TTL).

**Returns:**
- `FigmaStorage<T>` — an instance of the `FigmaStorage` class for data management.

## Usage Example

```typescript
import { useFigmaStorage } from '@dxtmisha/figma'

// 1. Initialize storage for plugin settings
const settings = useFigmaStorage('settings')

// 2. Retrieve data with a default value
const theme = settings.get('dark')

// 3. Update data
settings.set('light')
```
