---
title: "Role Button With Default Label | Explore SwiftUI"
description: "Creates a button that displays a default label. Learn how to use Role Button With Default Label in SwiftUI with visual code examples."
canonical_url: "https://exploreswiftui.com/library/button/role-button-with-default-label"
meta:
  author: "Explore SwiftUI"
  "og:description": "Creates a button that displays a default label. Learn how to use Role Button With Default Label in SwiftUI with visual code examples."
  "og:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Role%2BButton%2BWith%2BDefault%2BLabel%2Cdescription_Creates%2Ba%2Bbutton%2Bthat%2Bdisplays%2Ba%2Bdefault%2Blabel.%2Ccategory_Button%2Cimage_~L2FwaS9pbWFnZXMvMTM0L3ZhcmlhbnRzLzQyND92PTE3OTAwNzM0Nzg4NDImcj0yJnc9MTI4MCZxPTg1JmY9anBlZw%2CimageMode_crop%2CimagePosition_top%2CimageFrame_~cG9zaXRpb246IGFic29sdXRlOyByaWdodDogMDsgd2lkdGg6IDY0MHB4OyBoZWlnaHQ6IDQ4MHB4OyBkaXNwbGF5OiBmbGV4OyBvdmVyZmxvdzogaGlkZGVuOyBiYWNrZ3JvdW5kOiAjRkZGRkZGOyBib3gtc2hhZG93OiAwIC0xMHB4IDUwcHggcmdiYSgzNyw5OSwyMzUsMC4xOCk7IGJvcmRlci1sZWZ0OiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm90dG9tOiAwOyBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm9yZGVyLXRvcC1sZWZ0LXJhZGl1czogNzRweDs%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwibWFjT1MiLCJ3YXRjaE9TIiwidHZPUyIsInZpc2lvbk9TIl19%2Cp_Ii9saWJyYXJ5L2J1dHRvbi9yb2xlLWJ1dHRvbi13aXRoLWRlZmF1bHQtbGFiZWwi%2Cs_FVRkwinFqfIvx_hS.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Role Button With Default Label | Explore SwiftUI"
  "twitter:description": "Creates a button that displays a default label. Learn how to use Role Button With Default Label in SwiftUI with visual code examples."
  "twitter:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Role%2BButton%2BWith%2BDefault%2BLabel%2Cdescription_Creates%2Ba%2Bbutton%2Bthat%2Bdisplays%2Ba%2Bdefault%2Blabel.%2Ccategory_Button%2Cimage_~L2FwaS9pbWFnZXMvMTM0L3ZhcmlhbnRzLzQyND92PTE3OTAwNzM0Nzg4NDImcj0yJnc9MTI4MCZxPTg1JmY9anBlZw%2CimageMode_crop%2CimagePosition_top%2CimageFrame_~cG9zaXRpb246IGFic29sdXRlOyByaWdodDogMDsgd2lkdGg6IDY0MHB4OyBoZWlnaHQ6IDQ4MHB4OyBkaXNwbGF5OiBmbGV4OyBvdmVyZmxvdzogaGlkZGVuOyBiYWNrZ3JvdW5kOiAjRkZGRkZGOyBib3gtc2hhZG93OiAwIC0xMHB4IDUwcHggcmdiYSgzNyw5OSwyMzUsMC4xOCk7IGJvcmRlci1sZWZ0OiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm90dG9tOiAwOyBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm9yZGVyLXRvcC1sZWZ0LXJhZGl1czogNzRweDs%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwibWFjT1MiLCJ3YXRjaE9TIiwidHZPUyIsInZpc2lvbk9TIl19%2Cp_Ii9saWJyYXJ5L2J1dHRvbi9yb2xlLWJ1dHRvbi13aXRoLWRlZmF1bHQtbGFiZWwi%2Cs_FVRkwinFqfIvx_hS.png"
  "twitter:title": "Role Button With Default Label | Explore SwiftUI"
---

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

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

# **Role Button With Default Label**

Creates a button that displays a default label.

![Role Button With Default Label - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/134/variants/424?v=1790073478842&r=2&w=800&q=80&f=webp)

### **Platform Compatibility**

iOS 26.0+ iPadOS 26.0+ macOS 26.0+ watchOS 26.0+ tvOS 26.0+ visionOS 26.0+

### **Tags**

### **SwiftUI Code**

