---
title: keyboard
framework: swiftui
role: symbol
role_heading: Type Property
path: swiftui/toolbaritemplacement/keyboard
---

# keyboard

A placement for items in the keyboard section.

## Declaration

```swift
static let keyboard: ToolbarItemPlacement
```

## Discussion

Discussion On iOS, keyboard items are above the software keyboard when present, or at the bottom of the screen when a hardware keyboard is attached. On macOS, keyboard items will be placed inside the Touch Bar. A FocusedValue can be used to adjust the content of the keyboard bar based on the currently focused view. In the example below, the keyboard bar gains additional buttons only when the appropriate TextField is focused. enum Field {     case suit     case rank }

struct KeyboardBarDemo : View {     @FocusedValue(\.field) var field: Field?

var body: some View {         HStack {             TextField("Suit", text: $suitText)                 .focusedValue(\.field, .suit)             TextField("Rank", text: $rankText)                 .focusedValue(\.field, .rank)         }         .toolbar {             ToolbarItemGroup(placement: .keyboard) {                 if field == .suit {                     Button("♣️", action: {})                     Button("♥️", action: {})                     Button("♠️", action: {})                     Button("♦️", action: {})                 }                 DoneButton()             }         }     } }

## See Also

### Getting explicit placement

- [topBarLeading](swiftui/toolbaritemplacement/topbarleading.md)
- [topBarTrailing](swiftui/toolbaritemplacement/topbartrailing.md)
- [topBarPinnedTrailing](swiftui/toolbaritemplacement/topbarpinnedtrailing.md)
- [bottomBar](swiftui/toolbaritemplacement/bottombar.md)
- [bottomOrnament](swiftui/toolbaritemplacement/bottomornament.md)
- [accessoryBar(id:)](swiftui/toolbaritemplacement/accessorybar(id:).md)
