toggle button?

how do insert toggle button in this code?>

// Function to open/close the minimap.
function toggleMinimap() {
    if(!mapOpen) {
        // Set the camera to use the entire screen.
        camera.rect = Rect (0,0,1,1);
        // Update the global so other scripts can know.
        mapOpen = true;
        // Unlock the cursor for proper point/click navigation.
        Screen.lockCursor = false;
        // Update the relevant PlayerPref key, could be useful for persistence.
        PlayerPrefs.SetInt("mapOpen",1);
    }
    else {
        // Set the camera to use a small portion of the screen.
        camera.rect = Rect (0.8,0.8,1,1);
        // Update the global so other scripts can know.
        mapOpen = false;
        // Lock the cursor for TPS control.
        Screen.lockCursor = true;
        // Update the relevant PlayerPref key, could be useful for persistence.
        PlayerPrefs.SetInt("mapOpen",0);
    }
   
    // Debug print the current state of the map.
    print("mapOpen = " + mapOpen);
   
}

// Method to store the height of the camera as a PlayerPref.
function saveHeight() {
    PlayerPrefs.SetInt("MinimapCameraHeight",height);
}

I’m pretty sure the doc explains it better than me.