[ Docs](<https://developer.apple.com/documentation/swiftui/button/init(_:role:action:)>)

```
NavigationStack {
    VStack {
        Button(role: .cancel, action: action)
        Button(role: .close, action: action)
        Button(role: .confirm, action: action)
        Button(role: .destructive, action: action)
        Spacer()
    }
    .toolbar {
        Button(role: .cancel, action: action)
        Button(role: .close, action: action)
        Button(role: .confirm, action: action)
        Button(role: .destructive, action: action)
    }
}
```

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

Created: December 28, 2025Updated: December 29, 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 Button Components **

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

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

### **Button Sizing**

The preferred sizing behavior of buttons in the view hierarchy.

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

### **Glass Button Styles**

A button style that applies glass border artwork based on the button’s context

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

### **RenameButton**

A button that triggers a standard rename action

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

### **EditButton**

A button that toggles the edit mode environment value

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

### **PasteButton**

A system button that reads items from the pasteboard and delivers it to a closure.

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

### **Button Tint**

Sets the buttons tint color

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

### **Button Roles**

A value that describes the purpose of a button.

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

### **Button Border Shape**

A shape used to draw a button’s border.

### **Explore Other Components **

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

![Content NavigationSplitView - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/242/variants/1528?v=1790273533713&r=2&w=412&q=75&f=webp)

### **Content NavigationSplitView**

Creates a three-column navigation split view.

![Prefer Vertical Toolbar Items - iOS on iPhone Duo - Landscape - Closed - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/248/variants/1749?v=1790419867105&r=2&w=412&q=75&f=webp)

### **Prefer Vertical Toolbar Items**

A compression behavior that prioritizes keeping toolbar items visible over other elements, such as tabs. By default, tabs are prioritized.

![Custom List Section Spacing - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview](https://exploreswiftui.com/api/images/113/variants/94?v=1790073478842&r=2&w=412&q=75&f=webp)

### **Custom List Section Spacing**

Sets the spacing between adjacent sections in a List to a custom value.

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

### **Toolbar Overflow Menu**

The overflow menu of a toolbar. An overflow menu represents actions that are always placed in the toolbar’s overflow menu, regardless of the toolbar mode, platform, or customizability.

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

### **GraphicalDatePickerStyle**

A date picker style that displays an interactive calendar or clock

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

### **Picker Divider**

A Picker with a Divider

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

### **Custom Slider Ticks**

Creates a slider to select a value from a given range, subject to a step increment, which displays the provided labels and customizable ticks.

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

### **AccessoryCircularCapacityGaugeStyle**

A gauge style that displays a closed ring that’s partially filled in to indicate the gauge’s current value

```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/button/role-button-with-default-label#webpage","@type":"WebPage","dateModified":"2025-12-29T12:29:07.364Z","datePublished":"2025-12-28T09:45:13.754Z","description":"Creates a button that displays a default label. Learn how to use Role Button With Default Label in SwiftUI with visual code examples.","name":"Role Button With Default Label","url":"https://exploreswiftui.com/library/button/role-button-with-default-label","breadcrumb":{"@id":"https://exploreswiftui.com/library/button/role-button-with-default-label#breadcrumb"},"isPartOf":{"@id":"https://exploreswiftui.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://exploreswiftui.com/library/button/role-button-with-default-label"]}],"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/button/role-button-with-default-label#article","dateModified":"2025-12-29T12:29:07.364Z","datePublished":"2025-12-28T09:45:13.754Z","description":"Creates a button that displays a default label. Learn how to use Role Button With Default Label in SwiftUI with visual code examples.","headline":"Role Button With Default Label","inLanguage":"en-US","name":"Role Button With Default Label","thumbnailUrl":"https://exploreswiftui.com/api/images/134/variants/424?v=1790073478842&r=2","url":"https://exploreswiftui.com/library/button/role-button-with-default-label","@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/button/role-button-with-default-label#webpage"},"publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/button/role-button-with-default-label#/schema/software-source-code/1","@type":"SoftwareSourceCode","codeRepository":"https://developer.apple.com/documentation/swiftui/button/init(_:role:action:)","codeSampleType":"full example","description":"Creates a button that displays a default label. Learn how to use Role Button With Default Label in SwiftUI with visual code examples.","name":"Role Button With Default Label SwiftUI Example","programmingLanguage":"Swift","runtimePlatform":"SwiftUI","text":"NavigationStack {\n    VStack {\n        Button(role: .cancel, action: action)\n        Button(role: .close, action: action)\n        Button(role: .confirm, action: action)\n        Button(role: .destructive, action: action)\n        Spacer()\n    }\n    .toolbar {\n        Button(role: .cancel, action: action)\n        Button(role: .close, action: action)\n        Button(role: .confirm, action: action)\n        Button(role: .destructive, action: action)\n    }\n}","about":[{"@type":"Thing","name":"SwiftUI"},{"@type":"Thing","name":"Button"},{"@type":"Thing","name":"Role Button With Default Label"}]},{"@id":"https://exploreswiftui.com/library/button/role-button-with-default-label#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://exploreswiftui.com","position":1},{"@type":"ListItem","name":"Button","item":"https://exploreswiftui.com/library/button","position":2},{"@type":"ListItem","name":"Role Button With Default Label","item":"https://exploreswiftui.com/library/button/role-button-with-default-label","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/134/variants/424?v=1790073478842&r=2","inLanguage":"en","url":"https://exploreswiftui.com/api/images/134/variants/424?v=1790073478842&r=2"}]}
```