> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/lwc-container/show-a-placeholder-in-the-builder.md). Agents can also search and read this documentation through its [MCP server](https://docs.avonnicomponents.com/~gitbook/mcp).

# Show a Placeholder in the Builder

Make your custom LWC show a clear placeholder on the builder canvas and a Preview badge, using the Is Builder and Is Preview attribute names.

On the builder canvas no row is selected and the **Request review** button cannot run, so the `accountSnapshot` LWC sits there as an empty card. The LWC Container tells the LWC where it is running: it sets one `@api` property to `true` on the canvas and another to `true` in Preview. The LWC uses them to show a labeled placeholder while you design, and a small "Preview" badge while you test.

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2Fbk4s6lWL4HuSBpICm1SH%2Flwc-container-show-a-placeholder-in-the-builder-result.png?alt=media" alt="The builder canvas with the account snapshot LWC showing a placeholder text box"><figcaption><p>On the canvas, the LWC shows its placeholder.</p></figcaption></figure>

## Before you start

* The `accountSnapshot` LWC from [Pass a Selected Row to an LWC](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/lwc-container/pass-a-selected-row-to-an-lwc.md), shown in an LWC Container.
* A developer for the two code changes below.

## What the container passes

| `@api` property (default name) | Is `true` when                               | Setting that renames it       |
| ------------------------------ | -------------------------------------------- | ----------------------------- |
| `isBuilder`                    | the component is shown on the builder canvas | **Is Builder Attribute Name** |
| `isPreview`                    | the component runs in the builder's Preview  | **Is Preview Attribute Name** |

On the published page both are `false`. Keep the default names unless the LWC already uses other names for these flags (it is shared with another app, say, and calls the flag `designMode`). The Data LWC Container passes the same two flags: [Build the LWC for the Container](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/data-lwc-container/build-the-lwc-for-the-container.md) uses them the same way.

## Add the flags to the LWC

{% code title="accountSnapshot.js (add the two properties)" %}

```javascript
@api isBuilder;
@api isPreview;
```

{% endcode %}

{% code title="accountSnapshot.html (wrap the existing card)" %}

```html
<template>
    <div lwc:if={isBuilder} class="slds-box slds-text-align_center slds-p-around_large">
        Account snapshot: shows the account selected in the table.
    </div>
    <template lwc:else>
        <lightning-badge lwc:if={isPreview} label="Preview"></lightning-badge>
        <!-- the existing lightning-card goes here, unchanged -->
    </template>
</template>
```

{% endcode %}

Keep the real content in Preview. Preview is where you test the table selection and the **Request review** button, so an LWC that hides everything behind `isPreview` cannot be tested there. Use `isPreview` for small things: a badge, sample text, or skipping a call to an external service.

## Build it

Choose how you want to build:

✨ **Build with AI**: give your AI assistant a ready-to-use prompt.

🛠️ **Build with clicks**: follow the steps in the builder yourself.

{% tabs %}
{% tab title="Build with AI" icon="wand-magic-sparkles" slug="show-a-placeholder-in-the-builder-build-with-ai" %}
Your assistant updates the LWC bundle and checks the container with the `avonni-dynamic-components` skill; the `accountSnapshot` LWC and its Dynamic Component must already be in your sandbox.

{% stepper %}
{% step %}

### Set up the Avonni Skills and MCP server

Follow [Setup](https://docs.avonnicomponents.com/dynamic-components/build-with-ai/setup.md) to install the Avonni Skills, connect your AI assistant to the Avonni MCP server, and sign in to your sandbox through Salesforce CLI.

Open the Salesforce DX project that holds `accountSnapshot` in the assistant's working folder.
{% endstep %}

{% step %}

### Copy the prompt and review the plan

Paste the prompt into your configured assistant. Check the target org and the field mappings in its plan before you approve it.

{% prompt description="Prompt for this tutorial" icon="wand-magic-sparkles" openInAIProviders="false" defaultExpanded="partial" %}
{% code overflow="wrap" collapsedlinecount="10" %}

```
Use the avonni-dynamic-components skill. Verify the LWC Container component and its Is Builder Attribute Name and Is Preview Attribute Name properties against the Avonni MCP server.

Inspect my sandbox: find the Dynamic Component whose LWC Container shows c/accountSnapshot, and read the local accountSnapshot bundle.

In accountSnapshot, add @api isBuilder and @api isPreview. When isBuilder is true, render only a centered box reading "Account snapshot: shows the account selected in the table." Otherwise render the existing card, with a lightning-badge labeled Preview above it when isPreview is true. Leave the container's Is Builder Attribute Name and Is Preview Attribute Name empty, so the defaults apply.

Show me the plan and the field bindings before writing files. Then draft the local metadata, list what is left for me to set up by hand, and stop before deployment or activation.
```

{% endcode %}
{% endprompt %}
{% endstep %}

{% step %}

### Deploy to the sandbox and check the result

Review what the assistant generated and what it left for you to configure. Deploy the approved files to your sandbox only, finish any remaining setting with the **Build with clicks** tab, then check that the canvas shows the placeholder and Preview shows the badge above a working snapshot.
{% endstep %}
{% endstepper %}
{% endtab %}

{% tab title="Build with clicks" icon="screwdriver-wrench" slug="show-a-placeholder-in-the-builder-build-with-clicks" %}
{% stepper %}
{% step %}

### Deploy the updated LWC

Have your developer deploy `accountSnapshot` with the two flags, then reload the builder so the canvas loads the new version.
{% endstep %}

{% step %}

### Check the attribute names

1. Select the LWC Container on the canvas.
2. In the **Properties** tab, open the advanced options and find **Is Builder Attribute Name** and **Is Preview Attribute Name**.
3. Leave both empty to use `isBuilder` and `isPreview`. Fill one in only when the LWC uses another name, such as `designMode`.
   {% endstep %}

{% step %}

### Save and test

Save. The canvas shows the centered placeholder text instead of an empty card. Open Preview: the "Preview" badge sits above the snapshot, and selecting an account fills it as before. On the published page neither the placeholder nor the badge appears.
{% endstep %}
{% endstepper %}
{% endtab %}
{% endtabs %}

## Troubleshooting

<details>

<summary>The canvas still shows the empty card.</summary>

The `@api` name in the LWC and the container's setting disagree. With **Is Builder Attribute Name** empty, the property must be `isBuilder` exactly. If you typed a name there, the LWC must use that name instead. Reload the builder after each deployment.

</details>

<details>

<summary>Nothing works in Preview any more.</summary>

The LWC hides its real content when `isPreview` is `true`. Move that content back out of the `isPreview` branch and keep only the badge or sample text there.

</details>

## Related tutorials

* [Pass a Selected Row to an LWC](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/lwc-container/pass-a-selected-row-to-an-lwc.md): the snapshot this page changes.
* [React to an LWC Event](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/lwc-container/react-to-an-lwc-event.md): the button you test in Preview.
* [Build the LWC for the Container](https://docs.avonnicomponents.com/dynamic-components/tutorials/components/data-lwc-container/build-the-lwc-for-the-container.md): the same two flags in the Data LWC Container.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avonnicomponents.com/dynamic-components/tutorials/components/lwc-container/show-a-placeholder-in-the-builder.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
