Declaration
compose().sectionActions({
content: ReactNode,
})nonisolated func sectionActions<Content>(
@ContentBuilder content: () -> Content
) -> some View
where Content : ViewParameters
options.content*ReactNode
Discussion
On iOS, the actions are displayed as items after the content of the section. On macOS, the actions are displayed when a user hovers over the section.
The following example adds an 'Add' button to the 'Categories' section.
List {
Label("Home", systemImage: "house")
Label("Alerts", systemImage: "bell")
Section("Categories") {
Label("Climate", systemImage: "fan")
Label("Lights", systemImage: "lightbulb")
}
.sectionActions {
Button("Add Category", systemImage: "plus") { }
}
}See also
More in Lists and tables.
- deleteDisabledAdds a condition for whether the view's view hierarchy is deletable.
- listItemTintSets the tint effect for content in a list.
- listRowBackgroundPlaces a custom background view behind a list row item.
- listRowInsetsSets the insets of rows in a list on the specified edges.
- listRowSeparatorSets the display mode for the separator associated with this specific row.
- listRowSeparatorTintSets the tint color associated with a row.
- listRowSpacingSets the vertical spacing between two adjacent rows in a List.
- listSectionIndexVisibilityChanges the visibility of the list section index.
- listSectionMarginsSet the section margins for the specific edges.
- listSectionSeparatorSets whether to hide the separator associated with a list section.
- listSectionSeparatorTintSets the tint color associated with a section.
- listSectionSpacingSets the spacing between adjacent sections in a List to a custom value.