> For the complete documentation index, see [llms.txt](https://docs.realmacsoftware.com/elements-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.realmacsoftware.com/elements-docs/elements-language/component/hooks.js/available-data/rw.node.md).

# rw\.node

The `rw.node` object provides access to information about the current component instance (node) in the page structure.

## Properties

| Property           | Type   | Description                                   |
| ------------------ | ------ | --------------------------------------------- |
| `id`               | String | Unique identifier for this component instance |
| `title`            | String | The component's display title                 |
| `parent.id`        | String | ID of the parent component                    |
| `parent.container` | String | Container identifier within parent            |
| `backendPath`      | String | Path to the node's backend folder             |

## Accessing Node Data

```javascript
const transformHook = (rw) => {
    const { id, title, parent, backendPath } = rw.node;
    
    console.log(id);              // "abc123"
    console.log(title);           // "My Container"
    console.log(parent.id);       // "parent456"
    console.log(parent.container);// "content"
    console.log(backendPath);     // "/path/to/backend/"
};

exports.transformHook = transformHook;
```

{% hint style="info" %}
The `node` object is always available in templates without needing to pass it through `setProps`.
{% endhint %}

## Using Node ID for Unique Identifiers

The node ID is commonly used to create unique identifiers for DOM elements:

```javascript
const transformHook = (rw) => {
    const { id } = rw.node;
    
    rw.setProps({
        elementId: `container-${id}`,
        groupClass: `group/${id}`
    });
};

exports.transformHook = transformHook;
```

## Accessing Parent Information

Useful for creating grouped behaviors or scoped styling:

```javascript
const transformHook = (rw) => {
    const { id, parent } = rw.node;
    
    // Use parent ID for group hover effects
    const hoverClass = `group-hover/${parent.id}`;
    
    rw.setProps({
        nodeId: id,
        parentId: parent.id,
        hoverClass
    });
};

exports.transformHook = transformHook;
```

## Using in Templates

The node is automatically available in templates:

```html
<!-- Node ID for unique element IDs -->
<div id="{{node.id}}">
    <h2>{{node.title}}</h2>
</div>

<!-- For backend resources -->
<script src="{{node.backendPath}}/script.js"></script>
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.realmacsoftware.com/elements-docs/elements-language/component/hooks.js/available-data/rw.node.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
