# TableWidget

A dashboard widget that displays metrics.

Extends: ConcreteWidget › TableWidget
Implements: IWidget

- Source: [`aws-cloudwatch/lib/graph.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts#L777)
- Type last changed: v2.128.0 · 14 Feb 2024

## Example

```ts
declare const dashboard: cloudwatch.Dashboard;

dashboard.addWidgets(new cloudwatch.TableWidget({
  // ...

  layout: cloudwatch.TableLayout.VERTICAL,
}));
```

## Initializer

```ts
new TableWidget(props: TableWidgetProps)
```

## Properties

- `height`: number — The amount of vertical grid units the widget will take up.

- `warnings`: string[] — Any warnings that are produced as a result of putting together this widget.

- `warningsV2`: { [key: string]: string } — Any warnings that are produced as a result of putting together this widget.

- `width`: number — The amount of horizontal grid units the widget will take up.

## Methods

- `addMetric(metric: IMetric): void` — Add another metric.

  **Parameters**

  - `metric` — the metric to add.

- `position(x: number, y: number): void` — Place the widget at a given position.

- `toJson(): any[]` — Return the widget JSON for use in the dashboard.
