Menu
A control for presenting a menu of actions.
info
You can use Text
, Divider
, Button
, Section
, Toggle
and Menu
as children of Menu
.
Example​
- swiftui-react-native
- SwiftUI
<Menu title="Click Me!">
<Text>Some text</Text>
<Divider />
<Button
title="Delete"
role="destructive"
action={deleteItem}
systemImage="trash"
/>
<Section header="Section">
<Text>Item 1</Text>
<Text>Item 2</Text>
<Text>Item 3</Text>
</Section>
<Menu title="Sub menu">
<Text>Sub menu item</Text>
</Menu>
</Menu>
Menu("Click Me!") {
Text("Some text")
Divider()
Button("Delete", systemImage: "trash", role: .destructive, action: deleteItem)
Section(header: "Section") {
Text("Item 1")
Text("Item 2")
Text("Item 3")
}
Menu("Sub menu") {
Text("Sub menu item")
}
}
Props​
List inherits all View Modifiers as props.
prop | description | type | required | default |
---|---|---|---|---|
children | Menu content | ReactNode | no | null |
title | Menu title | string | no | undefined |
systemImage | SF Symbol name | string | no | undefined |
primaryAction | Menu primary action when clicked | () => void | no | undefined |