# @ray-js/panel-sdk

> Tuya Mini App Panel SDK

Latest version **1.16.1** (published 2026-04-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ray-js/panel-sdk
pnpm add @ray-js/panel-sdk
yarn add @ray-js/panel-sdk
bun add @ray-js/panel-sdk
```

## Health

**Score 55/100 (C)** — status: active.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.16.1 |
| Published | 2026-04-28 |
| First published | 2022-08-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | tuyafe |

## Links

- npm: https://www.npmjs.com/package/@ray-js/panel-sdk
- npm.io page: https://npm.io/package/@ray-js/panel-sdk

## Dependencies (10)

- [events](https://npm.io/package/events.md) ^3.3.0
- [base64-js](https://npm.io/package/base64-js.md) ^1.5.1
- [lodash-es](https://npm.io/package/lodash-es.md) ^4.17.21
- [@ray-js/track](https://npm.io/package/@ray-js/track.md) ^0.1.2
- [base64-browser](https://npm.io/package/base64-browser.md) ^1.0.1
- [@ray-core/runtime](https://npm.io/package/@ray-core/runtime.md) ^0.3.6
- [@ray-js/panel-cloud](https://npm.io/package/@ray-js/panel-cloud.md) ^1.4.2
- [@ray-js/panel-shared](https://npm.io/package/@ray-js/panel-shared.md) ^1.3.0
- [use-context-selector](https://npm.io/package/use-context-selector.md) ^1.4.1
- [@ray-js/tuya-dp-transform](https://npm.io/package/@ray-js/tuya-dp-transform.md) ^0.0.7

## Recent versions

- 1.16.1 (latest) — 2026-04-28
- 1.6.2-beta.0 (beta) — 2026-08-13
- 1.16.0-multiDevice.0 (multiDevice) — 2026-02-27
- 1.13.0-storage.0 (storage) — 2024-07-16
- 1.11.0-tapToRun.1 (tapToRun) — 2024-06-18
- 1.10.0-linkage.2 (linkage) — 2024-01-22
- 1.5.0-sgm.1 (sgm) — 2023-06-06
- 1.6.1-matter.5 — 2026-06-18
- 1.6.1-matter.4 — 2026-06-16
- 1.6.1-matter.3 — 2026-06-16
- 1.6.1-matter.2 — 2026-06-16
- 1.6.1-matter.1 — 2026-06-16
- 1.16.1-beta.0 — 2026-04-28
- 1.15.0-beta.customlog3 — 2026-04-01
- 1.15.0-beta.customlog2 — 2026-04-01
- … 197 more at https://npm.io/package/@ray-js/panel-sdk/versions

## README

English | [简体中文](./README-zh_CN.md)

# @ray-js/panel-sdk

[![latest](https://img.shields.io/npm/v/@ray-js/panel-sdk/latest.svg)](https://www.npmjs.com/package/@ray-js/panel-sdk) [![download](https://img.shields.io/npm/dt/@ray-js/panel-sdk.svg)](https://www.npmjs.com/package/@ray-js/panel-sdk)

> Ray Panel Mini App Base JS SDK

## Installation

```sh
$ npm install @ray-js/panel-sdk
# or
$ yarn add @ray-js/panel-sdk
# or
$ pnpm add @ray-js/panel-sdk
```

## Basic Usage

### Utility Methods

```javascript
import { utils } from '@ray-js/panel-sdk';
 
utils.toFixed('111', 5); // '00111'
```

### Hooks

```jsx
import React from 'react';
import { View } from '@ray-js/ray';
import { useScreenAlwaysOn } from '@ray-js/panel-sdk';
 
export default () => {
  useScreenAlwaysOn();
  return (
    <View>
      Keep the device screen always on, effective in the current component, ineffective when the current component is unmounted
    </View>
  );
};
```

## Smart Device Model

> Use the `useProps` and `useActions` hooks to get the properties and methods of the device model. For detailed access documentation, please refer to the [MiniApp Developer Documentation](https://developer.tuya.com/en/miniapp/) and search for Smart Device Model.

```tsx
import React from 'react';
import { Button, View, Text } from '@ray-js/ray';
import { useActions, useProps } from '@ray-js/panel-sdk';
 
export default function Home() {
  const power = useProps(props => props.power);
  const actions = useActions();
  return (
    <View>
      <Button onClick={() => actions.power.toggle()}>
        Click me to toggle the device switch state
      </Button>
      <Text>{`Switch state: ${power}`}</Text>
    </View>
  );
}
```

---
_Source: https://npm.io/package/@ray-js/panel-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
