# State Management

The CheckBox enables you to control its checked state and respond to state changes through the [`checkedState`](https://www.telerik.com/kendo-angular-ui/components/inputs/api/checkboxcomponent#checkedstate) property and the [`checkedStateChange`](https://www.telerik.com/kendo-angular-ui/components/inputs/api/checkboxcomponent#checkedstatechange) event.

The [`checkedState`](https://www.telerik.com/kendo-angular-ui/components/inputs/api/checkboxcomponent#checkedstate) property accepts three values defined by the [`CheckBoxState`](https://www.telerik.com/kendo-angular-ui/components/inputs/api/checkboxstate) type:

* `true`—The CheckBox is checked.
* `false`—The CheckBox is unchecked.
* `'indeterminate'`—The CheckBox displays an indeterminate state. When using the native HTML input element with the [`kendoCheckBox`](https://www.telerik.com/kendo-angular-ui/components/inputs/api/checkboxdirective) directive, set the [`indeterminate`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/indeterminate) attribute to `true` instead.

## Controlling the Checked State

Implement [two-way binding](https://angular.dev/guide/templates/two-way-binding) for the `checkedState` property to keep the CheckBox state in sync with user interactions. The bound property updates automatically when the user clicks the CheckBox, and the component reflects any programmatic changes to the property.

```HTML
<kendo-checkbox [(checkedState)]="checkedState"></kendo-checkbox>
```

```TypeScript
public checkedState: CheckBoxState = false;
```

The following example demonstrates how to control the checked state of the CheckBox through two-way binding and external buttons.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/inputs/checkbox/controlled-state/source.txt)

## Handling Checked State Changes

To execute custom logic when the checked state changes, bind a handler to the `checkedStateChange` event separately. The handler receives the new [`CheckBoxState`](https://www.telerik.com/kendo-angular-ui/components/inputs/api/checkboxstate) value.

> The `checkedStateChange` event does not fire when the state changes programmatically through `ngModel` or `formControl`.

```HTML
<kendo-checkbox
    [checkedState]="isChecked"
    (checkedStateChange)="onStateChange($event)"
></kendo-checkbox>
```

```TypeScript
public isChecked: CheckBoxState = false;

public onStateChange(state: CheckBoxState): void {
    this.isChecked = state;
}
```

## Enabling User Actions Based on Checked State

A common use case for the `checkedStateChange` event is to enable or disable user actions based on the current state. The following example demonstrates a terms-of-service agreement where checking the CheckBox enables the submit button.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/inputs/checkbox/terms-agreement/source.txt)

## Toggling Dependent Options

The `checkedStateChange` event lets you create dependencies between form controls. For example, you can disable a child CheckBox when its parent is unchecked.

The following example demonstrates a notifications CheckBox that controls whether the email alerts CheckBox is enabled.

[Demo Source](https://demos.telerik.com/kendo-angular-ui/demos/inputs/checkbox/feature-toggle/source.txt)

## Suggested Links

* [Disabled CheckBox](https://www.telerik.com/kendo-angular-ui/components/inputs/checkbox/disabled-state)
* [Forms Support](https://www.telerik.com/kendo-angular-ui/components/inputs/checkbox/forms)
* [API Reference of the CheckBox](https://www.telerik.com/kendo-angular-ui/components/inputs/api/checkboxcomponent)
