Contents

toolbarMinimizeBehavior(_:for:)

Sets the minimize behavior for the specified bars.

Declaration

nonisolated func toolbarMinimizeBehavior(_ behavior: ToolbarMinimizeBehavior, for bars: ToolbarPlacement...) -> some View

Parameters

  • behavior:

    The minimize behavior.

  • bars:

    The bars to apply the behavior to.

Discussion

Use this modifier to enable toolbar minimization in response to scrolling. The supported placement is navigationBar. When the navigation bar minimizes, an integrated top tab bar will also minimize.

By default, the safe area adjusts as the navigation bar minimizes. Use toolbarMinimizationSafeAreaAdjustment(_:for:) to customize this.

NavigationStack {
    ScrollView {
        ForEach(0 ..< 50) { index in
            Text("\(index)").padding()
        }
    }
    .navigationTitle("Minimizing Title")
    .toolbarMinimizeBehavior(.onScrollDown, for: .navigationBar)
}

See Also

Minimizing a toolbar