> 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.

# Set Custom Attribute

## **`element.setCustomAttribute(name, value)`**

Set an attribute on an element.

Previously, this method set only [custom HTML attributes](https://help.webflow.com/hc/en-us/articles/33961389460115) on an element, but now it can set any attributes.

### Syntax

```typescript
element.setCustomAttribute(name: string, value: string): Promise<null>
```

### Parameters

* **`name`** :   *String* - The name of the custom attribute.
* **`value`** :   *String* - The value of the custom attribute

The value of the named custom attribute.

### Returns

**Promise\<`null`>**

A promise that resolves to `null`

### Example

```typescript
// Get Selected Element
const selectedElement = await webflow.getSelectedElement()

if (selectedElement?.customAttributes) {

  // Set Custom Attribute
  await selectedElement.setCustomAttribute("tooltip", "my tooltip value")

}
```

### Designer Ability

| Designer Ability | Locale  | Branch | Workflow | Sitemode |
| :--------------- | :------ | :----- | :------- | :------- |
| **canDesign**    | Primary | Main   | Canvas   | Design   |