<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITextInputAssistantItem",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UITextInputAssistantItem"
  },
  "title" : "UITextInputAssistantItem"
}
-->

# UITextInputAssistantItem

An object that manages custom bar button items that you add to the shortcuts bar above the keyboard on iPad.

```
@MainActor class UITextInputAssistantItem
```

## Overview

Use a [`UITextInputAssistantItem`](/documentation/UIKit/UITextInputAssistantItem) object to add app-specific actions to the shortcuts bar on iPad. The center of the shortcuts bar displays typing suggestions for the user. You can install custom bar button items that lead or trail the typing suggestions.

> Note:
> You can add custom items to the shortcuts bar on iPad only. On iPhone, the text input system ignores the contents of the ``doc://com.apple.uikit/documentation/UIKit/UITextInputAssistantItem`` object.

You don’t create instances of this class directly. Instead, you get an input assistant from the [`inputAssistantItem`](/documentation/UIKit/UIResponder/inputAssistantItem) property of the responder object whose keyboard you want to modify. When the keyboard is onscreen, UIKit automatically searches the responder chain for a text-input assistant object. Typically, you assign the text-input assistant to the object that becomes the first responder. However, you can also assign it to a parent responder object to share a set of shortcuts among multiple children.

Organize the bar button items you create for the shortcuts bar into groups. A [`UIBarButtonItemGroup`](/documentation/UIKit/UIBarButtonItemGroup) object manages each group of items, and each group may contain a single item or several items. UIKit displays as many items as possible based on the available space. When there’s not enough space for all of the items, UIKit collapses each group of items down to a single representative item.

The following code configures the items of the shortcuts bar. After creating the bar button items, this code creates a group and assigns that group to the [`leadingBarButtonGroups`](/documentation/UIKit/UITextInputAssistantItem/leadingBarButtonGroups) property. The resulting items appear before the typing suggestions.

```objc
// Get a UITextView object of the current view controller.
UITextInputAssistantItem* item = [self.textView inputAssistantItem];

// Set up the buttons.
UIBarButtonItem* itemOne = [[UIBarButtonItem alloc] initWithTitle:@"One"
         style:UIBarButtonItemStylePlain target:self action:@selector(handleItemOne:)];
UIBarButtonItem* itemTwo = [[UIBarButtonItem alloc] initWithTitle:@"Two"
         style:UIBarButtonItemStylePlain target:self action:@selector(handleItemTwo:)];
UIBarButtonItem* itemThree = [[UIBarButtonItem alloc] initWithTitle:@"Three"
         style:UIBarButtonItemStylePlain target:self action:@selector(handleItemThree:)];
 
// Use a nil action to display the individual items.
UIBarButtonItem* itemChoose = [[UIBarButtonItem alloc] initWithTitle:@"Choose"
         style:UIBarButtonItemStylePlain target:nil action:nil];
 
// Create the item group.
UIBarButtonItemGroup* group = [[UIBarButtonItemGroup alloc]
       initWithBarButtonItems:@[itemOne, itemTwo, itemThree] representativeItem:itemChoose];
 
// Display the items before the typing suggestions.
item.leadingBarButtonGroups = @[group];
```

To hide shortcuts altogether, set the [`leadingBarButtonGroups`](/documentation/UIKit/UITextInputAssistantItem/leadingBarButtonGroups) and [`trailingBarButtonGroups`](/documentation/UIKit/UITextInputAssistantItem/trailingBarButtonGroups) properties to empty arrays. Doing so hides only the shortcuts and doesn’t hide the typing suggestions. For information on managing the typing suggestions, see [`autocorrectionType`](/documentation/UIKit/UITextInputTraits/autocorrectionType).

## Topics

### Configuring the shortcuts bar

[`leadingBarButtonGroups`](/documentation/UIKit/UITextInputAssistantItem/leadingBarButtonGroups)

The array of button item groups to display before the typing suggestions.

[`trailingBarButtonGroups`](/documentation/UIKit/UITextInputAssistantItem/trailingBarButtonGroups)

The array of button item groups to display after the typing suggestions.

[`allowsHidingShortcuts`](/documentation/UIKit/UITextInputAssistantItem/allowsHidingShortcuts)

A Boolean value that indicates whether the user can hide the shortcuts bar.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`Sendable`](/documentation/Swift/Sendable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)