---
title: "TextFieldLink | Explore SwiftUI"
description: "A control that requests text input from the user when pressed. Learn how to use TextFieldLink in SwiftUI with visual code examples."
canonical_url: "https://exploreswiftui.com/library/link/textfieldlink"
meta:
  author: "Explore SwiftUI"
  "og:description": "A control that requests text input from the user when pressed. Learn how to use TextFieldLink in SwiftUI with visual code examples."
  "og:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_TextFieldLink%2Cdescription_A%2Bcontrol%2Bthat%2Brequests%2Btext%2Binput%2Bfrom%2Bthe%2Buser%2Bwhen%2Bpressed%2Ccategory_Link%2Cimage_~L2FwaS9pbWFnZXMvNzYvdmFyaWFudHMvMTkyP3Y9MTc5MDA3MzQ3ODg0MiZyPTImdz0xMjgwJnE9ODUmZj1qcGVn%2CimageMode_crop%2CimagePosition_center%2CimageFrame_~cG9zaXRpb246IGFic29sdXRlOyByaWdodDogMDsgd2lkdGg6IDY0MHB4OyBoZWlnaHQ6IDQ4MHB4OyBkaXNwbGF5OiBmbGV4OyBvdmVyZmxvdzogaGlkZGVuOyBiYWNrZ3JvdW5kOiAjRkZGRkZGOyBib3gtc2hhZG93OiAwIC0xMHB4IDUwcHggcmdiYSgzNyw5OSwyMzUsMC4xOCk7IGJvcmRlci1sZWZ0OiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgdG9wOiA3NXB4OyBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm9yZGVyLWJvdHRvbTogMXB4IHNvbGlkIHJnYmEoMCwwLDAsMC4wNik7IGJvcmRlci10b3AtbGVmdC1yYWRpdXM6IDMycHg7IGJvcmRlci1ib3R0b20tbGVmdC1yYWRpdXM6IDMycHg7%2Cprops_eyJwbGF0Zm9ybXMiOlsid2F0Y2hPUyJdfQ%2Cp_Ii9saWJyYXJ5L2xpbmsvdGV4dGZpZWxkbGluayI%2Cs_UjYlPE0lIp2WQpV1.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "TextFieldLink | Explore SwiftUI"
  "twitter:description": "A control that requests text input from the user when pressed. Learn how to use TextFieldLink in SwiftUI with visual code examples."
  "twitter:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_TextFieldLink%2Cdescription_A%2Bcontrol%2Bthat%2Brequests%2Btext%2Binput%2Bfrom%2Bthe%2Buser%2Bwhen%2Bpressed%2Ccategory_Link%2Cimage_~L2FwaS9pbWFnZXMvNzYvdmFyaWFudHMvMTkyP3Y9MTc5MDA3MzQ3ODg0MiZyPTImdz0xMjgwJnE9ODUmZj1qcGVn%2CimageMode_crop%2CimagePosition_center%2CimageFrame_~cG9zaXRpb246IGFic29sdXRlOyByaWdodDogMDsgd2lkdGg6IDY0MHB4OyBoZWlnaHQ6IDQ4MHB4OyBkaXNwbGF5OiBmbGV4OyBvdmVyZmxvdzogaGlkZGVuOyBiYWNrZ3JvdW5kOiAjRkZGRkZGOyBib3gtc2hhZG93OiAwIC0xMHB4IDUwcHggcmdiYSgzNyw5OSwyMzUsMC4xOCk7IGJvcmRlci1sZWZ0OiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgdG9wOiA3NXB4OyBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm9yZGVyLWJvdHRvbTogMXB4IHNvbGlkIHJnYmEoMCwwLDAsMC4wNik7IGJvcmRlci10b3AtbGVmdC1yYWRpdXM6IDMycHg7IGJvcmRlci1ib3R0b20tbGVmdC1yYWRpdXM6IDMycHg7%2Cprops_eyJwbGF0Zm9ybXMiOlsid2F0Y2hPUyJdfQ%2Cp_Ii9saWJyYXJ5L2xpbmsvdGV4dGZpZWxkbGluayI%2Cs_UjYlPE0lIp2WQpV1.png"
  "twitter:title": "TextFieldLink | Explore SwiftUI"
---

