---
title: "Facade Components · Nuxt Scripts"
description: "Facade components are placeholder UI elements that get replaced once a third-party script loads."
canonical_url: "https://scripts.nuxt.com/docs/guides/facade-components"
meta:
  "og:description": "Facade components are placeholder UI elements that get replaced once a third-party script loads."
  "og:image": "https://scripts.nuxt.com/_og/s/o_312d246ee9488572.png"
  "og:image:height": "600"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Facade Components · Nuxt Scripts"
  "twitter:image": "https://scripts.nuxt.com/_og/s/o_312d246ee9488572.png"
---

> Index of every page on this site: [llms.txt](https://scripts.nuxt.com/llms.txt)

**Guides**

# **Facade Components**

[Copy for LLMs](https://scripts.nuxt.com/docs/guides/facade-components.md)

A facade renders lightweight placeholder UI until its third-party script and component are ready.

## What are facade components?

A video embed, payment modal, or chat widget may fetch several resources during startup. Deferring that work helps the initial page, but inserting the real UI later can cause [**Cumulative Layout Shift (CLS)**](https://web.dev/articles/optimize-cls). A facade reserves the space and can show a loading state while the vendor code loads.

## Trade-offs

Facade components can introduce user-experience trade-offs:

- **Flash of mismatched content**: The placeholder may not look like the final UI. You may need to adjust the default styling to match your app's design.
- **Unavailable interactivity**: The real element requires the script to load. Keep an alternative available if loading fails.
- **Accessibility concerns**: Announce loading and failure states clearly.

## Available facades

Script-backed facade components wrap the relevant `**useScript<Provider>()**` composable and expose props, slots, and events for controlling their placeholders. Some components provide a minimally styled default placeholder. Check each component's registry page for its exact API.

## Usage guidance

### Provide an error fallback

Tell the user what failed and offer another way to reach the content.

```vue
<ScriptYouTubePlayer>
  <template #error>
    <UAlert color="red" title="YouTube player failed to load" description="Please refresh the page to try again." />
  </template>
</ScriptYouTubePlayer>
```

### Provide a loading state with accessible feedback

`**ScriptLoadingIndicator**` provides a visible loading state and an accessible status label.

```vue
<ScriptYouTubePlayer>
  <template #loading>
    <ScriptLoadingIndicator />
  </template>
</ScriptYouTubePlayer>
```

### Choose the triggering event

Facade components have default triggers, which you can override for the surrounding UI.

Prefer triggers that require explicit user interaction, such as a click. Loading on hover can cause subsequent events, such as clicks, to be lost while the component is replaced.

## Facade Components API

The script-backed facade components share a similar API, although the exact props, slots, events, and event payloads vary by component.

### Props

- `**trigger**`: For supported facades, the event that triggers the script to load. See [**Element Event Triggers**](https://scripts.nuxt.com/docs/guides/script-triggers#element-event-triggers) for more information. The PayPal facades currently expose this prop but do not use it for loading or facade state. Configure PayPal's registry `**trigger**` instead.

### Slots

`**ScriptYouTubePlayer**`, used in the examples below, provides minimal default UI and several slots for customization. Other facade components may expose different slots.

- `**default**`: Content to always display with the component.

```vue
<template>
  <ScriptYouTubePlayer>
    <div class="bg-blue-500 text-white p-5">
      Youtube!
    </div>
  </ScriptYouTubePlayer>
</template>
```

- `**loading**`: The content to display only while the script is loading.

```vue
<template>
  <ScriptYouTubePlayer>
    <template #loading>
      <ScriptLoadingIndicator />
    </template>
  </ScriptYouTubePlayer>
</template>
```

- `**awaitingLoad**`: The content to display only while the script is waiting to load.

```vue
<template>
  <ScriptYouTubePlayer>
    <template #awaitingLoad>
      <div class="bg-blue-500 text-white p-5">
        Click to play!
      </div>
    </template>
  </ScriptYouTubePlayer>
</template>
```

- `**error**`: The content to display if the script fails to load.

```vue
<template>
  <ScriptYouTubePlayer>
    <template #error>
      <UAlert color="red" title="YouTube player failed to load" description="Please refresh the page to try again." />
    </template>
  </ScriptYouTubePlayer>
</template>
```

The Crisp and Intercom components currently check their loading branch before their error branch. Their `**error**` events still fire, but their named `**#error**` slots cannot render until that ordering is fixed. Handle `**@error**` outside those two components for now.

### Events

- `**ready**`: Emitted when the script or component is ready. The payload depends on the component.
- `**error**`: Emitted when the script or component fails to load. The payload depends on the component.

[Edit this page](https://github.com/nuxt/scripts/edit/main/docs/content/1.guides/5.facade-components.md)

[Markdown For LLMs](https://scripts.nuxt.com/docs/guides/facade-components.md)

[**Global Scripts** Configure global scripts with triggers, warmup, typed access, and runtime URL overrides.](https://scripts.nuxt.com/docs/guides/global) [**CORS and Security Attributes** Configure cross-origin credentials, referrer policy, and integrity checks for scripts.](https://scripts.nuxt.com/docs/guides/cors)

**On this page **

- [What are facade components?](#what-are-facade-components)
- [Trade-offs](#trade-offs)
- [Available facades](#available-facades)
- [Usage guidance](#usage-guidance)
- [Facade Components API](#facade-components-api)

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://scripts.nuxt.com/#website","@type":"WebSite","description":"Nuxt Scripts lets you load third-party scripts with better performance, privacy, security and DX. It includes many popular third-parties out of the box.","name":"Nuxt Scripts","url":"https://scripts.nuxt.com/","publisher":{"@id":"https://scripts.nuxt.com/#identity"}},{"@id":"https://scripts.nuxt.com/docs/guides/facade-components#webpage","@type":"WebPage","description":"Facade components are placeholder UI elements that get replaced once a third-party script loads.","name":"Facade Components","url":"https://scripts.nuxt.com/docs/guides/facade-components","breadcrumb":{"@id":"https://scripts.nuxt.com/docs/guides/facade-components#breadcrumb"},"isPartOf":{"@id":"https://scripts.nuxt.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://scripts.nuxt.com/docs/guides/facade-components"]}],"primaryImageOfPage":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/#identity","@type":"Organization","name":"Nuxt Scripts","url":"https://scripts.nuxt.com","logo":{"@id":"https://scripts.nuxt.com/#logo"}},{"@id":"https://scripts.nuxt.com/docs/guides/facade-components#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Nuxt Scripts","item":"https://scripts.nuxt.com/","position":1},{"@type":"ListItem","name":"Documentation","item":"https://scripts.nuxt.com/docs","position":2},{"@type":"ListItem","name":"Guides","item":"https://scripts.nuxt.com/docs/guides","position":3},{"@type":"ListItem","name":"Facade Components","item":"https://scripts.nuxt.com/docs/guides/facade-components","position":4}]},{"@id":"https://scripts.nuxt.com/#logo","@type":"ImageObject","caption":"Nuxt Scripts","contentUrl":"https://scripts.nuxt.com/logo.svg","inLanguage":"en","url":"https://scripts.nuxt.com/logo.svg"}]}
```

## Sitemap

See the full [sitemap](https://scripts.nuxt.com/sitemap.md) for all pages.
