# AlarmWidgetProps

Properties for an AlarmWidget.

Extends: [MetricWidgetProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.MetricWidgetProps.html)
Used as props by: [AlarmWidget](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.AlarmWidget.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#L92)
- Type last changed: v2.234.0 · 8 Jan 2026

## Example

TypeScript:

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

dashboard.addWidgets(new cloudwatch.AlarmWidget({
  title: "Errors",
  alarm: errorAlarm,
}));
```

Python:

```python
# dashboard: cloudwatch.Dashboard
# error_alarm: cloudwatch.Alarm

dashboard.add_widgets(cloudwatch.AlarmWidget(
    title="Errors",
    alarm=error_alarm
))
```

Java:

```java
Dashboard dashboard;
Alarm errorAlarm;

dashboard.addWidgets(AlarmWidget.Builder.create()
        .title("Errors")
        .alarm(errorAlarm)
        .build());
```

C# / .NET:

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

dashboard.AddWidgets(new AlarmWidget(new AlarmWidgetProps {
    Title = "Errors",
    Alarm = errorAlarm
}));
```

Golang:

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

dashboard.AddWidgets(cloudwatch.NewAlarmWidget(&AlarmWidgetProps{
	Title: jsii.String("Errors"),
	Alarm: errorAlarm,
}))
```

## Properties

- `accountId`: string — The AWS account ID where the metrics are located.

  **Default:** Current account

  This enables cross-account functionality for CloudWatch dashboards.
  Before using this feature, ensure that proper cross-account sharing is configured
  between the monitoring account and source account.

  For more information, see:
  https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html

- `alarm`: [IAlarmRef](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_cloudwatch.IAlarmRef.html) (required) — The alarm to show.

- `height`: number — Height of the widget.

  **Default:** 6 for Alarm and Graph widgets. 3 for single value widgets where most recent value of a metric is displayed.

- `leftYAxis`: [YAxisProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudwatch.YAxisProps.html) — Left Y axis.

  **Default:** No minimum or maximum values for the left Y-axis

- `region`: string — The region the metrics of this graph should be taken from.

  **Default:** Current region

- `title`: string = None — Title for the graph.

- `width`: number = 6 — Width of the widget, in a grid of 24 units wide.
