> ## Documentation Index
> Fetch the complete documentation index at: https://docs.morph-data.io/llms.txt
> Use this file to discover all available pages before exploring further.

# <Metrics />

<Frame>
  <img src="https://mintcdn.com/queue-4c50ebb3/_HQi-05AKdEsS8di/assets/images/pages/metrics.jpg?fit=max&auto=format&n=_HQi-05AKdEsS8di&q=85&s=eb49514bb9e34734a822e9ae4495e7bf" width="1280" height="720" data-path="assets/images/pages/metrics.jpg" />
</Frame>

# MetricsGrid

The MetricsGrid component displays each row of the execution results of Python functions or SQL files using the Metrics component.

The display is in grid format.

```tsx theme={"dark"}
<MetricsGrid
  cols="3"
  loadData="aws_cost"
  value="cost"
  label="service"
  prefix={() => "$"}
  suffix={() => "/mo"}
  footer={(item) => (
    <span style={{ opacity: 0.5 }}>
      {`${item["usage"]["instance_type"]}`}, {item["region"]}
    </span>
  )}
/>
```

## Properties

<ParamField path="loadData" type="string" required>
  The name of the Python function or SQL file
</ParamField>

<ParamField path="variables" type="{ [key: string]: any }">
  Variables to pass to the Python function or SQL file. Declare them using the `defineState()` function.
</ParamField>

<ParamField path="value" type="function | string">
  Controls the value displayed in the center of the card.
  If a function is passed, its execution result is treated as the Value. If a string is passed, it is treated as the column name, and the column value is treated as the Value.
</ParamField>

<ParamField path="label" type="function | string">
  Controls the string displayed above the value.
  If a function is passed, its execution result is treated as the label. If a string is passed, it is treated as the column name, and the column value is treated as the label.
</ParamField>

<ParamField path="preix" type="function | string">
  Controls the string displayed to the left of the Value.
  If a function is passed, its execution result is treated as the Prefix. If a string is passed, it is treated as the column name, and the column value is treated as the Prefix.
</ParamField>

<ParamField path="suffix" type="function | string">
  Controls the string displayed to the right of the Value.
  If a function is passed, its execution result is treated as the Suffix. If a string is passed, it is treated as the column name, and the column value is treated as the Suffix.
</ParamField>

<ParamField path="footer" type="function">
  Controls the string displayed at the bottom of the card.
  If a function is passed, its execution result is displayed as the Footer.
</ParamField>

# Metrics

The Metrics component displays the value of a specific column from the **first row** of the execution results of Python functions or SQL files.

```tsx theme={"dark"}
<Metrics
  loadData="aws_coast"
  value="cost"
  label="service"
  prefix={() => "$"}
  suffix={() => "/mo"}
  footer={(item) => (
    <span style={{ opacity: 0.5 }}>
      {`${item["usage"]["instance_type"]}`}, {item["region"]}
    </span>
  )}
/>
```

## Properties

<ParamField path="loadData" type="string" required>
  The name of the Python function or SQL file
</ParamField>

<ParamField path="varialbes" type="{ [key: string]: any }">
  Variables to pass to the Python function or SQL file. Declare using the `defineState()` function.
</ParamField>

<ParamField path="value" type="function | string">
  Controls the value displayed in the center of the card.
  If a function is passed, its execution result is treated as the Value. If a string is passed, it is treated as the column name, and the column value is treated as the Value.
</ParamField>

<ParamField path="label" type="function | string">
  Controls the string displayed above the value.
  If a function is passed, its execution result is treated as the label. If a string is passed, it is treated as the column name, and the column value is treated as the label.
</ParamField>

<ParamField path="preix" type="function | string">
  Controls the string displayed to the left of the Value.
  If a function is passed, its execution result is treated as the Prefix. If a string is passed, it is treated as the column name, and the column value is treated as the Prefix.
</ParamField>

<ParamField path="suffix" type="function | string">
  Controls the string displayed to the right of the Value.
  If a function is passed, its execution result is treated as the Suffix. If a string is passed, it is treated as the column name, and the column value is treated as the Suffix.
</ParamField>

<ParamField path="footer" type="function">
  Controls the string displayed at the bottom of the card.
  If a function is passed, its execution result is displayed as the Footer.
</ParamField>
