Show:

inventoryPanel.SetActive(true);

Hide:

inventoryPanel.SetActive(false);

Toggle:

inventoryPanel.SetActive(
    !inventoryPanel.activeSelf
);

With CanvasGroup:

group.alpha = 0f;
group.interactable = false;
group.blocksRaycasts = false;