> This page is for Code Components.

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

# ID

> Configure an ID property for a code component

Add an ID property to your component so designers can set unique identifiers on HTML elements.

The ID prop creates a text input for element IDs, making it easy to target elements with CSS or JavaScript.

## Syntax

```tsx
// Prop definition
props.Id({
    name: string,
    group?: string,
    tooltip?: string,
})

// Prop value
string
```

### Prop definition

Define the ID prop in your Webflow code component with a name. Optionally, you can add a group and tooltip text.

```tsx
props.Id({
    name: string,
    group?: string,
    tooltip?: string,
})
```

#### Properties

* `name`: The name for the property.
* `group`: The group for this property (optional).
* `tooltip`: The tooltip for this property (optional).

#### Example

```tsx title={"MyComponent.webflow.tsx"}
import { declareComponent } from '@webflow/react';
import { props } from '@webflow/data-types';
import { MyComponent } from "./MyComponent";

export default declareComponent(MyComponent,    {
    name: "MyComponent",
    description: "A component with an ID property",
    props: {
        id: props.Id({
            name: "Element ID",
            group: "Info"
        })
    }
});
```

### Prop value

The ID prop provides a string to your React component:

**`PropType.Id`**

```tsx title="PropType.Id"
string
```

#### Properties

* `n/a`

#### Webflow properties panel

![ID property in the Webflow panel](/_fern-img/ac1bd8660e095d93d30bffb6bd0110b6a24b5162317aab3f60a734d1f494bdc6.webp)

#### Example

```tsx title={"MyComponent.tsx"}
import React from "react";

interface MyComponentProps {
id?: string;
}

export const MyComponent = ({ id }: MyComponentProps) => {
return (
    <div id={id}>
    {/* Component content */}
    </div>
);
}
```

## When to use

Use an ID prop when you want designers to:

* Set unique identifiers for CSS targeting
* Connect form labels to inputs
* Enable JavaScript interactions