TabView Bottom Accessory Placement
A placement of the bottom accessory in a tab view. You can use this to adjust the content of the accessory view based on the placement
Platform Compatibility
Tags
SwiftUI Code
var body: some View {
TabView {
Tab("1", systemImage: "1.circle") {
List {
ForEach(0 ..< 100, id: \.self) {
Text("Item \($0)")
}
}
}
Tab("2", systemImage: "2.circle") {
EmptyView()
}
Tab("3", systemImage: "3.circle") {
EmptyView()
}
}
.tabBarMinimizeBehavior(.onScrollDown)
.tabViewBottomAccessory {
AccessoryContent()
}
}
struct AccessoryContent: View {
@Environment(\.tabViewBottomAccessoryPlacement) var placement
var body: some View {
switch placement {
case .inline:
Text("Inline")
case .expanded:
Text("Expanded")
case .none:
Text("")
}
}
}Found an issue or have a suggestion?
More TabView Components
View allDefault Tab Bar Placement
Specifies the preferred placement for the tabs of a TabView in the sidebarAdaptable style on platforms where the tab bar cannot adapt between different representations, and only one representation can be shown. For example, on iOS, it can enforce the sidebar on large-screen devices like the Pro Max, and iPhone Duo. This modifier has no effect on iPadOS.
Default Collapsed Tab Section
Sets the default expansion state for the section containing this tab to collapsed when displayed in the sidebar.
Tab View Customization Behavior
Configures the customization behavior of customizable tab view content.
Tab View Customization
Specifies the customizations to apply to the sidebar representation of the tab view.
Explore Other Components
Browse allBackground Extension Effect
Adds the background extension effect to the view. The view will be duplicated into mirrored copies which will be placed around the view on any edge with available safe area. Additionally, a blur effect will be applied on top to blur out the copies