---
title: "useFeatures"
description: "useFeatures, auto-imported in the app: its options, return value and types."
canonical_url: "https://nuxt-backend.dev/docs/reference/api/use-features"
---
# useFeatures

Version: nuxt-backend 0.6.x · Tab: Reference · Kind: reference · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

## Interfaces

### QuotaUsage

Defined in: [src/convex/integrations/billing/types/records.ts](https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts)

**Experimental**

One quota of a billing entity: how many its plan allows and how many it
holds. `limit` is the most any grant allows — `0` when none names the
quota, so a quota fails closed — or `'unlimited'`.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="limit">
        
      </a>
      
       <code>
        limit
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
      
       | <code>
        "unlimited"
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="used">
        
      </a>
      
       <code>
        used
      </code>
    </td>
    
    <td>
      <code>
        number
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       How many are counted: what <code>
        requireQuota
      </code>
      
       claimed, less what <code>
        releaseQuota
      </code>
      
       gave back.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="description">
        
      </a>
      
       <code>
        description?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       What the quota counts, as the catalog's <code>
        description
      </code>
      
       says it (<code>
        'projects'
      </code>
      
      ): absent for a quota the catalog does not declare, which only a grant names.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/convex/integrations/billing/types/records.ts" rel="nofollow">
        src/convex/integrations/billing/types/records.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### UseFeaturesOptions

Defined in: [src/runtime/vue/composables/use-features.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-features.ts)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="api">
        
      </a>
      
       <code>
        api?
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-backend.dev/docs/reference/api/use-billing#billingapi">
        <code>
          BillingApi
        </code>
      </a>
    </td>
    
    <td>
      Override the injected <code>
        api.billing
      </code>
      
       namespace (or the <code>
        getFeatures
      </code>
      
       ref).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-features.ts" rel="nofollow">
        src/runtime/vue/composables/use-features.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### UseFeaturesReturn

Defined in: [src/runtime/vue/composables/use-features.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-features.ts)

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="plans">
        
      </a>
      
       <code>
        plans
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        string
      </code>
      
      <span>
        
      </span>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      Active product ids the user is subscribed to, or <code>
        undefined
      </code>
      
       while loading.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-features.ts" rel="nofollow">
        src/runtime/vue/composables/use-features.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="benefits">
        
      </a>
      
       <code>
        benefits
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<a href="https://nuxt-backend.dev/docs/reference/api/use-billing#entitlementbenefit">
        <code>
          EntitlementBenefit
        </code>
      </a>
      
      <span>
        
      </span>
      
       | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      Granted benefits (entitlements), or <code>
        undefined
      </code>
      
       while loading.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-features.ts" rel="nofollow">
        src/runtime/vue/composables/use-features.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="quotas">
        
      </a>
      
       <code>
        quotas
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        Record
      </code>
      
      <<code>
        string
      </code>
      
      , <a href="#quotausage">
        <code>
          QuotaUsage
        </code>
      </a>
      
      > | <code>
        undefined
      </code>
      
      >
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       Every quota the catalog declares or a grant names, by key, or <code>
        undefined
      </code>
      
       while loading.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-features.ts" rel="nofollow">
        src/runtime/vue/composables/use-features.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="isloading">
        
      </a>
      
       <code>
        isLoading
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <code>
        true
      </code>
      
       until features have loaded (<code>
        false
      </code>
      
       once the read failed).
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-features.ts" rel="nofollow">
        src/runtime/vue/composables/use-features.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="error">
        
      </a>
      
       <code>
        error
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      < | <a href="https://nuxt-backend.dev/docs/reference/api/functions#backenderror">
        <code>
          BackendError
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      Why the features could not be read, else <code>
        null
      </code>
      
      . While it is set, <code>
        has
      </code>
      
       and <code>
        hasPlan
      </code>
      
       say no.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-features.ts" rel="nofollow">
        src/runtime/vue/composables/use-features.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="has">
        
      </a>
      
       <code>
        has
      </code>
    </td>
    
    <td>
      (<code>
        feature
      </code>
      
      ) => <code>
        boolean
      </code>
    </td>
    
    <td>
      Whether a granted benefit is <code>
        feature
      </code>
      
      : by its catalog key (the <code>
        key
      </code>
      
       in its metadata), or by its benefit id when it has no key. The match <code>
        billing.requireFeature
      </code>
      
       and the <code>
        withFeature
      </code>
      
       tier make on the server.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-features.ts" rel="nofollow">
        src/runtime/vue/composables/use-features.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="hasplan">
        
      </a>
      
       <code>
        hasPlan
      </code>
    </td>
    
    <td>
      (<code>
        productId
      </code>
      
      ) => <code>
        boolean
      </code>
    </td>
    
    <td>
      Whether the user has an active subscription to the given product id.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-features.ts" rel="nofollow">
        src/runtime/vue/composables/use-features.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="quota">
        
      </a>
      
       <code>
        quota
      </code>
    </td>
    
    <td>
      (<code>
        quota
      </code>
      
      ) => <a href="#quotausage">
        <code>
          QuotaUsage
        </code>
      </a>
      
       | <code>
        undefined
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       How many of <code>
        quota
      </code>
      
       the plan allows and how many are held, as <code>
        billing.getQuota
      </code>
      
       reads them on the server: <code>
        { limit: 0, used: 0 }
      </code>
      
       for a quota no grant names, so it fails closed; <code>
        undefined
      </code>
      
       while loading or when the features could not be read.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-features.ts" rel="nofollow">
        src/runtime/vue/composables/use-features.ts
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="remaining">
        
      </a>
      
       <code>
        remaining
      </code>
    </td>
    
    <td>
      (<code>
        quota
      </code>
      
      ) => <code>
        number
      </code>
    </td>
    
    <td>
      <strong>
        <code>
          Experimental
        </code>
      </strong>
      
       How many more of <code>
        quota
      </code>
      
       fit: <code>
        Infinity
      </code>
      
       when the plan allows any number, and <code>
        0
      </code>
      
       while loading, when the features could not be read, or when none is left, so a gate fails closed. <code>
        billing.requireQuota
      </code>
      
       enforces it in the mutation.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-features.ts" rel="nofollow">
        src/runtime/vue/composables/use-features.ts
      </a>
    </td>
  </tr>
</tbody>
</table>

## Functions

### useFeatures()

```ts
function useFeatures(options?): UseFeaturesReturn;
```

Defined in: [src/runtime/vue/composables/use-features.ts](https://github.com/qruto/nuxt-backend/blob/main/src/runtime/vue/composables/use-features.ts)

Reactive feature-gating for the current user — the SaaS access primitive.
Backed by the `getFeatures` query (the component's webhook-synced cache), so it
updates live as subscriptions/benefits change. Zero-arg via the auto-provided
`api.billing` namespace; pass `{ api }` to override. The read never throws:
a failed one shows in `error`, and gates closed. A gate in the UI is for
the UI: enforce in the function with `billing.requireFeature` or the
`withFeature` tier, and a quota with `billing.requireQuota`, which read
the same cache and match the same way.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        options?
      </code>
    </td>
    
    <td>
      <a href="#usefeaturesoptions">
        <code>
          UseFeaturesOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Returns

[`UseFeaturesReturn`](#usefeaturesreturn)

#### Example

```vue
<script setup lang="ts">
const { has, hasPlan, remaining } = useFeatures()
</script>
<template>
  <PremiumPanel v-if="has('priority_support')" />
  <NewProjectButton :disabled="remaining('projects') < 1" />
</template>
```


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
