sectionActions(content:)
Adds custom actions to a tab section.
Declaration
nonisolated func sectionActions<Content>(@ContentBuilder content: () -> Content) -> some TabContent<Self.TabValue> where Content : View
Discussion
On iOS, the actions are displayed after the other tabs in the section. On macOS, the actions are displayed when a user hovers over the section.
Applying this modifier to a single Tab has no effect.
The following example adds an ‘Add’ button to the ‘Categories’ section.
TabView {
Tab("Home", systemImage: "house") {
HomeView()
}
Tab("Alerts", systemImage: "bell") {
AlertsView()
}
TabSection("Categories") {
Tab("Climate", systemImage: "fan") {
ClimateView()
}
Tab("Lights", systemImage: "lightbulb") {
LightsView()
}
}
.sectionActions {
Button("Add Category", systemImage: "plus") { }
}
}
.tabViewStyle(.sidebarAdaptable)See Also
Configuring tab content
badge(_:)contextMenu(menuItems:)customizationBehavior(_:for:)customizationID(_:)defaultSectionExpansion(_:)TabSectionExpansiondefaultVisibility(_:for:)disabled(_:)draggable(_:)dropDestination(for:action:)help(_:)hidden(_:)popover(isPresented:attachmentAnchor:arrowEdge:content:)popover(item:attachmentAnchor:arrowEdge:content:)springLoadingBehavior(_:)