---
name: "NodesRef"
mode: "api"
versionRequirements:
  - { name: "Base Library", version: "2.10.0" }
title: "NodesRef"
---

## NodesRef

> [VERSION] Base Library >= 2.10.0

### Description

Object used to obtain TYML node information. Obtain a NodesRef instance via methods such as [SelectorQuery.select()](/en/miniapp/develop/miniapp/api/tyml/SelectorQuery/select), which can be used to query node layout position, scroll offset, and more

### Parameters

None


### Return Value

Type: `NodesRef`

NodesRef instance

#### Methods

| Method | Description |
| --- | --- |
| `fields` | Get information about the node. The fields to retrieve are specified in fields. |
| `boundingClientRect` | Adds a query request for a node's layout position. Relative to the viewport, in pixels. Similar to the DOM getBoundingClientRect |
| `scrollOffset` | Add a query request for the node's scroll position, in pixels. The node must be a scroll-view or the viewport |

### Examples

#### Get node layout information

```html
// index.tyml
<view id="box" class="box">Target node</view>
```

```js
// index.js
Page({
  onReady() {
    ty.createSelectorQuery()
      .select('#box')
      .boundingClientRect((rect) => {
        console.log('Node info', rect);
      })
      .exec();
  },
});
```

```css
// index.tyss
.box {
  width: 300rpx;
  height: 150rpx;
  background-color: #e8f4ff;
}
```
