Skip to main content
.sheet(props: { isPresented: boolean, setIsPresented: (value: boolean) => void, content: () => Component, onDismiss?: () => void }): Component;

Parameters

props
object
Configuration object for the sheet presentation.
props.isPresented
boolean
Boolean state controlling whether the sheet is visible.
props.setIsPresented
(value: boolean) => void
Function to update the presentation state.
props.content
() => Component
Function that returns the content to display in the sheet.
props.onDismiss
() => void
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()
})