# AlarmStatusWidgetSortBy

The sort possibilities for AlarmStatusWidgets.

- Source: [`aws-cloudwatch/lib/alarm-status-widget.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-cloudwatch/lib/alarm-status-widget.ts#L8)
- Type last changed: v2.18.0 · 29 Mar 2022

## Example

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

dashboard.addWidgets(new cloudwatch.AlarmStatusWidget({
  title: "Errors",
  alarms: [errorAlarm],
  sortBy: cloudwatch.AlarmStatusWidgetSortBy.STATE_UPDATED_TIMESTAMP,
  states: [cloudwatch.AlarmState.ALARM],
}));
```

## Members

| Member | Description |
| --- | --- |
| `DEFAULT` | Choose DEFAULT to sort them in alphabetical order by alarm name. |
| `STATE_UPDATED_TIMESTAMP` | Choose STATE_UPDATED_TIMESTAMP to sort them first by alarm state, with alarms in ALARM state first, INSUFFICIENT_DATA alarms next, and OK alarms last. |
| `TIMESTAMP` | Choose TIMESTAMP to sort them by the time when the alarms most recently changed state, no matter the current alarm state. |

## Referenced by

- [`AlarmStatusWidgetProps`](/v2/docs/aws-cdk-lib.aws_cloudwatch.AlarmStatusWidgetProps).sortBy
