.sheet(props: { isPresented: boolean, setIsPresented: (value: boolean) => void, content: () => Component, onDismiss?: () => void }): Component;
Parameters
Configuration object for the sheet presentation.
Boolean state controlling whether the sheet is visible.
Function to update the presentation state.
Function that returns the content to display in the sheet.
Optional callback called when the sheet is dismissed.
Support
Usage
Basic sheet presentation
VStack([
Button("Show Sheet", () => {
showingSheet = true;
})
]).sheet({
isPresented: showingSheet,
setIsPresented: setShowingSheet,
content: () =>
VStack([
Text("Sheet Content"),
Button("Dismiss", () => {
setShowingSheet(false);
})
])
.padding()
})
Sheet with dismiss callback
VStack([
Button("Edit Profile", () => {
setShowingEditSheet(true);
})
]).sheet({
isPresented: showingEditSheet,
setIsPresented: setShowingEditSheet,
onDismiss: () => {
console.log("Edit sheet was dismissed");
refreshUserData();
},
content: () => EditProfileView()
})