---
title: "Edit Button | Explore SwiftUI"
description: "A button that toggles the edit mode environment value. Learn how to use Edit Button in SwiftUI with visual code examples."
canonical_url: "https://exploreswiftui.com/library/list/edit-button"
meta:
  author: "Explore SwiftUI"
  "og:description": "A button that toggles the edit mode environment value. Learn how to use Edit Button in SwiftUI with visual code examples."
  "og:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Edit%2BButton%2Cdescription_A%2Bbutton%2Bthat%2Btoggles%2Bthe%2Bedit%2Bmode%2Benvironment%2Bvalue.%2Ccategory_List%2Cimage_~L2FwaS9pbWFnZXMvMTMwL3ZhcmlhbnRzLzM2Nz92PTE3OTAwNzM0Nzg4NDImcj0yJnc9MTI4MCZxPTg1JmY9anBlZw%2CimageMode_crop%2CimagePosition_top%2CimageFrame_~cG9zaXRpb246IGFic29sdXRlOyByaWdodDogMDsgd2lkdGg6IDY0MHB4OyBoZWlnaHQ6IDQ4MHB4OyBkaXNwbGF5OiBmbGV4OyBvdmVyZmxvdzogaGlkZGVuOyBiYWNrZ3JvdW5kOiAjRkZGRkZGOyBib3gtc2hhZG93OiAwIC0xMHB4IDUwcHggcmdiYSgzNyw5OSwyMzUsMC4xOCk7IGJvcmRlci1sZWZ0OiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm90dG9tOiAwOyBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm9yZGVyLXRvcC1sZWZ0LXJhZGl1czogNzRweDs%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwidmlzaW9uT1MiXX0%2Cp_Ii9saWJyYXJ5L2xpc3QvZWRpdC1idXR0b24i%2Cs_qA2APyk2J3WXh2Vq.png"
  "og:image:height": "630"
  "og:image:type": image/png
  "og:image:width": "1200"
  "og:title": "Edit Button | Explore SwiftUI"
  "twitter:description": "A button that toggles the edit mode environment value. Learn how to use Edit Button in SwiftUI with visual code examples."
  "twitter:image": "https://exploreswiftui.com/_og/d/c_Component%2Ctitle_Edit%2BButton%2Cdescription_A%2Bbutton%2Bthat%2Btoggles%2Bthe%2Bedit%2Bmode%2Benvironment%2Bvalue.%2Ccategory_List%2Cimage_~L2FwaS9pbWFnZXMvMTMwL3ZhcmlhbnRzLzM2Nz92PTE3OTAwNzM0Nzg4NDImcj0yJnc9MTI4MCZxPTg1JmY9anBlZw%2CimageMode_crop%2CimagePosition_top%2CimageFrame_~cG9zaXRpb246IGFic29sdXRlOyByaWdodDogMDsgd2lkdGg6IDY0MHB4OyBoZWlnaHQ6IDQ4MHB4OyBkaXNwbGF5OiBmbGV4OyBvdmVyZmxvdzogaGlkZGVuOyBiYWNrZ3JvdW5kOiAjRkZGRkZGOyBib3gtc2hhZG93OiAwIC0xMHB4IDUwcHggcmdiYSgzNyw5OSwyMzUsMC4xOCk7IGJvcmRlci1sZWZ0OiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm90dG9tOiAwOyBib3JkZXItdG9wOiAxcHggc29saWQgcmdiYSgwLDAsMCwwLjA2KTsgYm9yZGVyLXRvcC1sZWZ0LXJhZGl1czogNzRweDs%2Cprops_eyJwbGF0Zm9ybXMiOlsiaU9TIiwiaVBhZE9TIiwidmlzaW9uT1MiXX0%2Cp_Ii9saWJyYXJ5L2xpc3QvZWRpdC1idXR0b24i%2Cs_qA2APyk2J3WXh2Vq.png"
  "twitter:title": "Edit Button | Explore SwiftUI"
---

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

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

# **Edit Button**

A button that toggles the edit mode environment value.

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

### **Platform Compatibility**

iOS 13.0+ iPadOS 13.0+ visionOS 1.0+

### **Tags**

### **SwiftUI Code**

