> For the complete documentation index, see [llms.txt](https://docs.realmacsoftware.com/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/api-reference/components/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 by asking a question.

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

```
GET https://docs.realmacsoftware.com/elements/api-reference/components/hooks.js/available-data/rw.node.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.
