# Controls

User activity and controls visibility state for the player store

Read-only — tracks user activity for showing and hiding controls.

## Import

```ts
import { controlsFeature } from '@videojs/html';
```

The `liveVideoFeatures` and `videoFeatures` [feature bundles](../../guides/presets.md) include this feature.

## API Reference

### State

| Property | Type | Description |
| --- | --- | --- |
| `userActive` | `boolean` | Whether the user has recently interacted with the player. |
| `controlsVisible` | `boolean` | Whether controls should be visible. |

### Actions

| Action | Type | Description |
| --- | --- | --- |
| `requestControlsLock` | `() => (() => void)` | Keep controls visible during a sustained interaction. The returned function releases the lock. Multiple concurrent locks are supported and each release function is idempotent. |
| `toggleControls` | `() => boolean` | Toggle controls visibility. Returns the new `controlsVisible` value. |

### Selector

Pass `selectControls` to [`PlayerController`](./player-controller.md) to subscribe to controls state. Returns `undefined` if the controls feature is not configured.

**controls-overlay.ts**

```ts
import { createPlayer, UIElement, selectControls } from '@videojs/html';
import { videoFeatures } from '@videojs/html/video';

const { PlayerController } = createPlayer({ features: videoFeatures });

class ControlsOverlay extends UIElement {
  readonly #controls = new PlayerController(this, selectControls);
}
```