JS Item is used for "custom items" (not bound to a field) in a form. You can use JavaScript/JSX to render any content (such as tips, statistics, previews, buttons, etc.) and interact with the form and record context. It is suitable for scenarios like real-time previews, instructional tips, and small interactive components.

ctx.element: The DOM container (ElementProxy) of the current item, supporting innerHTML, querySelector, addEventListener, etc.ctx.form: The AntD Form instance, allowing operations like getFieldValue / getFieldsValue / setFieldsValue / validateFields, etc.ctx.blockModel: The model of the form block it belongs to, which can listen to formValuesChange to implement linkage.ctx.record / ctx.collection: The current record and collection metadata (available in some scenarios).ctx.requireAsync(url): Asynchronously load an AMD/UMD library by URL.ctx.importAsync(url): Dynamically import an ESM module by URL.ctx.openView(viewUid, options): Open a configured view (drawer/dialog/page).ctx.message / ctx.notification: Global message and notification.ctx.t() / ctx.i18n.t(): Internationalization.ctx.onRefReady(ctx.ref, cb): Render after the container is ready.ctx.React / ctx.ReactDOM / ctx.antd: Supports JSX, rendered directly by ctx.ReactDOM.ctx.render(vnode): Renders a React element/HTML/DOM to the default container ctx.element. Multiple renders will reuse the Root and overwrite the existing content of the container.Snippets: Opens a list of built-in code snippets, allowing you to search and insert them at the current cursor position with one click.Run: Executes the current code directly and outputs the execution logs to the Logs panel at the bottom. It supports console.log/info/warn/error and error highlighting.
if (!lib) return;).class or [name=...] for selectors and avoid using fixed ids to prevent duplicate ids in multiple blocks/popups.remove before add, use { once: true }, or use a dataset attribute to prevent duplicates).