---
title: "Autofill"
description: "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
[requestAutofillForNode] when it gains focus, and [cancelAutofillForNode] when it loses focus."
type: "interface"
---

<div class='type'>Interface</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


> **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. "


```kotlin
interface Autofill
```


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
`requestAutofillForNode` when it gains focus, and `cancelAutofillForNode` when it loses focus.


## Functions

```kotlin
fun requestAutofillForNode(autofillNode: @Suppress("Deprecation") AutofillNode)
```


Request autofill for the specified node.


This function is usually called when an autofill-able component gains focus.

#### Parameters

| | |
| --- | --- |
| autofillNode | The node that needs to be auto-filled. |



```kotlin
fun cancelAutofillForNode(autofillNode: @Suppress("Deprecation") AutofillNode)
```


Cancel a previously supplied autofill request.


This function is usually called when an autofill-able component loses focus.

#### Parameters

| | |
| --- | --- |
| autofillNode | The node that needs to be auto-filled. |




