---
name: "NodesRef.fields"
mode: "api"
versionRequirements:
  - { name: "Base Library", version: "2.10.0" }
title: "NodesRef.fields - Get relevant information about a node"
---

## NodesRef.fields

> [VERSION] Base Library >= 2.10.0

### Description

Get information about the node. The fields to retrieve are specified in fields.

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `e` | `any` | Yes | Specify the fields to retrieve (id, dataset, rect, size, scrollOffset, properties, etc.). |
| `t` | `any` | Yes | Callback function; receives the node information. |

### Return Value

Type: `SelectorQuery`

SelectorQuery object

### Examples

#### Get a node's custom fields

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

```js
// index.js
Page({
  onReady() {
    ty.createSelectorQuery()
      .select('#box')
      .fields({
        id: true,
        dataset: true,
        rect: true,
        size: true,
        scrollOffset: true,
        properties: ['style'],
      }, (res) => {
        console.log('Node info', res);
      })
      .exec();
  },
});
```

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