> This page is for Designer API.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.webflow.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.webflow.com/_mcp/server.

# Prepend (Beta)

> Add a component instance as the first child of a slot.

## `slot.prepend(component)`

Add a component instance as the first child of the slot.

Only component instances can be added to slots.
Components from installed libraries are not supported; only components in the site's own component library can be added to a slot.
This action is undoable via the Designer's undo stack.

> **Beta**
>
> These methods are in public beta and may change with future releases.

## Syntax

```typescript
slot.prepend(component: Component): Promise<null>
```

## Parameters

* **component**: *Component* — The component definition to instantiate and insert at the beginning of the slot.

## Returns

**Promise\<`null`>**

A Promise that resolves when the component instance is added.

## Example

```typescript
// Get a component instance on the page
const elements = await webflow.getAllElements();
const componentInstance = elements.find(el => el.type === 'ComponentInstance');

if (componentInstance?.type === 'ComponentInstance') {

  // Get the first slot on the instance
  const slots = await componentInstance.getSlots();
  const firstSlot = slots[0];

  if (firstSlot) {

    // Find the component to add
    const components = await webflow.getAllComponents();
    const cardComponent = await webflow.getComponentByName('Card');

    if (cardComponent) {

      // Prepend a component instance to the slot
      await firstSlot.prepend(cardComponent);

    }
  }

} else {
  console.log('No component instance found');
}
```

## Designer Ability

| Designer Ability | Locale | Branch | Workflow | Sitemode |
| :--------------- | :----- | :----- | :------- | :------- |
| **canDesign**    | Any    | Any    | Canvas   | Any      |