# TableWidget

A dashboard widget that displays metrics.

Extends: [ConcreteWidget](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.ConcreteWidget.html) › TableWidget
Implements: [IWidget](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.IWidget.html)

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

## Example

TypeScript:

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

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

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

Python:

```python
# dashboard: cloudwatch.Dashboard

dashboard.add_widgets(cloudwatch.TableWidget(
    # ...

    layout=cloudwatch.TableLayout.VERTICAL
))
```

Java:

```java
Dashboard dashboard;

dashboard.addWidgets(TableWidget.Builder.create()
        // ...

        .layout(TableLayout.VERTICAL)
        .build());
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
Dashboard dashboard;

dashboard.AddWidgets(new TableWidget(new TableWidgetProps {
    // ...

    Layout = TableLayout.VERTICAL
}));
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var dashboard Dashboard

dashboard.AddWidgets(cloudwatch.NewTableWidget(&TableWidgetProps{
	// ...

	Layout: cloudwatch.TableLayout_VERTICAL,
}))
```

## Initializer

TypeScript:

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

Python:

```python
TableWidget(props: TableWidgetProps)
```

Java:

```java
new TableWidget(TableWidgetProps props)
```

C# / .NET:

```csharp
new TableWidget(TableWidgetProps props)
```

Golang:

```go
NewTableWidget(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.
