> **Experimental**
>
> `@aws-cdk/aws-iotevents-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# StateProps

Properties for defining a state of a detector.

Extends: StateProps
Used as props by: State

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/state.ts`](https://github.com/aws/aws-cdk/blob/v2.276.0-alpha.0/packages/@aws-cdk/aws-iotevents-alpha/lib/state.ts#L62)

## Example

```ts
import * as iotevents from '@aws-cdk/aws-iotevents-alpha';
import * as actions from '@aws-cdk/aws-iotevents-actions-alpha';

declare const input: iotevents.IInput;

const state = new iotevents.State({
  stateName: 'MyState',
  onEnter: [{
    eventName: 'test-event',
    condition: iotevents.Expression.currentInput(input),
    actions: [
      new actions.SetTimerAction('MyTimer', {
        duration: cdk.Duration.seconds(60),
      }),
    ],
  }],
});
```

## Properties

- `onEnter`: [Event](/cdk/api/v2/docs/@aws-cdk_aws-iotevents-alpha.Event.html)[] — Specifies the events on enter.

  **Default:** no events will trigger on entering this state

  The conditions of the events will be evaluated when entering this state.
  If the condition of the event evaluates to `true`, the actions of the event will be executed.

- `onExit`: [Event](/cdk/api/v2/docs/@aws-cdk_aws-iotevents-alpha.Event.html)[] — Specifies the events on exit.

  **Default:** no events will trigger on exiting this state

  The conditions of the events are evaluated when an exiting this state.
  If the condition evaluates to `true`, the actions of the event will be executed.

- `onInput`: [Event](/cdk/api/v2/docs/@aws-cdk_aws-iotevents-alpha.Event.html)[] — Specifies the events on input.

  **Default:** no events will trigger on input in this state

  The conditions of the events will be evaluated when any input is received.
  If the condition of the event evaluates to `true`, the actions of the event will be executed.

- `stateName`: string (required) — The name of the state.
