# ivyforms/0.2.1/frontend/src/composables/useLabels.ts

The Innovative Form Builder – IvyForms, version 0.2.1. 25 lines.

- Page: https://pluginprobe.com/plugins/ivyforms/0.2.1/code/frontend/src/composables/useLabels.ts
- Raw: https://pluginprobe.com/plugins/ivyforms/0.2.1/raw/frontend/src/composables/useLabels.ts
- Modified: 2025-08-08T07:58:08+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ivyforms/0.2.1/code/frontend/src/composables/useLabels.ts#L10-L20`.

```typescript
import { useLabelsStore } from '@/stores/labels'

/**
 * Composable function to provide easy access to labels throughout the application
 * @returns Object with getLabel function and allLabels getter
 */
export function useLabels() {
  const labelsStore = useLabelsStore()

  /**
   * Get a label by key with optional fallback value
   * @param key The label key to retrieve
   * @param fallback Optional fallback text if label doesn't exist
   * @returns The label string or fallback value
   */
  const getLabel = (key: string, fallback: string = ''): string => {
    return labelsStore.getLabel(key, fallback)
  }

  return {
    getLabel,
    allLabels: labelsStore.allLabels,
  }
}

```
