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

<Meta title='@dxtmisha/en/figma-ref/Composables/useFigmaUiSelected - Managing selected frames in UI'/>

# `useFigmaUiSelected`

A composable for managing and observing the list of frame identifiers selected by the user within the plugin's interface. It provides tools for checking selection state and toggling selections.

**Returns:**
- `selected: ComputedRef<string[]>` — A computed reference to the list of selected frame IDs.
- `loading: ComputedRef<boolean>` — A reactive flag indicating if the selection list is being fetched.
- `isSelected(id: string): ComputedRef<boolean>` — A helper function that returns a computed boolean indicating if a specific frame is selected.
- `toggleSelected(id: string, selected: boolean): void` — A function to add or remove a frame from the selection list.

## Usage Example

```typescript
import { useFigmaUiSelected } from '@dxtmisha/figma-ref'

const { selected, isSelected, toggleSelected } = useFigmaUiSelected()

// Check if a frame is selected
const active = isSelected('1:123')

// Toggle selection
toggleSelected('1:123', !active.value)
```
