> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nozle.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# LockedOverlay

> Blurs a feature the customer cannot use and shows an upgrade prompt over it.

`LockedOverlay` shows a blurred, non-interactive preview of its children with an [`UpgradePrompt`](/sdks/react/components/upgrade-prompt) on top.

**When to use**

* A dashboard widget or report that a higher plan unlocks, so customers see what they would get.
* A settings panel available on another plan.
* Instead of [`FeatureGate`](/sdks/react/components/feature-gate) when you want to show the feature blurred rather than hide it.

The blurred content is still in the page. Do not put data the customer must not see inside it, and enforce access on your server.

**Light**

![LockedOverlay over a blurred analytics card, with Upgrade to Scale to access this feature and an Upgrade button, light theme](https://mintcdn.com/nozle-d78f01d8/Ae2cAgwEfN_SPqzG/images/react/components/locked-overlay/light.png?fit=max\&auto=format\&n=Ae2cAgwEfN_SPqzG\&q=85\&s=15c604b955250dacbcebb0ce1c97a0ca)

**Dark**

![LockedOverlay over a blurred analytics card, with Upgrade to Scale to access this feature and an Upgrade button, dark theme](https://mintcdn.com/nozle-d78f01d8/Ae2cAgwEfN_SPqzG/images/react/components/locked-overlay/dark.png?fit=max\&auto=format\&n=Ae2cAgwEfN_SPqzG\&q=85\&s=290a0b46068c7f7d058ba6fafa7fc306)

**Minimal**

![LockedOverlay over a blurred analytics card, with Upgrade to Scale to access this feature and an Upgrade button, minimal theme](https://mintcdn.com/nozle-d78f01d8/Ae2cAgwEfN_SPqzG/images/react/components/locked-overlay/minimal.png?fit=max\&auto=format\&n=Ae2cAgwEfN_SPqzG\&q=85\&s=09ac78501f526e89365c7f41255c7596)

**Neobrutal**

![LockedOverlay over a blurred analytics card, with Upgrade to Scale to access this feature and an Upgrade button, neobrutal theme](https://mintcdn.com/nozle-d78f01d8/Ae2cAgwEfN_SPqzG/images/react/components/locked-overlay/neobrutal.png?fit=max\&auto=format\&n=Ae2cAgwEfN_SPqzG\&q=85\&s=5057638a5eecab443d8de99cf949d19b)

**Nozle**

![LockedOverlay over a blurred analytics card, with Upgrade to Scale to access this feature and an Upgrade button, nozle theme](https://mintcdn.com/nozle-d78f01d8/Ae2cAgwEfN_SPqzG/images/react/components/locked-overlay/nozle.png?fit=max\&auto=format\&n=Ae2cAgwEfN_SPqzG\&q=85\&s=e5037b725b1eaca71b5fa2ecaf3e3ed6)

**Nozle Dark**

![LockedOverlay over a blurred analytics card, with Upgrade to Scale to access this feature and an Upgrade button, nozleDark theme](https://mintcdn.com/nozle-d78f01d8/Ae2cAgwEfN_SPqzG/images/react/components/locked-overlay/nozle-dark.png?fit=max\&auto=format\&n=Ae2cAgwEfN_SPqzG\&q=85\&s=c695290ac82b7bebec930e13fe0e5a68)

## Importing LockedOverlay

```tsx theme={null}
import {
  LockedOverlay,
  type LockedOverlayProps,
} from '@nozle-js/react'
```

## Rendering LockedOverlay

Wrap the content and pass `locked`. When `locked` is false the children render as they are, with no wrapper at all.

```tsx components/analytics-preview.tsx theme={null}
export function AnalyticsPreview({ locked, openPlans }: { locked: boolean; openPlans: () => void }) {
  return (
    <LockedOverlay locked={locked} upgradePlanName="Scale" onUpgrade={openPlans}>
      <div style={{ padding: 24 }}>
        <strong>Advanced analytics</strong>
        <p>Revenue by cohort, retention curves and exports.</p>
      </div>
    </LockedOverlay>
  )
}
```

### What locking does

* The children get a 4px blur, with clicks, selection and screen readers kept out of them.
* A panel covers the content in the theme's background colour, with the upgrade message and button.
* The panel is a `role="dialog"` labelled "Feature locked — upgrade required".
* The root is an `inline-block`, sized by its children.

## Data

The overlay needs one boolean, `locked`.

### Live data

Lock it from the customer's entitlement with [`useEntitlement`](/sdks/react/hooks#the-hooks):

```tsx theme={null}
import { useEntitlement } from '@nozle-js/react'

export function CohortReport() {
  const { data } = useEntitlement('advanced_analytics')
  return (
    <LockedOverlay locked={!data?.allowed} upgradePlanName="Scale" onUpgrade={() => window.location.assign('/plans')}>
      <section>{/* Sample report with placeholder data */}</section>
    </LockedOverlay>
  )
}
```

## Examples

### Locked with a plan name

`upgradePlanName` gives the prompt "Upgrade to \<plan> to access this feature".

![LockedOverlay over a blurred analytics card, with Upgrade to Scale to access this feature and an Upgrade button, light theme](https://mintcdn.com/nozle-d78f01d8/Ae2cAgwEfN_SPqzG/images/react/components/locked-overlay/light.png?fit=max\&auto=format\&n=Ae2cAgwEfN_SPqzG\&q=85\&s=15c604b955250dacbcebb0ce1c97a0ca)

```tsx theme={null}
export function LockedAnalytics({ openPlans }: { openPlans: () => void }) {
  return (
    <LockedOverlay locked upgradePlanName="Scale" onUpgrade={openPlans}>
      <div style={{ padding: 24 }}>
        <strong>Advanced analytics</strong>
        <p>Revenue by cohort, retention curves and exports.</p>
      </div>
    </LockedOverlay>
  )
}
```

### Your own text

Without `upgradePlanName`, `upgradeText` is the message.

```tsx theme={null}
export function LockedExports({ openPlans }: { openPlans: () => void }) {
  return (
    <LockedOverlay locked upgradeText="Exports are part of the Pro plan" onUpgrade={openPlans}>
      <button type="button">Export CSV</button>
    </LockedOverlay>
  )
}
```

## API reference

**locked** `boolean` *required*

`true` blurs the children and shows the prompt; `false` renders the children only.

**children** `ReactNode` *required*

The content to preview.

**upgradePlanName** `string`

Passed to `UpgradePrompt` as `planName`: "Upgrade to \<plan> to access this feature".

**upgradeText** `string`

Passed to `UpgradePrompt` as `text`, used when `upgradePlanName` is not set. Defaults to `UpgradePrompt`'s default, "Upgrade to access this feature".

**onUpgrade** `() =\> void`

Fires when "Upgrade" is clicked. Defaults to opening `/upgrade`.

**appearance** `Appearance`

Theme, variables and element overrides on top of the provider's, also passed to the prompt. See [Appearance](/sdks/react/styling).

### States

| State | What shows |
| - | - |
| `locked` is true | The blurred children with the upgrade panel on top. |
| `locked` is false | The children only, with no wrapper. |

### Appearance

> **Element keys**
>
> `lockedOverlay` (root), `lockedOverlay__panel`, and `upgradePrompt` for the prompt.
>
> Style them with `appearance.elements`. See [Elements](/sdks/react/styling#elements).

## Related

> **[UpgradePrompt](/sdks/react/components/upgrade-prompt)**
>
> The prompt on its own.

> **[FeatureGate](/sdks/react/components/feature-gate)**
>
> Hide the feature instead of blurring it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.