Much of your online material like social media or email accounts will likely remain intact for years, unless platforms are informed that you’ve died and are instructed to close them. Some of the companies will have policies of removing accounts due to a period of inactivity.
As for your data, social media companies claim to permanently delete all data, apart from some anonymized logs, with an account’s closure. Some platforms, like Google, can provide content from a deceased user’s account. But sites generally would not give anyone access to private information like messages you’ve sent or your passwords