> Index of every page on this site: [llms.txt](https://exploreswiftui.com/llms.txt)

**Interactive previews**[ iPhone](https://exploreswiftui.com/iphone?element=76)

# **TextFieldLink**

A control that requests text input from the user when pressed

![TextFieldLink - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/76/variants/192?v=1790073478842&r=2&w=800&q=80&f=webp)

### **Platform Compatibility**

watchOS 9.0+

### **Tags**

### **SwiftUI Code**

[ Docs](<https://developer.apple.com/documentation/swiftui/textfieldlink/init(prompt:label:onsubmit:)>)

```
TextFieldLink("Set Text", prompt: Text("Custom Placeholder")) { str in
  print("Typed text: \(str)")
}
```

### **Found an issue or have a suggestion?**

Created: June 5, 2025Updated: December 27, 2025

![Connect Wizard](https://exploreswiftui.com/_ipx/f_webp&q_80&s_48x48/images/connect-wizard-icon.png)

**Connect Wizard**

**Unlock insights App Store Connect doesn’t show you.**

[** Get Started **](https://apps.apple.com/app/apple-store/id6747314580?pt=121213751&ct=Explore%20SwiftUI%20Banner&mt=8)

### **More Link Components **

[**View all **](https://exploreswiftui.com/library/link)

![HelpLink - macOS - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/77/variants/30?v=1790073478842&r=2&w=412&q=75&f=webp)

### **HelpLink**

A button with a standard appearance that opens app-specific help documentation

![Custom Preview Item ShareLink  - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/75/variants/92?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Custom Preview Item ShareLink **

Creates an instance, with a custom label, that presents the share interface

![ShareLink - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/74/variants/28?v=1790073478842&r=2&w=412&q=75&f=webp)

### **ShareLink**

A view that controls a sharing presentation

![Link - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/73/variants/207?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Link**

A control for navigating to a URL

### **Explore Other Components **

[**Browse all **](https://exploreswiftui.com/)

![System Image Label - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/146/variants/488?v=1790073478842&r=2&w=412&q=75&f=webp)

### **System Image Label**

Creates a label with a system icon image and a title generated from a localized string.

![Label Styles - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/149/variants/472?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Label Styles**

Sets the style for labels within this view.

![Hinge State - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/249/variants/1765?v=1793099575627&r=2&w=412&q=75&f=webp)

### **Hinge State**

A type encapsulating the state of a single hinge.

![Custom Header Subscription Store View - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/229/variants/647?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Custom Header Subscription Store View**

Creates a view that loads all the subscriptions in a subscription group from the App Store, and merchandises them with custom marketing content.

![Semantic Colors - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/8/variants/51?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Semantic Colors**

![Custom Placeholder Async URL Image - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/194/variants/275?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Custom Placeholder Async URL Image**

Loads and displays a modifiable image from the specified URL load request using a custom placeholder until the image loads.

![Swipe Action - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/200/variants/322?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Swipe Action**

Adds custom swipe actions to a row in a list or container, notifying you when the actions are revealed or dismissed.

![VisionOS background materials - visionOS - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/260/variants/2143?v=1793707679045&r=2&w=412&q=75&f=webp)

### **VisionOS background materials**

All background materials on visionOS

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://exploreswiftui.com/#website","@type":"WebSite","description":"A visual library for SwiftUI APIs, components, and modifiers","inLanguage":"en-US","name":"Explore SwiftUI","url":"https://exploreswiftui.com/","publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/link/textfieldlink#webpage","@type":"WebPage","dateModified":"2025-12-27T09:49:02.548Z","datePublished":"2025-06-05T12:27:58.208Z","description":"A control that requests text input from the user when pressed. Learn how to use TextFieldLink in SwiftUI with visual code examples.","name":"TextFieldLink","url":"https://exploreswiftui.com/library/link/textfieldlink","breadcrumb":{"@id":"https://exploreswiftui.com/library/link/textfieldlink#breadcrumb"},"isPartOf":{"@id":"https://exploreswiftui.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://exploreswiftui.com/library/link/textfieldlink"]}],"primaryImageOfPage":{"@id":"https://exploreswiftui.com/#logo"}},{"@id":"https://exploreswiftui.com/#identity","@type":"Organization","description":"A visual library for SwiftUI APIs, components, and modifiers","name":"Explore SwiftUI","url":"https://exploreswiftui.com","logo":{"@id":"https://exploreswiftui.com/#logo"},"sameAs":["https://x.com/Typ0genius","https://mastodon.social/@Typ0genius"]},{"@id":"https://exploreswiftui.com/library/link/textfieldlink#article","dateModified":"2025-12-27T09:49:02.548Z","datePublished":"2025-06-05T12:27:58.208Z","description":"A control that requests text input from the user when pressed. Learn how to use TextFieldLink in SwiftUI with visual code examples.","headline":"TextFieldLink","inLanguage":"en-US","name":"TextFieldLink","thumbnailUrl":"https://exploreswiftui.com/api/images/76/variants/192?v=1790073478842&r=2","url":"https://exploreswiftui.com/library/link/textfieldlink","@type":["Article","TechArticle"],"about":{"@type":"Thing","name":"SwiftUI"},"author":{"@id":"https://exploreswiftui.com/#identity"},"image":{"@id":"https://exploreswiftui.com/#/schema/image/1"},"isPartOf":{"@type":"WebSite","name":"Explore SwiftUI","url":"https://exploreswiftui.com"},"mainEntityOfPage":{"@id":"https://exploreswiftui.com/library/link/textfieldlink#webpage"},"publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/link/textfieldlink#/schema/software-source-code/1","@type":"SoftwareSourceCode","codeRepository":"https://developer.apple.com/documentation/swiftui/textfieldlink/init(prompt:label:onsubmit:)","codeSampleType":"full example","description":"A control that requests text input from the user when pressed. Learn how to use TextFieldLink in SwiftUI with visual code examples.","name":"TextFieldLink SwiftUI Example","programmingLanguage":"Swift","runtimePlatform":"SwiftUI","text":"TextFieldLink(\"Set Text\", prompt: Text(\"Custom Placeholder\")) { str in\n  print(\"Typed text: \\(str)\")\n}","about":[{"@type":"Thing","name":"SwiftUI"},{"@type":"Thing","name":"Link"},{"@type":"Thing","name":"TextFieldLink"}]},{"@id":"https://exploreswiftui.com/library/link/textfieldlink#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://exploreswiftui.com","position":1},{"@type":"ListItem","name":"Link","item":"https://exploreswiftui.com/library/link","position":2},{"@type":"ListItem","name":"TextFieldLink","item":"https://exploreswiftui.com/library/link/textfieldlink","position":3}]},{"@id":"https://exploreswiftui.com/#logo","@type":"ImageObject","caption":"Explore SwiftUI","contentUrl":"https://exploreswiftui.com/apple-touch-icon.png","inLanguage":"en","url":"https://exploreswiftui.com/apple-touch-icon.png"},{"@id":"https://exploreswiftui.com/#/schema/image/1","@type":"ImageObject","contentUrl":"https://exploreswiftui.com/api/images/76/variants/192?v=1790073478842&r=2","inLanguage":"en","url":"https://exploreswiftui.com/api/images/76/variants/192?v=1790073478842&r=2"}]}
```