Skip Navigation

Virtual keyboards

In iOS, iPadOS, tvOS, and visionOS, the system provides various types of virtual keyboards people can use to enter data.

A stylized representation of a numeric keypad shown on top of a grid that suggests the canvas of a design tool. The image is tinted red to subtly reflect the red in the original six-color Apple logo.

A virtual keyboard can provide a specific set of keys that are optimized for the current task; for example, a keyboard that supports entering email addresses can include the “@” character and a period or even “.com”. A virtual keyboard doesn’t support keyboard shortcuts.

When it makes sense in your app, you can replace the system-provided keyboard with a custom view that supports app-specific data entry. In iOS, iPadOS, and tvOS, you can also create an app extension that offers a custom keyboard people can install and use in place of the standard keyboard.

Best practices

Choose a keyboard that matches the type of content people are editing. For example, you can help people enter numeric data by providing the numbers and punctuation keyboard. When you specify a semantic meaning for a text input area, the system can automatically provide a keyboard that matches the type of input you expect, potentially using this information to refine the keyboard corrections it offers. For developer guidance, see UIKeyboardType and UITextContentType.

Consider customizing the Return key label if it helps clarify the text-entry experience. For example, it might make sense to use “Join” or “Done” instead of “Return.” For developer guidance, see UIReturnKeyType.

Custom input views

In some cases, you can create an input view if you want to provide custom functionality that enhances data-entry tasks in your app. For example, Numbers provides a custom input view for entering numeric values while editing a spreadsheet. A custom input view replaces the system-provided keyboard while people are in your app. For developer guidance, see inputViewController. If you want to create a custom keyboard that people can use in other apps as well as yours, you need to create an app extension that people can install.

Make sure your custom input view makes sense in the context of your app. In addition to making data entry simple and intuitive, you want people to understand the benefits of using your custom input view. Otherwise, they may wonder why they can’t regain the system keyboard while in your app.

Play the standard keyboard sound while people type. The keyboard sound provides familiar feedback when people tap a key on the system keyboard, so they’re likely to expect the same sound when they tap keys in your custom input view. People can turn keyboard sounds off for all keyboard interactions in Settings > Sounds. For developer guidance, see playInputClick().

Consider providing a custom input accessory view. An input accessory view can appear above a virtual keyboard — whether standard or custom — providing app-specific functionality related to the data people are working with. For example, Numbers displays an input accessory view that helps people enter standard or custom calculations to apply to spreadsheet data. Avoid using an accessory view to display content that isn’t relevant to the current task. For developer guidance, see inputAccessoryView.

Custom keyboards

In iOS, iPadOS, and tvOS, you can provide a custom keyboard that replaces the system keyboard by creating an app extension. An app extension is code you provide that people can install and use to extend the functionality of a specific area of the system; to learn more, see App extensions.

After people choose your custom keyboard in Settings, they can use it for text entry within any app, except when editing secure text fields and phone number fields. People can choose multiple custom keyboards and switch between them at any time. For developer guidance, see Creating a custom keyboard.

Custom keyboards make sense when you want to expose unique keyboard functionality systemwide, such as a novel way of inputting text or the ability to type in a language the system doesn’t support. If you want to provide a custom keyboard for people to use only while they’re in your app, consider creating a custom input view instead.

Provide an obvious and easy way to switch between keyboards. People know that the Globe key on the standard keyboard — which replaces the Emoji key when multiple keyboards are available — quickly switches to other keyboards, and they expect a similarly intuitive experience in your keyboard.

Avoid duplicating system-provided keyboard features. On some devices, the Emoji/Globe key and Dictation key automatically appear beneath the keyboard, even when people are using custom keyboards. Your app can’t affect these keys, and it’s likely to be confusing if you repeat them in your keyboard.

Consider providing a keyboard tutorial in your app. People are used to the standard keyboard, and learning how to use a new keyboard can take time. You can help make the process easier by providing usage instructions in your app — for example, you might tell people how to choose your keyboard, activate it during text entry, use it, and switch back to the standard keyboard. Avoid displaying help content within the keyboard itself.

Platform considerations

Not supported in macOS or watchOS.

iOS, iPadOS

Use the keyboard layout guide to make the keyboard feel like an integrated part of your interface. Using the layout guide also helps you keep important parts of your interface visible while the virtual keyboard is onscreen. For guidance, see iOS keyboard layout guide.

An illustration of an app layout on iPhone, showing two stacked text fields and a button above the keyboard.

A checkmark in a circle to indicate a correct example.
The keyboard layout guide helps ensure that app UI and the keyboard work well together.

An illustration of an app layout on iPhone, showing two stacked text fields. The keyboard covers part of the bottom text field.

An X in a circle to indicate an incorrect example.
Without the layout guide, the keyboard could make entering text more difficult.

An illustration of an app layout on iPhone, showing two stacked text fields and a button above the keyboard. The keyboard covers part of the button.

An X in a circle to indicate an incorrect example.
Without the layout guide, the keyboard could make tapping a button more difficult.

tvOS

tvOS displays a linear virtual keyboard when people select a text field using the Siri Remote.

When people activate a digit entry view, tvOS displays a digit-specific keyboard. For guidance, see Digit entry views.

visionOS

In visionOS, the system-provided virtual keyboard supports both direct and indirect gestures and appears in a separate window that people can move where they want. You don’t need to account for the location of the keyboard in your layouts.

Play

watchOS

On Apple Watch, people can launch the Apple Continuity Keyboard, entering text from a nearby iOS device signed in to the same iCloud account.

Resources

Entering data

Keyboards

Layout

Developer documentation

UIKeyboardType — UIKit

Videos

Change log

Date

Changes

February 2, 2024

Clarified the virtual keyboard’s support for direct and indirect gestures in visionOS.

December 5, 2023

Added artwork for visionOS.

June 21, 2023

Changed page title from Onscreen keyboards and updated to include guidance for visionOS.

Current page is Virtual keyboards