diff --git a/examples/README.md b/examples/README.md index 4b59380e78c..ea1ee38fd59 100644 --- a/examples/README.md +++ b/examples/README.md @@ -214,31 +214,35 @@ However, depending on external URLs is maybe not what you want as it breaks your Legacy non-module scripts should define any loading helper they need inside the example. -### `.controls.mjs` +### `.controls.jsx` -This file allows you to define a set of PCUI based interface which can be used to display stats from your example or provide users with a way of controlling the example. +This file defines a PCUI based control panel — a React component used to display stats from your example or to give users a way of controlling it. It is a real `.jsx` file: import the components you need from `@playcanvas/pcui/react` and write JSX. The component must be named `Controls` and its only prop is the [pcui observer](https://playcanvas.github.io/pcui/data-binding/using-observers/). + +```jsx +import { Button } from '@playcanvas/pcui/react'; + +/** + * @import { Observer } from '@playcanvas/observer' + * @import { ReactElement } from 'react' + */ -```js /** - * @param {import('../../../app/Example.mjs').ControlOptions} options - The options. - * @returns {JSX.Element} The returned JSX Element. + * @param {{ observer: Observer }} props - The control panel props. + * @returns {ReactElement} The control panel. */ -export function controls({ observer, ReactPCUI, React, jsx, fragment }) { - const { Button } = ReactPCUI; - return fragment( - jsx(Button, { - text: 'Flash', - onClick: () => { - observer.set('flash', !observer.get('flash')); - } - }) +export function Controls({ observer }) { + return ( +