ToolbarItem

A model that represents an item which can be placed in the toolbar or navigation bar.

ComponentiOS 14.0+macOS 11.0+tvOS 14.0+watchOS 7.0+ToolbarItem in SwiftUI

Declaration

React
import { ToolbarItem } from 'swiftui-react-native';
Swift
nonisolated struct ToolbarItem<ID, Content> where Content : View

Initializers

2 SwiftUI initializers back <ToolbarItem>. The props you pass pick one.

React
<ToolbarItem
  placement?: SwiftUI.ToolbarItemPlacement
>
  children?: ReactNode
</ToolbarItem>
Swift
nonisolated init(
    placement: ToolbarItemPlacement = .automatic,
    @ContentBuilder content: () -> Content
)
  • Which section of the toolbar the item should be placed in.

    Default `.automatic`

  • childrenReactNode

    Content. Strings become Text; React Native views are laid out by Yoga and placed by SwiftUI.

    Swift content: () -> Content

Also takes the common view props: modifiers, style and testID.

See also

More in Toolbars.