[ Docs](https://developer.apple.com/documentation/swiftui/editbutton)

```
@State var items = ["Foo", "Bar"]

var body: some View {
  NavigationView {
    List {
      ForEach(items, id: \.self) { item in
      Text(item)
    }
    .onDelete { _ in action() }
    .onMove { _, _ in action() }
  }
  .toolbar {
    EditButton()
  }
}
}
```

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

Created: August 11, 2025Updated: August 11, 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 List Components **

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

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

### **Outline Group**

A structure that computes views and disclosure groups on demand from an underlying collection of tree-structured, identified data.

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

### **Disclosure Group**

A view that shows or hides another content view, based on the state of a disclosure control.

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

### **Section Index Label and Visibility**

Sets the label that is used in a section index to point to this section, typically only a single character long. Changes the visibility of the list section index.

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

### **Move Disabled**

Adds a condition for whether the view’s view hierarchy is movable.

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

### **Delete Disabled**

Adds a condition for whether the view’s view hierarchy is deletable.

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

### **Refreshable List**

Marks this view as refreshable.

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

### **Swipe Action**

Adds custom swipe actions to a row in a list.

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

### **List Badge Prominence**

Specifies the prominence of badges created by this view.

### **Explore Other Components **

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

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

### **PaletteControlGroupStyle**

A control group style that presents its content as a palette.

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

### **ControlSize**

A control version that is the default size

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

### **TabView**

Creates Tabs with title, image, systemImage and custom Label.

![VerticalPageTabViewStyle - watchOS - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/162/variants/463?v=1790073478842&r=2&w=412&q=75&f=webp)

### **VerticalPageTabViewStyle**

A TabViewStyle that displays a vertical TabView interaction and appearance.

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

### **Item Sheet**

Presents a sheet using the given item as a data source for the sheet’s content. On watchOS, sheets are displayed as fullScreenCover.

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

### **Toolbar Vertical Edge**

This value reflects the system’s preferred edge for the vertical bar in the current context, regardless of whether a vertical bar is currently visible. Use it to position custom bars or other UI relative to the system’s bar placement.

![Split Arrangement Layout Ratio - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview](https://exploreswiftui.com/api/images/244/variants/1564?v=1790273511100&r=2&w=412&q=75&f=webp)

### **Split Arrangement Layout Ratio**

Sets the preferred size ratio for an arrangement view in a split style. Use this modifier when you want to customize the size of the view compared to its other views in the split layout.

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

### **Single Subscription Store View**

Creates a view that loads subscriptions based on a collection of product identifiers, and merchandises them with automatic marketing content.

```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/list/edit-button#webpage","@type":"WebPage","dateModified":"2025-08-11T05:33:46.152Z","datePublished":"2025-08-11T05:33:46.152Z","description":"A button that toggles the edit mode environment value. Learn how to use Edit Button in SwiftUI with visual code examples.","name":"Edit Button","url":"https://exploreswiftui.com/library/list/edit-button","breadcrumb":{"@id":"https://exploreswiftui.com/library/list/edit-button#breadcrumb"},"isPartOf":{"@id":"https://exploreswiftui.com/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://exploreswiftui.com/library/list/edit-button"]}],"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/list/edit-button#article","dateModified":"2025-08-11T05:33:46.152Z","datePublished":"2025-08-11T05:33:46.152Z","description":"A button that toggles the edit mode environment value. Learn how to use Edit Button in SwiftUI with visual code examples.","headline":"Edit Button","inLanguage":"en-US","name":"Edit Button","thumbnailUrl":"https://exploreswiftui.com/api/images/130/variants/367?v=1790073478842&r=2","url":"https://exploreswiftui.com/library/list/edit-button","@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/list/edit-button#webpage"},"publisher":{"@id":"https://exploreswiftui.com/#identity"}},{"@id":"https://exploreswiftui.com/library/list/edit-button#/schema/software-source-code/1","@type":"SoftwareSourceCode","codeRepository":"https://developer.apple.com/documentation/swiftui/editbutton","codeSampleType":"full example","description":"A button that toggles the edit mode environment value. Learn how to use Edit Button in SwiftUI with visual code examples.","name":"Edit Button SwiftUI Example","programmingLanguage":"Swift","runtimePlatform":"SwiftUI","text":"@State var items = [\"Foo\", \"Bar\"]\n\nvar body: some View {\n  NavigationView {\n    List {\n      ForEach(items, id: \\.self) { item in\n      Text(item)\n    }\n    .onDelete { _ in action() }\n    .onMove { _, _ in action() }\n  }\n  .toolbar {\n    EditButton()\n  }\n}\n}","about":[{"@type":"Thing","name":"SwiftUI"},{"@type":"Thing","name":"List"},{"@type":"Thing","name":"Edit Button"}]},{"@id":"https://exploreswiftui.com/library/list/edit-button#breadcrumb","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","name":"Home","item":"https://exploreswiftui.com","position":1},{"@type":"ListItem","name":"List","item":"https://exploreswiftui.com/library/list","position":2},{"@type":"ListItem","name":"Edit Button","item":"https://exploreswiftui.com/library/list/edit-button","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/130/variants/367?v=1790073478842&r=2","inLanguage":"en","url":"https://exploreswiftui.com/api/images/130/variants/367?v=1790073478842&r=2"}]}
```