---
title: RenameButton
framework: swiftui
role: symbol
role_heading: Structure
path: swiftui/renamebutton
---

# RenameButton

A button that triggers a standard rename action.

## Declaration

```swift
nonisolated struct RenameButton<Label> where Label : View
```

## Overview

Overview A rename button receives its action from the environment. Use the renameAction(_:) modifier to set the action. The system disables the button if you don’t define an action. struct RowView: View {     @State private var text = ""     @FocusState private var isFocused: Bool

var body: some View {         TextField(text: $text) {             Text("Prompt")         }         .focused($isFocused)         .contextMenu {             RenameButton()             // ... your own custom actions         }         .renameAction { isFocused = true }     } } When someone taps the rename button in the context menu, the rename action focuses the text field by setting the isFocused property to true. You can use this button inside of a navigation title menu and the navigation title modifier automatically configures the environment with the appropriate rename action. ContentView()     .navigationTitle($contentTitle)     .toolbarTitleMenu {         // ... your own custom actions         RenameButton()     }

## Topics

### Creating an rename button

- [init()](swiftui/renamebutton/init().md)

## Relationships

### Conforms To

- [View](swiftui/view.md)

## See Also

### Creating special-purpose buttons

- [EditButton](swiftui/editbutton.md)
- [PasteButton](swiftui/pastebutton.md)
