# wrAutofocus

> Moves DOM focus to the host on init. Bind a boolean to focus reactively whenever the expression becomes truthy.

Source: https://ngwr.dev/reference/directives/autofocus  
Kind: Directive

## Import

```angular-ts
import { WrButton } from 'ngwr/button';
import { WrAutofocus } from 'ngwr/directives';
import { WrInput } from 'ngwr/input';
```

## Usage

```angular-html
<input wrAutofocus placeholder="Focused on init" />
<input [wrAutofocus]="shouldFocus()" />
```

## API

| Name | Description | Type | Default |
| --- | --- | --- | --- |
| `[wrAutofocus]` | Focus host on init, or whenever the bound expression becomes truthy. | `boolean (default true)` | `—` |
