> For the complete documentation index, see [llms.txt](https://dev.ubidots.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dev.ubidots.com/dashboards-and-widgets/custom-metric.md).

# Custom Metric

Build custom dashboard widgets as React apps with the Custom Metric widget and @ubidots/react-html-canvas

## Introduction

The Custom Metric widget lets you build your own dashboard widget when the off-the-shelf widgets don't fit. A Custom Metric widget is a small React app built on [`@ubidots/react-html-canvas`](/sdks/dashboard-runtime-library.md). It renders inside an iframe on the dashboard and talks to the dashboard only through that library: hooks, actions and widget events.

{% hint style="info" %}
Custom Metric is the new version of the [HTML Canvas](/dashboards-and-widgets/html-canvas.md) widget. Use it for new custom widgets.
{% endhint %}

## How to create a Custom Metric widget

Go to a dashboard, click the *Add new widget* button (+) and select *Custom Metric*. Pick the variables the widget shows, then write the widget's code in its code editor, or describe what you want to the AI assistant and let it write the code.

## What a widget can do

A widget works with the dashboard in two directions: what it can **GET** (read) and what it can **EMIT** (drive). See [Dashboard capabilities](/dashboards-and-widgets/custom-metric/dashboard-capabilities.md) for the full list, with the exact shape and a snippet for each item.

* [Project setup](/dashboards-and-widgets/custom-metric/project-setup.md): the files of a widget, how it mounts, and its `manifest.toml`.
* [Layout and CSS](/dashboards-and-widgets/custom-metric/layout-and-css.md): fill the widget at any size.
* [Dashboard capabilities](/dashboards-and-widgets/custom-metric/dashboard-capabilities.md): the widget's data, devices, date range, real-time, dashboard actions and widget-to-widget events.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://dev.ubidots.com/dashboards-and-widgets/custom-metric.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
