# Autofill

Artifact: [androidx.compose.ui:ui](https://developer.android.com/jetpack/androidx/releases/compose-ui) [View Source](https://cs.android.com/search?q=file:androidx/compose/ui/autofill/Autofill.kt+class:androidx.compose.ui.autofill.Autofill) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0) Common/AllAndroid/JVM
- Cmn

  ```
  interface Autofill
  ```

*** ** * ** ***

> [!CAUTION]
> **This interface is deprecated.**   
> You no longer have to call these apis when focus changes. They will be called automatically when you Use the new semantics based APIs for autofill. Use the androidx.compose.ui.autofill.ContentType and androidx.compose.ui.autofill.ContentDataType semantics properties instead.

Autofill API.

This interface is available to all composables via a CompositionLocal. The composable can then request or cancel autofill as required. For instance, the TextField can call `https://developer.android.com/reference/kotlin/androidx/compose/ui/autofill/Autofill#requestAutofillForNode(androidx.compose.ui.autofill.AutofillNode)` when it gains focus, and `https://developer.android.com/reference/kotlin/androidx/compose/ui/autofill/Autofill#cancelAutofillForNode(androidx.compose.ui.autofill.AutofillNode)` when it loses focus.

## Summary

| ### Public functions |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[cancelAutofillForNode](https://developer.android.com/reference/kotlin/androidx/compose/ui/autofill/Autofill#cancelAutofillForNode(androidx.compose.ui.autofill.AutofillNode))(autofillNode: https://developer.android.com/reference/kotlin/androidx/compose/ui/autofill/AutofillNode)` **This function is deprecated.** You no longer have to call these apis when focus changes. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[requestAutofillForNode](https://developer.android.com/reference/kotlin/androidx/compose/ui/autofill/Autofill#requestAutofillForNode(androidx.compose.ui.autofill.AutofillNode))(autofillNode: https://developer.android.com/reference/kotlin/androidx/compose/ui/autofill/AutofillNode)` **This function is deprecated.** You no longer have to call these apis when focus changes. | Cmn |

## Public functions

### cancelAutofillForNode

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
fun [cancelAutofillForNode](https://developer.android.com/reference/kotlin/androidx/compose/ui/autofill/Autofill#cancelAutofillForNode(androidx.compose.ui.autofill.AutofillNode))(autofillNode: AutofillNode): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> You no longer have to call these apis when focus changes. They will be called automatically when you Use the new semantics based APIs for autofill. Use the androidx.compose.ui.autofill.ContentType and androidx.compose.ui.autofill.ContentDataType semantics properties instead.

Cancel a previously supplied autofill request.

| Parameters |
|---|---|
| `autofillNode: https://developer.android.com/reference/kotlin/androidx/compose/ui/autofill/AutofillNode` | The node that needs to be auto-filled. This function is usually called when an autofill-able component loses focus. |

### requestAutofillForNode

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.0.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/compose-ui#1.8.0)

```
fun [requestAutofillForNode](https://developer.android.com/reference/kotlin/androidx/compose/ui/autofill/Autofill#requestAutofillForNode(androidx.compose.ui.autofill.AutofillNode))(autofillNode: AutofillNode): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> You no longer have to call these apis when focus changes. They will be called automatically when you Use the new semantics based APIs for autofill. Use the androidx.compose.ui.autofill.ContentType and androidx.compose.ui.autofill.ContentDataType semantics properties instead.

Request autofill for the specified node.

| Parameters |
|---|---|
| `autofillNode: https://developer.android.com/reference/kotlin/androidx/compose/ui/autofill/AutofillNode` | The node that needs to be auto-filled. This function is usually called when an autofill-able component gains focus. |