<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/textInputAutocapitalization(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE27textInputAutocapitalizationyQrAA04TexteF0VSgF"
  },
  "title" : "textInputAutocapitalization(_:)"
}
-->

# textInputAutocapitalization(_:)

Sets how often the shift key in the keyboard is automatically enabled.

```
nonisolated func textInputAutocapitalization(_ autocapitalization: TextInputAutocapitalization?) -> some View
```

## Parameters

`autocapitalization`

One of the capitalizing behaviors
defined in the [`TextInputAutocapitalization`](/documentation/SwiftUI/TextInputAutocapitalization) struct or nil.

## Discussion

Use `textInputAutocapitalization(_:)` when you need to automatically
capitalize words, sentences, or other text like proper nouns.

In example below, as the user enters text the shift key is
automatically enabled before every word:

```
TextField("Last, First", text: $fullName)
    .textInputAutocapitalization(.words)
```

The [`TextInputAutocapitalization`](/documentation/SwiftUI/TextInputAutocapitalization) struct defines the available
autocapitalizing behavior. Providing `nil` to  this view modifier does
not change the autocapitalization behavior. The default is
`TextInputAutocapitalization.sentences`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)