Skip to main content
.navigationBarBackButtonHidden(isHidden?: boolean): Component
isHidden
boolean
default:"true"
Whether the back button is hidden. Defaults to true.

Support

Usage

Hiding the back button

VStack([
    Text("Custom Detail View")
]).navigationBarBackButtonHidden()

With a custom back action

When hiding the default back button, provide an alternative navigation method using a toolbar item.
const body = () => {
    const [showDetail, setShowDetail] = useState(false)

    return VStack([
        Text("Detail Content")
    ])
        .navigationBarBackButtonHidden()
        .toolbar(
            ToolbarItem("navigationBarLeading",
                Button("Close", () => setShowDetail(false))
            )
        )
}

Notes

  • This modifier is typically applied to a destination view within a NavigationStack.
  • When hiding the back button, consider providing an alternative way for the user to navigate back.

See Also